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.

Languages...<br />

Contact<br />

Each network in LD consists on the left side of a network of contacts (contacts are represented by two<br />

parallel lines: | |) which from left to right show the condition "On" or "Off".<br />

These conditions correspond to the Boolean values TRUE and FALSE. A Boolean variable belongs to<br />

each contact. If this variable is TRUE, then the condition is passed on by the connecting line from left<br />

to right, otherwise the right connection receives the value "Out".<br />

Contacts can be connected in parallel, then one of the parallel branches must transmit the value "On"<br />

so that the parallel branch transmits the value "On"; or the contacts are connected in series, then<br />

contacts must transmit the condition "On" so that the last contact transmits the "On" condition. This<br />

therefore corresponds to an electric parallel or series circuit.<br />

A contact can also be negated, recognizable by the slash in the contact symbol: |/|. Then the value of<br />

the line is transmitted if the variable is FALSE.<br />

Coil<br />

On the right side of a network in LD there can be any number of so-called coils which are represented<br />

by parentheses:( ). They can only be in parallel. A coil transmits the value of the connections from left<br />

to right and copies it in an appropriate Boolean variable. At the entry line the value ON (corresponds<br />

to the Boolean variable TRUE) or the value OFF (corresponding to FALSE) can be present.<br />

Contacts and coils can also be negated (in the example the contact SWITCH1 and the coil %QX3.0 is<br />

negated). If a coil is negated (recognizable by the slash in the coil symbol: (/)), then it copies the<br />

negated value in the appropriate Boolean variable. If a contact is negated, then it connects through<br />

only if the appropriate Boolean value is FALSE.<br />

Function blocks in the Ladder Diagram<br />

Set/Reset coils<br />

LD as FBD<br />

Along with contacts and coils you can also enter function blocks and programs In the network they<br />

must have an input and an output with Boolean values and can be used at the same places as<br />

contacts, that is on the left side of the LD network<br />

Coils can also be defined as set or reset coils. One can recognize a set coil by the "S" in the coil<br />

symbol: (S)) It never writes over the value TRUE in the appropriate Boolean variable. That is, if the<br />

variable was once set at TRUE, then it remains so.<br />

One can recognize a reset coil by the "R" in the coil symbol: (R)) It never writes over the value FALSE<br />

in the appropriate Boolean variable: If the variable has been once set on FALSE, then it remains so.<br />

When working with LD it is very possible that you will want to use the result of the contact switch for<br />

controlling other POUs. On the one hand you can use the coils to put the result in a global variable<br />

which can then be used in another place. You can, however, also insert the possible call directly into<br />

your LD network. For this you introduce a POU with EN input.<br />

Such POUs are completely normal operands, functions, programs, or function blocks which have an<br />

additional input which is labeled with EN. The EN input is always of the BOOL type and its meaning is:<br />

The POU with EN input is evaluated when EN has the value TRUE.<br />

An EN POU is wired parallel to the coils, whereby the EN input is connected to the connecting line<br />

between the contacts and the coils. If the ON information is transmitted through this line, this POU will<br />

be evaluated completely normally.<br />

Starting from such an EN POU, you can create networks similar to FBD.<br />

2-22 CoDeSys V2.3

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

Saved successfully!

Ooh no, something went wrong!