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.

Arithmetic Operators...<br />

MUL<br />

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

UDINT, REAL and LREAL.<br />

Example in IL:<br />

LD 7<br />

MUL 2,4,7<br />

ST Var 1<br />

Example in ST:<br />

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

Example in FBD:<br />

SUB<br />

Subtraction of one variable from another of the types: BYTE, WORD, DWORD, SINT, USINT, INT,<br />

UINT, DINT, UDINT, REAL and LREAL.<br />

A TIME variable may also be subtracted from another TIME variable resulting in third TIME type<br />

variable. Note that negative TIME values are undefined.<br />

Example in IL:<br />

LD 7<br />

SUB 8<br />

ST Var 1<br />

Example in ST:<br />

var1 := 7-2;<br />

Example in FBD:<br />

DIV<br />

Division of one variable by another of the types: BYTE, WORD, DWORD, SINT, USINT, INT, UINT,<br />

DINT, UDINT, REAL and LREAL.<br />

Example in IL:<br />

LD 8<br />

DIV 2<br />

ST Var 1 (* Result is 4 *)<br />

Example in ST:<br />

var1 := 8/2;<br />

Example in FBD:<br />

10-2 CoDeSys V2.3

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

Saved successfully!

Ooh no, something went wrong!