24.01.2015 Views

PLC Programming

  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPENDIX<br />

10 APPENDIX<br />

Appendix A: IEC Operators and additional norm extending<br />

functions<br />

CoDeSys supports all IEC operators. In contrast with the standard functions functions (see appendix<br />

D, Standard library), these operators are recognized implicitly throughout the project. Besides the IEC<br />

operators CoDeSys also supports the following operators which are not prescribed by the<br />

standard: INDEXOF and SIZEOF (see Arithmetic Operators), ADR and BITADR (see Adress<br />

Operators).<br />

Operators are used like functions in POU.<br />

Attention: At operations with floating point variables the result depends on the currently used target system !<br />

> Arithmetic operators<br />

> Bitstring Operators<br />

> Bit-Shift Operators<br />

> Selection Operators<br />

> Comparison Operators<br />

> Address Operators<br />

> Calling Operators<br />

> Type Conversions<br />

> Numeric Operators<br />

10.1 Arithmetic Operators...<br />

ADD<br />

Addition of variables of the types: BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,<br />

REAL and LREAL.<br />

Two TIME variables can also be added together resulting in another time<br />

(e.g., t#45s + t#50s = t#1m35s)<br />

Example in IL:<br />

LD 7<br />

ADD 2,4,7<br />

ST Var 1<br />

Example in ST:<br />

var1 := 7+2+4+7;<br />

Example in FBD:<br />

CoDeSys V2.3 10-1

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

Saved successfully!

Ooh no, something went wrong!