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.

Diagramatic programming for PIC18 controllers

Status
Not open for further replies.

Lourens

Member
For those who like to use (or experiment with) function blocks and control theory for programming PIC18F's VPS_P18 version 2.07 is now available for downloading. VPS is a fully graphical IDE (produce HEX file) where the diagram you create is the program, and also serve as the GUI that allow you to view and manipulate variables while your program is executing, either in simulation mode or when connected to your controller via serial port. I have included here an index file which list some basic detail of the FB's available in this version. The first link is for the install (self-extracting exe) and read-me-first files, the second for the FB documentation which is 4 zip files plus the file included here.

https://www.dropbox.com/sh/21nm3dlo3v4rps6/P6qh9PHxFY

https://www.dropbox.com/sh/ap06ytps846aiw8/TvMiRee0Sy
 

Attachments

  • FUNCTION_BLOCK_INDEX.pdf
    400.1 KB · Views: 493
Hi 3v0, are you using VPS? Had a few feedbacks but none telling me what they do with it.
Not sure i understand what you mean by not using dropbox root. I have arranged the files in (what i think appropriate) directories. The link(s) is then generated by dropbox. Maybe an example from you of how to do it?
 
I have not had time to look at it. Generally I write uC code in c but I have an interest in languages and am curious to see what you are doing.

Currently you documentation and Ver 2.07 directories are at

.../Dropbox/documentation
.../Dropbox/Ver 2.07

I am suggesting you place them

.../Dropbox/VPS/documentation
.../Dropbox/VPS/Ver 2.07

Capture.PNG
 
I think it would be a good idea to put screenshots somewhere on the web for the people to look at along with some explanation, so that people could look at something before they commit to installing unknown software on their computer.
 
3v0 - thanks for the example, will change it when time available. I do mostly controlling things, speed, temperature ... and some logic that goes with it. My latest is an auto tuning relay - helps you to determine controlled system parameters so you can work out PID settings. Sounds complicated but in reality fairly simple when using function blocks.
NorthG - Pitty we got to be careful but ... thats life. To give you an idea of VPS i have uploaded an application note showing how function blocks are used to interface to Microchip's MCP7940M RTCC using I2C. (If you are brave enough to install VPS) this AN together with other relevant documents and example projects you can find in C:\LLG_CB\DOCUMENTATION\....
 

Attachments

  • AN1202A.pdf
    357.4 KB · Views: 317
Interesting concept. Reminds me of PLCs. I don't know how this would work for the people without programming experience. I guess some people could find it easier, but I'm more of a text person - I prefer to write few lines of text rather than dragging boxes over the screen.

Is this a commercial project?
 
NorthG - The concept is not new, most suppliers of controllers used in the idustrial world use it in some way or another, and you are right about PLC's. Ladder is also a form of (graphical) function block programming. The uploaded pdf shows an application for a coin-operated machine. The screenshot was taken with the VPS simulator active. You can see the real time values (100mSec update) of the counter block in/outs displayed, obtained by placing the cursor over the block - something that might be nice to have when debugging text based apps. As a MOF i started off with such tool (VB6) and function blocks before i decided to get familiar with .NET and use graphics.
By agreement with Microchip i can distribute some of their tools and libraries with VPS, while my side of the bargain is i will not charge for the package.
I'm busy with a sample app showing how to make a maximum thermometer, which i am sure people without any idea of programming will understand.
 

Attachments

  • Coin_Machine.pdf
    121.6 KB · Views: 219
Very interesting. I'm thinking about creating a programming tool for PICs myself. I think that the way it's done now is taken with almost no modifications from "big" computers and not tailored well to MCUs. Your graphical approach suits MCUs better, although I think there could be manageability problems when you go to thousands of boxes. I will definitely stay with text, but I do have my own ideas on how to make the development more MCU-tailored.

I wonder why would you need to use Microchip tools? And if you do, why do you need to distribute them? Looks like Microchip distribute their tools with MPLAB for free so anyone can download them any time.
 
NorthH - Come on tell us more about your idea!
Some of my applications are just more than 200 blocks organized in function groups, making it easy to manage. Also the user puts his blocks on code pages of which you can have as many as you like. Code pages in turn you assign to cyclic or time tasks. My experience is you run out of I/O before you run out of memory space. The problem i have is how to cater for more PIC types.

The need for a particular Microchip tool is 2-fold. First you do not need to have MPLAB installed. Second when a tool's version change its interface very likely also change. By using a particular tool (assembler) version VPS becomes immune to such changes.
 
Very interesting. I'm thinking about creating a programming tool for PICs myself. I think that the way it's done now is taken with almost no modifications from "big" computers and not tailored well to MCUs. Your graphical approach suits MCUs better, although I think there could be manageability problems when you go to thousands of boxes. I will definitely stay with text, but I do have my own ideas on how to make the development more MCU-tailored.

