scottmurphy
Member
- Join Date
- Oct 2004
- Posts
- 363
How is a one shot done in ST. Does it have to be coded, or is there a command for this function?
PROGRAM PLC_PRG
VAR
MyOneShot: R_TRIG;
MyOnSignal: BOOL;
i: INT;
END_VAR
MyOneShot(CLK:= MyOnSignal);
IF MyOneShot.Q THEN
i := i + 1;
END_IF;
ndzied1 said:I would say the [OSR] is technically a function block because you can't use the address anywhere else in the program (of course it lets you but it will usually messing something else up).
LadderLogic said:Well, the same is true about any boolean instruction, isn't it?
Input_1 STEP_1
-----] [---------------------( )----
STEP_1 Input_2 STEP_2
-----] [----------] [----------( )-----
Input_1 OS_1 STEP_1
-----] [-------[OSR]--------------( )----
OS_1 Input_2 STEP_2
-----] [----------] [----------( )-----
ndzied1 said:The thing I really dislike about IEC 61131 is that comments are delimited by 2 characters (* and *) and that you can't have end of line commments like C++. That stinks!!
Peter Nachtwey said:Believe it or not, there was programming before R_TRIG and one shots.
[size=1][color=#008000][/color][/size][size=3][color=#008000](*Move the initial size for calculations*)
[/color][/size][size=3][color=#0000ff]if[/color][/size][size=3] [/size][size=3]EN [/size][size=3][color=#0000ff]and[/color][/size][size=3][color=#0000ff]not[/color][/size][size=3] lastip[/size][size=3] [/size][size=3][color=#0000ff]then
[/color][/size][size=3]lastip:=EN;
[/size][size=3]reelsize:=initsize;
[/size][size=3][color=#0000ff]end_if[/color][/size][size=1][size=3];
[/size]
[size=2]