Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Function block programming for PIC18F

Status
Not open for further replies.

Lourens

Member
For those interested in using PIC18F for control-based projects VPS_P18 ver2.0 now includes a simulator which makes it very easy to develop and test your application without having to assemble some hardware. I have attached the setup file and the doc for FB181 because this function block was changed to use another (better?) algorithm. Be sure to also check the readme file.
 
Hi Lourens,
I would like to try the new version, but I can not download, unfortunately :-(
can you check that please?

thank you
Steffen
 
hi steffen
the disk(?) problems we had on the forum some time ago must have damaged something. Here is the latest version, now at 2.01. The simulator is very handy, for small applications <30 FBs it runs at about half real time on a pc with multi processors. In the ReadMeFirst file it tells you where to find some basic documentation. The documentation for the function blocks is about 7MB. If someone is interested i can upload it in a few batches or supply a link for downloading. The modifications i made to the I2C function blocks are working well (application notes included in DOCUMENTATION directory) and i am currently working on a I2C slave function block. I would like to know what applications you have for VPS_P18 because i want to include application examples in the function block manual. And for those who wants to know, VPS_P18 is distributed as a free application to hobbyists who wants to see what horse power you can get
from an 8-bit processor without writing a single line of code.
 

Attachments

  • ReadMeFirst.txt
    3.3 KB · Views: 293
  • VPS_P18setup2_01.exe
    2.9 MB · Views: 245
Hi Lourens,
Thanks for the new upload. I test now a little and tell me then.
best regards
Steffen
 
Hi Lourens,
in the meantime, I worked a bit with the VPS_P18. The basic functions, but I have not tried them all. The program works very well.
One question: they have a proposal for activation one 74HC595 shift register (eg for 7-Segmet LED display)

best regards
Steffen
 
Hi Steffen
Response to VPS_P18 Function Block programming was poor so i am glad you are playing around with it. To drive the 74HC595 from VPS is not complicated, but then you will have to create a User Defined function block. On second thoughts i like your idea of using a 74HC595/599 to increase the outputs and i will add a function block to do this, but this can only happen after 2 weeks because i am a bit busy right now. Let me know how is your PIC18 assembler.
regards
Lourens
 
Hi Lourens,
pity that there is so little interest :-(
Since I can not programming language, VPS_P18 is a great solution for me. Until now I am using "Visual Parsic" which was discontinued in 2008 and "only" PIC12/16 support. There I realized with the 74595 multiplexer and bitswitches (picture)
A function block, I would be very happy (but time)

best regards
Steffen

74595.jpg
 
Hi Steffen
Good to hear that with little programming experience you find VPS a great solution. Even seasoned c programmers will find it heavy going programming a full pid controller with a complete GUI and on-line tuning executed in less than 200uSec. Any way back to your 74595 application. The function block for this will use 3 outputs from PIC to 74595. RCK, SCK, SER. and 1 input (byte value), which will be the patern for the 7 segments. To generate the patern you can use function block 41. Use the simulator for a quick test. For each 7-segment display you will use 3 output pins. If you have 4 or more digits to display you can consider to use a LCD display. There are blocks for displaying text, byte, 16bit-integer, and floating point values. I use the 20x4 line displays quite often. VISUAL PARSIC looks very interesting, is it also using function blocks and does it offer facilities for debugging?
Regards
Lourens
 
Hi Lourens,
thanks for the answers :) Parsic also a simulator mode but has no online debug mode. I once attached a demo version, maybe they can from it "steal" some information;-)
With PID controllers I have not yet employed. Doing more with clocks, timers, fuel consumption indicator, thermometer and the like.
Your program but more modern functions (i2c) and can better perform calculations.
:) I look forward to the further development

best regards
Steffen
 

Attachments

  • parsicdemo.zip
    1.4 MB · Views: 558
Hi Steffen
Thanks for the parsicdemo. I will try it later this week. Can you send me the Pic pin numbers you want to use for RCK, SCK, SER then i can make a User Defined Function Block for you to test the 74595. How many 7-segment displays you want to use? Also remember if you want to use more than 2 code pages on VPS you must register. You can read about registration in the file C:\\LLG_CB\DOCUMENTATION\GENERAL\VPS_P18_Registration.pdf. This file also contains my e-mail address if you want to send me your project file (xxxxx.lcb)
Regards
Lourens
 
Hi Lourens,
I usually use 1 to 6 7-segment LED displays. The pins I leave you, I'm flexible;-)
It would be really great if such a function block to come sometime.
I will sometimes make the registry.
Thank you and many greetings
Steffen
 
Shift Register/7-Seg driver

Hi Steffen, took some time with your request for a 7-segment driver. The Function Block i made a bit more general purpose - it will accept 8 bit values for shifting out to the 74LS595. I also added a Function Block to look up the 7-segment patterns. For the driver FB you can select the port pins to be used for SER, SCK and RCK it is possible to use the same line for SER and RCK on more than one 595. (tested it on 2 chips as indicated in the screenshot). Will do the documentation and setup file and have it ready in a few days.
Regards
 

Attachments

  • PattnShift.jpg
    PattnShift.jpg
    27.2 KB · Views: 623
Hi Steffen
Attached is the installation file (and a ReadMeFirst file) for VPS_P18 Ver 2.02.
Manage to include the block (FB24) for driving your 74LS595 and another one (FB107) for selecting 7-segment patterns. To us right click, then select 'Add Function Block >Pheripherals>SERIAL_OUT.....FB24, and for FB107 select ...Multiplex>Sel 1 of 11 Patterns'.
I have tested the driver with two 74LS595s and it seems ok. Execution of a FB24 takes 10.5uSec. In the documentation for these two blocks, which i will post in a day, is mentioned how to use one port (8 bits) to drive 6 of the 595s.
Regards, Lourens
 

Attachments

  • ReadMeFirst.txt
    3.3 KB · Views: 385
  • VPS_P18setup2_02.exe
    2.9 MB · Views: 198
Hi Lourens,
the function block has worked very well in the first test. Very good work :)
I have 7-Seg LEDs tested with common anode and common cathode. This really is an important extension of this great program!
Regards, Steffen
 
Hi Steffen
glad you like the new addition, remember you suggested it :). This is one of the reasons VPS is available as a free application because i think this way it will enable more people to easily use microproccessors and then make suggestions of additional functions to improve it. Of course the next addition will be a serial input to read 8 inputs using the 74LS166. About the documentation - i will need a few more days because i want to include a basic circuit diagram for using multiple 74LS595s and a screen shot of a few function blocks to output a 16Bit value .
Regards, Lourens
 
Hi Steffen
Here is the description for the 2 new function blocks in vps_p18 ver 2.02
Lourens
 

Attachments

  • FBlock107_Description.pdf
    148.9 KB · Views: 306
  • FBlock24_Description.pdf
    250.1 KB · Views: 433
Hi Lourens,
the 7-segment display with 74595 works very well :) Thanks again, that was very important.
At the moment I have 2 problems.
1. how can save a value (example from a counter) in the EEPROM and read out again after a reboot?
2. I would like to use the DS3231 RTC (highly accurate with integrated TCXO and DS1307 code compatible)

Best regards and thanks for the support so far
Steffen
 
Hi Steffen
About interfacing the DS3231: Have a look at C:\LLG_CB\DOCUMENTATION\APPLICATION_NOTES\AN1202A. It shows how to interface to Microchips RTC, which is very similar to the DS3231 Take note the slave address of DS3231 is 104 (1101000) as per its datasheet. Also the Maxim datasheet (Fig3, 4, 5 Page 16, 17) refer to WORD ADDRESS while AN1202A refer to WR_ADDR (Fig1) and RD_ADDR (Fig3).
About writing to Data EEPROM. Currently there are only EE Read blocks of which you can change the value while on-line. Writing to EE in program code could exceed write-cycle limits but if you give me a good reason and explain when you want to write your data i can include it.
 
Hi Lourens,

with the DS3231 RTC I'll try soon.
It would be good if different values​​, such as values​​, which I set via push button or could store the values ​​of an Operation hour counter.
It must not be an excessive amount of, and has no particularly high priority.

Regards, Steffen
 
Status
Not open for further replies.

Latest threads

Back
Top