Basic PLC Instructions
Ladder diagram language is a symbolic set of instructions that are used to develop controller programs. Symbolic representations of contacts and coils are the basic symbols of any ladder logic instruction set.
There are three main methods used to translate relay control logic to contact symbolic logic:
- Examine If Closed (XIC) also known as normally open
- Examine If Open (XIO) also known as normally closed
- Output Energize (OTE)
XIC Instruction
The symbol for the Examine If Closed (XIC) instruction is:
——–] [——–
The XIC instruction looks and operates like a normally open relay contact. There is a memory bit associated with each XIC instruction that is linked to the status of an input device or internal condition.
This XIC instruction “asks” the processor of the PLC to examine if the contact is closed, which is the same as saying that power is now able to flow through this normally open contact.
Think about it like this: if the contact looks as it does above (normally open), no power can flow through this open contact; however, if the contact changes state and is now closed, power can flow through. This would tell the PLC to XIC or examine if closed and follow the flow to the next contact or output.
The processor does this by examining the bit at the memory location which is specified by the address:
Depending on the status of the input device or internal address, the memory bit is set to 1 or 0. A 1 is a true status or condition and a 0 is a false status or condition.
When the Examine-on instruction is associated with a physical input device, the instruction is set to 1 when that input is present and 0 when it is not present.
When the Examine-on instruction is associated with an internal address, the status of the bit depends on the logical status of the internal bit.
XIO Instruction
The symbol for the Examine If Open (XIO) instruction is:
——–] / [——–
The XIO instruction looks and operates like a normally closed relay contact. There is a memory bit associated with each XIO instruction that is linked to the status of an input device or internal condition. This XIO instruction “asks” the processor of the PLC to examine if the contact is open.
XIO or normally closed works exactly opposite of what you learned about normally open or XIC. If the contact is closed, power would flow through to the next contact or output. If it changes state and becomes open, the power will no longer flow through.
The processor does this by examining the bit at the memory location which is specified by the address:
Depending on the status of the input device or internal address, the memory bit is set to 1 or 0. A 1 is a true status or condition and a 0 is a false status or condition.
When the Examine-off instruction is used to examine a physical input, the instruction is interpreted as false if there is a voltage (physical input) present (the bit is 1). It will be interpreted as true when there is no voltage (the bit is 0).
When the Examine-off instruction is associated with an internal relay, the status of the bit depends on the logical status of the internal bit with that same address (the same address as the instruction).
The memory bit always follows the status of the input address or internal address that is assigned to it. True = 1 and False = 0.
The way that bit is interpreted is determined by which type of instruction is used to examine it.
XIO instructions always interpret a 1 as true and a 0 as false while XIC instructions interpret a 1 as false and a 0 as true.
Output Energize (OTE) Instruction
This is the symbol for the Output Energize (OTE) instruction:
———( )———
The OTE instruction is slightly different from the others in that it looks and operates like a relay coil and is associated with a memory bit. This type of instruction signals the PLC to turn on or turn off the output.
The processor makes the instruction true when there is a logical path of true XIC and XIO instructions in the rung.
The operation of OTE instruction is as follows:
• The status bit of the addressed OTC instruction is set to 1 in order to turn on the output. It is set to 0 in order to turn off the output.
• If a true logic path is established, the OTE instruction is turned on and the output device is turned on.
• If a true logic path cannot be established, the OTC instruction is not turned on and the output device is not turned on.
Read: All PLC Instructions
Timers
After the coils and contacts, the timer is the most commonly used PLC instruction. Most industrial control systems need at least one timed function. Mechanical timing relays are used to delay the opening and closing of contacts for circuit control.
The operation of a mechanical timing relay is very similarly to the operation of a normal control relay, except that some of the timing relay’s contacts are designed to operate at a preset time interval.
A mechanical timer could be simply the timer you have seen that sits on a desk. You turn it to 15 or 20 minutes and walk away. When the time has expired it will ding. These types of timers are also used on clothes dryers.
One big advantage of timing relay devices is that they allow multiple operations to be automatically started and stopped at different time intervals. Generally electronic timers are triggered by some sort of input. In PLC logic it may be that a part hits a limit switch.
The limit switch sends a signal to the PLC to start the timer. The part is now sprayed with paint for a set time of 5 seconds. After the part is sprayed, the timer resets itself. The part moves out of the way and the next part enters and strikes the limit switch. The next part is then sprayed for five seconds. This process continues in repetition.
Counters
Programmable Logic Controllers (PLCs) can contain both up and down counters. Counters are similar to timers except that they do not operation on an internal clock but are dependent on external or program sources for counting.
Some of the most common uses for counters are :
• straight counting in a process
• two counters used to give the sum of two counts
• two counters used to give the difference between two counts
There are two main types of counters: mechanical and electrical.
Mechanical counters are very simple – every time the actuating lever is moved over, the counter adds one number and the level returns to its original position. You can reset the counter to zero using a pushbutton located on the unit.
Think back to when you have gone to a theme park. At these parks, you probably walked through a mechanical counter. Do you remember the triangle looking bar that spins when you walked through it? This is a mechanical counter used to count how many people have entered the park each day. This application could be useful in determining the safe amount of people that should be in the park at one time or for a yearly total of visitors.
Electronic counters offer more functionality. They can be used to count up, count down or can be combined to count up and down. Most industries require up counting but there are some operations that require down counting or a combination of up and down counting so it is beneficial to have these options.
Let’s think about bottling soda. How many sodas are in a six-pack? That’s easy. Six! How does the machine know when it has six sodas ready to be placed in a six-pack? That’s easy as well. Electronic Counters! These counters count the number of sodas ready to be inserted in the six-pack. Once six is reached and the sodas are inserted, the counter then resets and starts over. Six sodas are counted for the next six-pack, and then inserted.
Internal Instructions
Many PLCs have a portion of memory allocated to internal storage bits. These storage bits may also be called internal outputs, internal coils, internal control relays or internal bits. Internal bits are simply on/off signals that are generated by programmed logic.
Internal outputs DO NOT directly control an output field device – they are used strictly for internal purposes. These functions are widely used in programming PLCs.
Some applications may include an emergency shutdown or power failure.
There are many advantages to using internal bits, some of which are:
• There are many situations where output instruction is required but no physical connection to a field device is needed
• If there are no physical outputs, the address can be used as a storage point
• Can be programmed to perform relay functions without occupying a physical output, therefore minimizing output module point requirements
• An internal control relay can be used when a program requires more series contacts than the rung allows. If you are looking at a PLC program on a laptop, it may be difficult to fit all that you see on one page without needing to scroll. This can make troubleshooting difficult. For this reason some programmers may use an internal bit to move to the next rung so that all the information can be seen without any scrolling. This can make the troubleshooting process easier, therefore reducing downtime.
• Other uses for internal relays may include resetting latched circuits, one-shot operations, battery back-up circuits, set and reset, and master control relays.
Very interested