24.01.2015 Views

PLC Programming

  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix D: CoDeSys Libraries<br />

Example in FBD:<br />

Example in ST:<br />

arINT1 := FIND ('SUXYSI','XY');<br />

Please Note: String functions are not "thread safe": When using tasks, string functions may only be used in a<br />

single task. If the same function is used in different tasks, there is a danger of overwriting.<br />

10.16.2 Bistable Function Blocks...<br />

SR<br />

Making Bistable Function Blocks Dominant:<br />

Q1 = SR (SET1, RESET) means:<br />

Q1 = (NOT RESET AND Q1) OR SET1<br />

The input variables SET1 and RESET as well as the output variable Q1 are type BOOL.<br />

Declaration example:<br />

SRInst : SR ;<br />

Example in IL:<br />

CAL<br />

LD<br />

ST<br />

SRInst(SET1 := VarBOOL1, RESET := VarBOOL2)<br />

SRInst.Q1<br />

VarBOOL3<br />

Example in FBD:<br />

Example in ST:<br />

SRInst(SET1:= VarBOOL1 , RESET:=VarBOOL2 );<br />

VarBOOL3 := SRInst.Q1 ;<br />

RS<br />

Resetting Bistable Function Blocks<br />

Q1 = RS (SET, RESET1) means:<br />

Q1 = NOT RESET1 AND (Q1 OR SET)<br />

The input variables SET and RESET1 as well as the output variable Q1 are type BOOL.<br />

Declaration example:<br />

RSInst : RS ;<br />

Example in IL:<br />

CAL<br />

LD<br />

RSInst(SET := VarBOOL1, RESET1 := VarBOOL2)<br />

RSInst.Q1<br />

CoDeSys V2.3 10-43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!