CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

How to call action in ST with action qualifiers?
https://forum.codesys.com/viewtopic.php?f=2&t=9378
Page 1 of 1

Author:  Serhioromano [ Mon Dec 10, 2018 12:05 pm ]
Post subject:  How to call action in ST with action qualifiers?

In SFC I can call action with qualifiers like P0, R, S, N, LD, ... It means that there is a way to apply qualifier to action, but in ST if I can action like

Code:
myAction(S);


I get error during compilation.

How can I call an action with qualifiers in ST?

Author:  scott_cunningham [ Thu Jan 24, 2019 10:29 pm ]
Post subject:  Re: How to call action in ST with action qualifiers?

ST doesn't work that way. The IEC qualifiers are really replacement for ST code to make SFC easier to manage (LD has some similar items).

For example, and IEC action (action code or boolean var) without a qualifier looks like this in ST:

Code:
MyAction();

or

Code:
Done := TRUE;


If you use the set qualifier (S), it would be something like this:

Code:
IF DoOnce= TRUE THEN
   MyAction();
   DoOnce := FALSE;
END_IF


or

Code:
IF DoOnce = TRUE THEN
   Done := TRUE;
   DoOnce := FALSE;
END_IF

Author:  Serhioromano [ Fri Feb 01, 2019 4:14 pm ]
Post subject:  Re: How to call action in ST with action qualifiers?

What if I have impulse and I have a trigger. On raise I want to start action and perform it before other signal.

Code:
VAR
    xSignal1: BOOL;
    xSignal2: BOOL;
    xWork: BOOL;
    fbRT1: R_TRIG;
    fbRT2: R_TRIG;
END_VAR

fbRT1(CLK := xSignal1);
fbRT2(CLK := xSignal2);

IF fbRT1.Q THEN
    xWork := TRUE;
END_IF;

IF fbRT2.Q THEN
    xWork := FALSE;
END_IF;

IF xWork THEN
    actMyAction();
END_IF;


This simple task and code is huge. I hoped to shorten it few lines.

Code:
VAR
    xSignal1: BOOL;
    xSignal2: BOOL;
    xSignal1M: BOOL;
    xSignal2M: BOOL;
END_VAR

IF fxSignal1 AND NOT xSignal1M THEN
    actMyAction(S);
END_IF;
xSignal1M := xSignal1;

IF xSignal2 AND NOT xSignal2M THEN
    actMyAction(R);
END_IF;
xSignal2M := xSignal2;


That would really make some things simpler.

Author:  e.kislov [ Sun Feb 03, 2019 11:33 am ]
Post subject:  Re: How to call action in ST with action qualifiers?

Check this:
https://help.codesys.com/webapp/_cds_ex ... n=3.5.14.0
https://help.codesys.com/webapp/_cds_ex ... n=3.5.14.0

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/