IEC 61131 Structured Text syntax

Paulus

Member
Join Date
May 2004
Location
Portsmouth
Posts
416
Hello All,
Suppose I have a function block (named FB_MyTimer)that contains a VAR_IN_OUT (named My_Pulse).
I wish to nest this function block inside a structured text function block.
Does anyone know the correct ST syntax (according to IEC 6-1131) for addressing the VAR_IN_OUT?

E.g. If it were an Input variable, the text might look something like this...
FB_MyTimer(EN := TRUE, My_Pulse := My_Var) ;

If it were an Output variable, the text might look something like this...
FB_MyTimer(EN := TRUE, My_Pulse => My_Var) ;

I have read somewhere that the syntax may be a combination of the two, i.e. FB_MyTimer(EN := TRUE, My_Pulse :==> My_Var) ;
but I'm not sure. Any ideas anyone?

Please note, this is a PLC independant project that I'm working on, so it really is only the correct syntax that is important.

Thanks in advance for any suggestions.
 
Two ways to go:
Informal - Parameter order does matter (no ENO here)
- abs_int(myInput, myOutput)
Formal - Parameter order does not matter
- Provides ENO to indicate function call success
- abs_int(in := myInput, Q => myOutput, ENO => mySuccess)

Timer:
st_timer(IN := ST_Timer_Enable, PT := 1000, Q => ST_Timer_Done, ET => ST_Timer_ET);
 
Last edited:
Thanks for that RussB,
The informal method is useful to know.

However, this is OK if the variables in the nested FB are type 'input' or 'output'. What I'm having trouble with is if the variable within the nested FB is the type IN_OUT (where the input parameter is passed to the VAR_IN_OUT, is then manipulated within the nested FB, and the result is passed back out to the same input parameter. :confused:
 

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,981
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,620
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,752
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,675
Back
Top Bottom