The central processing unit (CPU) is the brains of the PLC. Most processors usually contain a microprocessor that implements the logic and controls the communications among all of the modules.
Storage of memory is required by the processor in order to save the results of logical operations executed by the microprocessor. Other parts of the CPU that also require memory are the programs EPROM or EEPROM plus RAM.
To further understand the CPU we need to expand upon what the CPU does for the PLC. The user enters data using ladder logic and the CPU controls this activity. Through a method called a scan the PLC program is executed.
This scan generally starts with the CPU reading the status of inputs. The application program is then executed. The CPU then performs internal diagnostic and communication tasks. Then the status of the outputs is updated. This is a repetitive process that then starts over.
Functions of Processor
The main function of the CPU is to execute the program and make the decisions needed by the PLC in order to operate and communicate with other PLC modules.
The memory section of the CPU electronically stores the PLC program with other digital information.
CPU Self-diagnostic Test
One of the main responsibilities of the CPU is to alert the operator and control program of any faults detected in any of the PLC components, including in the user program or within the CPU itself.
In order to do this, the CPU must perform two types of tests: start-up diagnostics and run-time diagnostics. The results of these tests are then signaled by LED status lights on the CPU and are stored in the CPU memory.
In some fault scenarios, the fault can be detected and resolved without causing the processor to halt operation of the control program. In some cases, it may need to continue operating under certain limitations and in others, it may require a complete shutdown.
These are usually classified as either “major faults” or “minor faults”. Major faults cause the processor to stop operations and go into STOP mode. Minor faults can often be resolved while the CPU is still running.
The CPU stores all error codes in a part of the memory called the system status area. When a recoverable fault occurs, the user can gain access to that fault information and use it to correct the fault and return to normal operation.
Other fault classifications are as follows:
Scan Time Exceeded:
Less critical fault; certain programming errors may not be as critical
The processor can restore order and allow the user to respond to the faults in the control program
The processor cannot restore order and allow the user to respond to the faults in the control program.
Faults: Error or default that occurs in the computer or PLC.
CPU: Central Processing Unit.
Diagnostics: the detection and isolation of an error or fault.
Typical Processor Scan
A scan is a complete cycle of a PLC checking inputs, then executing the program, and then updating output status.
A complete program can contain thousands of inputs and outputs that must be evaluated and scanned while the program is running.
Often, the processor will scan all of its inputs and then update its outputs. Then, the processor will evaluate ladder logic. Changes made during a program scan will not be effective until the next I/O update.
A complete program scan may take only milliseconds.
Discuss and understand Scan Time
Program scan cycle:
Reads all inputs, energizes or de-energizes outputs according to the input values; consists of input scan, program scan, output scan and housekeeping duties.
Because inputs can change at any time, the processor repeats this cycle for as long as the PLC is in RUN mode.
The time required to read all inputs, execute the control program and upload the local and remote input and output statuses.
The time required to activate an output controlled by programmed logic. Provides a measure of the speed of response of the PLC.
Indicates how fast the controller can react to changes in inputs – usually varies from 1-20 milliseconds. Therefore, input signal changes that happen faster than the scan time may never be recognized by the processor.
For this reason, special function input/output modules can be used.