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 B: Operands in CoDeSys<br />

%QB7 Output byte 7<br />

%MD48<br />

%IW2.5.7.1<br />

Double word in memory position 48 in the memory location.<br />

depending on the <strong>PLC</strong> Configuration<br />

The current <strong>PLC</strong> Configuration for the program determines whether or not an address is valid.<br />

Note:<br />

Boolean values will be allocated bytewise, if no explicit single-bit address is specified. Example: A<br />

change in the value of varbool1 AT %QW0 affects the range from QX0.0 to QX0.7.<br />

Memory location<br />

You can use any supported size to access the memory location.<br />

For example, the address %MD48 would address bytes numbers 192, 193, 194, and 195 in the<br />

memory location area (48 * 4 = 192). The number of the first byte is 0.<br />

You can access words, bytes and even bits in the same way: the address %MX5.0 allows you to<br />

access the first bit in the fifth word (Bits are generally saved wordwise).<br />

10.13 Functions<br />

In ST a function call can also appear as an operand.<br />

Example:<br />

Result := Fct(7) + 3;<br />

TIME()-Function<br />

This function returns the time (based on milliseconds) which has been passed since the system was<br />

started.<br />

The data type is TIME.<br />

Example in IL:<br />

TIME<br />

ST systime (* Result e.g.: T#35m11s342ms *)<br />

Example in ST:<br />

systime:=TIME();<br />

Example in FUP:<br />

CoDeSys V2.3 10-29

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

Saved successfully!

Ooh no, something went wrong!