I also usually have a problem with VPL type graphical programming tools at the mental pattern matching level when the complexity level increases. I have my own internal mental (more analog than digital) graphical methods of understanding computer programming and logic that's much more nuanced and interconnected by my past experiences that allows moving through bits and very low levels of abstraction up to objects and high abstractions quickly. Most of the tricky parts in general programming are not easily shown visually because they evolve time-based state changes with a large number of combinations that need robust and provable solutions (program bugs are water and will flow into any crack) that are easier to express in text because most were designed that way long ago. Experienced programmers IHMO don't see programming as text or diagrams, most see new code as a block of granite that's transformed into a work of art by a series of smaller and more detailed hits to create the structure your mind sees hidden inside. Sure, you need tools to generalize software interfaces and modules like how an artist rough blocks out the statues hands, arms and shoulder to the torso. Most of these types of tools are for great for beginners and non-programmers (people without any idea of programming) to get started as a ideograms convey information quickly, not completely but I don't think they are useful for advancing a persons programming expertise.
 
Last edited:
nsaspook - I have found that when the complexity increases in my VPL applications then 2 things are vital - make the drawing uncluttered and add comments at strategic points. I like your granite block approach... Graphical programming rely to a large extend on the amazing cognative abilities of our minds; hence that picture and thousand word story. I will be the first to admit that VPL's are not the answer for those 'real' programmers but it sure bring the power of computing to those who require the functionality but lack the programming skills to tame these amazing machines. The attached document was produced with those non-programmers in mind.
 

Attachments

  • VPS_P18_Graphical_Programming_for_PICs.pdf
    163.8 KB · Views: 265
3v0 - This document will show you how to make a very simple application with VPS. For the brave who installed VPS there is no need to download it because it, together with other .pdf's like ...Debug_Tools and ....Simulator you can find in C:\LLG_CB\DOCUMENTATION\GENERAL\..
 

Attachments

  • VPS_P18_Getting_Started.pdf
    494.7 KB · Views: 531
3v0 - I consider a VPS 'source' as the graphical representation of the control logic, with the 'language' elements being function blocks. With this definition debugging will also be graphical based. The main debugging tool in VPS is the display of live (100mSec) values when placing the cursor over a function block (with simulator or PIC running). This coupled with the ability to change the values of variables when on-line is similar to in circuit debugging. Another tool is an oscilloscope type display with 4 traces. The update time you can select in multiples of 100mSec. I was thinking of adding a breakpoint/single step facility to the simulator but this is way down on my priority list.
In reality a VPS project source file (xxxxx.lcb) is a script file.
My complete knowledge of Netbeans is: was told MPLAB-X use it. How do you envisage it can be used with VPS?
 
How does it actually work? Does it advance one step at every clock tick as a network of flip-flops would?
 
NorthG - i assume you ask how VPS actually work. It is very simple. As far as the PIC is conserned a task manager (cooperative) executes 8 tasks (refered to as cycle tasks) in round robin fasion and 7 tasks (time tasks) at intervals (10, 20, 40, 50, 100, 200mSec). The FB elements on a code page each represent a piece of code (assembler macro). The execution sequence of these FB's you can see by the number in the right hand bottom corner of the block. So FB's are executed one after the other (no clocking). A task-block (left hand corner of a code page) on each code page is where you select which of the tasks must execute the FB's on the particular page code.
The simulator is a bit different in that each FB is a piece of VB code (i.e. a method of the FB class). The task manager is based on the same consept as the cycle and time tasks mentioned above. So again for each code page it will just activate the 'code-method' for all FB's on the page in the order of their execution sequence number. (again no clocking here). So the simulator does not execute PIC instructions but VPS type function blocks.
Its a bit difficult to tell you more in a short message but i hope this will give you an idea of the workings.
 
Do you set the execution sequence of the blocks or does the program defines the sequence?

Say, if block A is an input to block B, can you set the execution sequence to that B executes first (and consequently fetches an older value from A)?
 
NorthG - You can change the execution sequence. When you enter a block the program will assign it the next available execution number, but you can change that. If you insert a new block C into the signal line between two existing ones A and B; and there were 10 blocks on the page then C will be assigned execution nr. 11, and this is probably not what you want. Simply change C's execution number to that of A's +1. The program will then automatically change the execution number of B and all the down-stream blocks. The execution sequence number of a block is indicated in its bottom right corner. Blocks without sequence numbers contain no executable code - like the inter-page connector block.

You can execute B before A to have the older value from A as input to B. IMHO this is not good practice as it obscures functionality. For this very reason a 'move' block is on my list for new blocks to include into VPS. The idea is to have a few (selectable nr. of) moves in the block so you have outputs for Z-1, Z-2, etc.

If you want an 'older value' of a signal you can travel backwards in time - have a look at FB177, Dead-Time Signal Delay.
 
Status
Not open for further replies.

Latest threads

Back
Top