16. PLC Operation
16.1 PLC Organization
• Remember: The PLC is a computer. Computers have basic components, as shown below.
• In fact the computer above looks more like the one below,
• The thing to notice is that in this computer outputs aren’t connected to the CPU directly.
• A PLC will scan a copy of all inputs from the various inputs, into memory. After this the ladder logic program is run, and it creates a working table of all outputs in memory also. This table is written to the outputs only after the ladder logic program is done. This continues indefinitely while the PLC is on.
** The important point is that the inputs and outputs are “snap-shots” before and after the program runs.
• PLC operation can be shown with a time-line.
SELF TEST: Checks to see if all cards error free, reset watch-dog timer, etc. (A watchdog timer will cause an error, and shut down the PLC if not reset within a short period of time: this would indicate that the ladder logic is not being scanned normally).
INPUT SCAN: Reads input values from the chips in the input cards, and copies their values to memory. This makes the PLC operation faster, and avoids cases where an input changes from the start to the end of the program (e.g., an emergency stop). There are special PLC functions that read the inputs directly, and avoid the input tables.
LOGIC SOLVE/SCAN: Based on the input table in memory, the program is executed 1 step at a time, and outputs are updated. This is the focus of the later sections.
OUTPUT SCAN: The output table is copied from memory to the output chips. These chips then drive the output devices.
16.2 PLC Status
• The PLC keeps track of its status, for internal use, as well as allowing use by the ladder logic.
• Some of the status flags available in PLC’s are,
PLC power on, first scan
Data retention -- PLC restarts with same outputs stopped with
Scan time too long error
I/O error -- problem with one of the I/O cards
16.3 Memory Types
• Basic memory types include,
FLASH RAM -
16.4 Software Based PLCs
• Software based PLCs run on normal personal computers, but they use software that emulates dedicated PLCs.
16.5 Programming Stadards
16.5.1 IEC 61131
• The IEC 61131 (previously 1131) standard is an effort towards standardizing PLC oriented control. This is more necessary now that personal computers and software are starting to open the PLC market.
• These standards were not designed to force a rigid style, so the different PLC vendors will still have programming environments that vary, but the conceptual elements will be consistent.
• The most notable differences between implementation of PLCs will be addresses of outputs, inputs, internal memory, etc.
• There are a few components to the standard,
IEC 1131-3 Data types and programming
IEC 1131-5 Communications
IEC 1131-7 Fuzzy control
• IEC 1131-3 defines the basic programming languages,
IL (Instruction List): This is effectively mnemonic programming
ST (Structured Text): A BASIC like programming language
LD (Ladder Diagram ): Relay logic diagram based programming
FBD (Function Block Diagram): A graphical dataflow programming method
SFC (Sequential Function Charts): A graphical method for structuring programs
• Many of the functions described in this note set support the standard.
• The standard also defines data types,
16.5.2 The Future of Open Architecture Controllers
• a PLC is not simply a computer. It contains a computer, with special interfacing abilities. But the programming environment is like the Java Virtual Machine. The programs are interpreted within the ladder logic model. Some features are not available, while others are enhanced.
• Each PLC vendor has developed one or more different PLC models that bare some similarity at the level of basic inputs and outputs. To unite these models there has been recent work to develop a common standard so that all PLCs are similar (IEC 1131) but this is not to the point where it will free the user from a single vendor.
• At the present time inputs and outputs are becoming more flexible, but the central computation controller (PLC CPU) is still vendor specific. Consider that you can write a program in Java that will compile on dozens of java compilers.
• There are two possible directions that this might go,
some third party companies are developing products that are based on other companies models, such as SoftPLC being based on the PLC-5
a standards group may be able to develop a standard addressing and instruction set. And a common execution model may also be developed that will allow vendors to develop a common engine.
Problem 16.1 PLC’s typically contain:
c) Both a) and b)
d) None of the above
Problem 16.2 A PLC can only go through the ladder logic a few times per second. Why?
Problem 16.3 Indicator lights are used on PLC’s for,
c) a) and b)
d) none of the above.
Answer 16.3 c
Problem 16.4 What will happen if the scan time for a PLC is greater than the time for an input pulse? Why?
Answer 16.4 the pulse may be missed if it occurs between the input scans
Problem 16.5 What is the difference between a PLC and a desktop computer?
Problem 16.6 Why do PLCs do a self check every scan?
Problem 16.7 TRUE or FALSE -- The test time for a PLC will be long compared to the time required for a simple program.