Page 721 - Mechatronics with Experiments
P. 721

PROGRAMMABLE LOGIC CONTROLLERS  707
                             the industrial control and logic, not high level object oriented data structures. Therefore,
                             typical data structures supported include:

                                1. bits for discrete I/O,
                                2. bytes and words for analog I/O and charater data.
                             There are standard key words reserved for discrete input, output, timer, and counter funtions
                             in the PLC. For instance, the DIN 19239 standard specifies the following key words for
                             PLC ladder logic programming concerning I/O and memory addresses:

                                1. I: for discrete input lines, for instance I0 through I1023.
                                2. O: for discrete output lines, for instance O0 through O1023.
                                3. T: for timer functions, for instance T0 through T15.
                                4. C: for counter functions, for instance C0 through C31.
                                5. F: for “Flag” to store and recall a bit of data, that is flip-flop operations.

                             Once the actual I/O terminal points on the I/O modules in the PLC slots are decided, then
                             there is a memory map established between the I/O variables in the memory and the actual
                             I/O terminal points of the I/O modules, using the configuration software tools of the PLC
                             program development enviroment. Furthermore, most PLC program development tools
                             support symbolic names. In other words, if the discrete input lines 0 and 1 are connected to
                             two input switches called “START” and “STOP,” they can be symbolically defined to map
                             to I0 and I1. Then, in the program all references to these switches can be made using the
                             symbolic variable names “START” and “STOP” which is more descriptive and makes the
                             program easier to understand.
                                  The logic operators and statements supported by most PLC ladder logic programs
                             include
                                1. logic functions: AND, OR, NOT,
                                2. shift functions: left shift, right shift,
                                3. math functions : add, substract, multiply, divide, sin, cos,
                                4. software implemented timer and counter functions,
                                5. software implemented flip-flops,
                                6. conditional blocks (similar to if-else),
                                7. loops (do-while, while, for loops). Since loops can tie up a logic and a PLC must
                                  scan all of the logic, loops in PLC ladder logic are treated differently then the loops
                                  in C-like high level programming languages,
                                8. functions (subroutines),
                                9. interrupt service routines to be executed on interrupt inputs.
                             The AND and OR logic functions between two state variables are implemented in ladder
                             logic diagrams by series and parallel connections, respectively. The NOT function is imple-
                             mented by a cross over the contact signal. Other functions are generally supported by a
                             rectangular box with appropriate input and output lines.
                                  Some of the syntax rules common to all ladder language programs are as follows:

                                1. A ladder logic program is a sequence of rungs. Each rung must begin with an input
                                  or local data.
                                2. Output channels can appear at the end of a rung only once.
   716   717   718   719   720   721   722   723   724   725   726