IEC 61131 Beginner's Questions.

Join Date
Apr 2002
Location
Just a bit northeast of nowhere
Posts
1,117
So I've decided to at least sip the IEC 61131-3 Kool-Aid and dig into it a bit. It seems like a useful language, at least in the sense that so many people are using it now. And I reeeeeeeally want to use UDFBs. Badly.

I'm tooling around with Panasonic (sic Aromat sic Nais) FP-Sigma PLC, and fiddling with some code in FPWIN Pro. I haven't obtained the PLC to actually download and play around, so while I've gotten the thing to compile, I'm still thrashing around in the shallow end of the pool.

So I wanted to throw out a few basic beginner's questions to see if anybody might be able to explain. Somehow, all my reps are out of town the rest of the month...

1. How is this thing scanned? I'm used to motion control, which is line-by-line execution (with each line waiting to complete before the next is executed), and ladder, which is continuous scan. Since this software encompasses so many languages, is the scan line-by-line, continuous, or does it depend on which of the 5 protocols you are using? If I call an ST function block from my ladder, does the entire program freeze until the FB completes?

2. If I have a ladder net, and in that net is an FB using various IO variable, does the FB have to be connected to the power rail in some manner to be scanned? If not, will it simply be ignored and passed over, or will it set all it's internals to "0"?

I apologize for being so basic, but I couldn't find anything specific with searches regarding the ladder scan.

Thanks,

TM
 
1. How is this thing scanned? I'm used to motion control, which is line-by-line execution (with each line waiting to complete before the next is executed), and ladder, which is continuous scan. Since this software encompasses so many languages, is the scan line-by-line, continuous, or does it depend on which of the 5 protocols you are using? If I call an ST function block from my ladder, does the entire program freeze until the FB completes?

With the systems I have used, the scan is similar to traditional PLC's. So, yes, when you call the Function Block from a parent POU, the further execution of the parent would wait for the called function block to finish.

However,

The systems I have worked on allow you to configure multiple tasks to run in what I think is a multi-threaded type execution. Each task can generally have a priority and cycle rate and watchdog all independent from the other tasks.

2. If I have a ladder net, and in that net is an FB using various IO variable, does the FB have to be connected to the power rail in some manner to be scanned? If not, will it simply be ignored and passed over, or will it set all it's internals to "0"?

I think this one is going to be manufacturer specific. In CoDeSys there is something called "Box with Enable" that can be used for throwing function blocks into ladder. The Box's enable input generally gets connected to the power rail directly or through some enabling ladder.

A function block contains both code and data and will not have its internals set to "0" or some default value automatically. When it is not being scanned, the data is not changing but it is still there in its last state until changed by the code in the function block. When using ST there is a trap this can lead to because you can reference the IN and OUT data of a function block using a dot notation. For instance, if you have a timer called T1, you can set the preset of that timer to 5 seconds and turn the enable on by coding:
Code:
T1.PT:=T#5s;
T1.EN:=TRUE;
But The timer will not be running because the function block was never called, only the data within the function block was set. To call the TON timer block you would have to add:
Code:
T1();
Or you could do the preset with the call such as:
Code:
T1(PT:=T#5s);
You really have to understand the relationship between the code, the calling of the code and the internal data when dealing with function blocks. They are very powerful and therefore require a little steeper learning curve.
 

Similar Topics

Hello, I have a small programming task that I need help solving. I have to: * Create an analog input (4-20v)and a digital output * The analog...
Replies
45
Views
24,976
I was poking through the Stackoverflow PLC Tag when I saw this answer to a question about converting a Real to a DWord and back again. What...
Replies
8
Views
2,863
I am looking for some expert advice. I have always made function blocks both with inputs and outputs and without inputs or outputs. I make the...
Replies
21
Views
6,616
Hello and happy new year! I would like to further understand who needs to design by this standard and is it a requirement for everyone or only...
Replies
3
Views
1,751
So Ladder is easy to read graphically, most everything can be coded in ladder, and it represents wiring diagrams the closest. SCL and ST are good...
Replies
5
Views
1,672
Back
Top Bottom