PLC Instructions
In this article, you will learn the types of PLC instructions such as input, output, timer, counter, data manipulation, and program control instructions.
Programmable logic controllers (PLC) are used to automate a wide range of processes and systems in many different industries. PLCs contain a central processing unit (CPU) that reads input from sensors, performs logic operations based on a program stored in memory, and sends output to actuators to control processes or equipment.
Types of Instructions in PLC
There are many different types of instructions that can be used in a PLC program, including:
- Input instructions: These instructions read the status of input devices, such as sensors or switches, and store the data in memory.
- Output instructions: These instructions control output devices, such as motors or valves, based on the data stored in memory.
- Timer instructions: These instructions allow the PLC to perform a specific action after a certain time period has elapsed.
- Counter instructions: These instructions allow the PLC to perform a specific action after a certain number of events have occurred.
- Data manipulation instructions: These instructions allow the PLC to perform arithmetic operations, compare data values, or move data from one location in memory to another.
- Program control instructions: These instructions allow the PLC to branch to a different part of the program, skip over certain instructions, or repeat a section of the program.
- Communication instructions: These instructions allow the PLC to communicate with other devices, such as computers or other PLCs, over a network.
PLC Input Instructions
The input instructions typically used in a PLC program include:
- On/off input instructions: These instructions read the status of a single input point and store it in a memory bit as either a 1 (on) or 0 (off).
- Pulse input instructions: These instructions count the number of pulses received at an input point over a certain time period.
- Analog input instructions: These instructions read the value of an analog input, such as a temperature or pressure sensor, and convert it to a digital value that can be stored in memory.
- Encoder input instructions: These instructions read the position of a rotary encoder and convert it to a digital value that can be stored in memory.
- Data input instructions: These instructions allow the PLC to read data from an external device, such as a barcode reader or RFID reader, and store it in memory.
Input instructions are typically used at the beginning of a PLC program to read the status of input devices and store the data in memory for use in subsequent logic operations.
PLC Output Instructions
The output instructions typically used in a PLC program include:
- On/off output instructions: These instructions control a single output point and set it to either an on or off state based on the value of a memory bit.
- Pulse output instructions: These instructions generate a certain number of pulses at an output point over a certain time period.
- Analog output instructions: These instructions convert a digital value stored in memory to an analog signal that can be used to control an analog output device, such as a motor or valve.
- Encoder output instructions: These instructions convert a digital value stored in memory to an encoded signal that can be used to control a rotary encoder or another device.
- Data output instructions: These instructions allow the PLC to send data to an external device, such as a display or printer, based on the data stored in memory.
Output instructions are typically used at the end of a PLC program to control output devices based on the results of the logic operations performed by the program.
PLC Timer Instructions
Timer instructions typically include:
- On-delay timer instructions: These instructions start a timer when a specified input condition is met, and set a memory bit to 1 when the timer reaches a certain value.
- Off-delay timer instructions: These instructions start a timer when a specified input condition is met, and set a memory bit to 0 when the timer reaches a certain value.
- Retentive timer instructions: These instructions start a timer when a specified input condition is met, and store the elapsed time in a memory location when the timer is stopped.
- Pulse timer instructions: These instructions generate a pulse of a certain duration at a specified output point after a specified input condition is met.
Timer instructions are often used to introduce delays into a PLC program or to control the duration of an output signal.
PLC Counter Instructions
Counter instructions typically include:
- Up counter instructions: These instructions increment a counter value stored in memory each time a specified input condition is met.
- Down counter instructions: These instructions decrement a counter value stored in memory each time a specified input condition is met.
- Up/down counter instructions: These instructions can either increment or decrement a counter value stored in memory, depending on the specified input condition.
Counter instructions are often used to keep track of the number of events or cycles that have occurred in a process, or to control the frequency of an output signal.
PLC Data Manipulation Instructions
Data manipulation instructions typically include:
- Arithmetic instructions: These instructions allow the PLC to perform basic arithmetic operations, such as addition, subtraction, multiplication, and division, on data stored in memory.
- Data move instructions: These instructions allow the PLC to move data from one memory location to another, or to transfer data between the PLC’s memory and an external device.
- Data compare instructions: These instructions allow the PLC to compare the values of two memory locations and set a memory bit to 1 if the values are equal, or 0 if they are not.
- Data search instructions: These instructions allow the PLC to search through a series of memory locations and set a memory bit to 1 if a specific value is found, or 0 if it is not.
Data manipulation instructions are often used to manipulate data stored in the PLC’s memory or to perform calculations based on input data.
PLC Program Control Instructions
Program control instructions typically include:
- Jump instructions: These instructions allow the PLC to jump to a different part of the program based on the value of a memory bit or the result of a comparison.
- Call instructions: These instructions allow the PLC to execute a subroutine or block of instructions that is stored at a different location in the program.
- Return instructions: These instructions allow the PLC to return to the main program after executing a subroutine.
- Repeat instructions: These instructions allow the PLC to repeat a block of instructions a certain number of times, or until a certain condition is met.
Program control instructions are often used to create conditional statements or loops in a PLC program.
PLC Communication Instructions
Communication instructions typically include:
- Network instructions: These instructions allow the PLC to send and receive data over a network, such as Ethernet or Modbus.
- Serial instructions: These instructions allow the PLC to send and receive data over a serial communication link, such as RS232 or RS485.
- File instructions: These instructions allow the PLC to read and write data to a file, such as a CSV or XML file, stored on an external device.
- Database instructions: These instructions allow the PLC to read and write data to a database, such as MySQL or Oracle, stored on an external device.
Communication instructions are often used to exchange data with other systems or devices or to store data for later analysis.
Read Next: