Page 719 - Mechatronics with Experiments
P. 719

PROGRAMMABLE LOGIC CONTROLLERS  705
                      9.3 PROGRAMMING OF PLCs

                             Every PLC includes a program development software tool which allows the communication
                             between a PC and the PLC, development of the PLC application software, debugging,
                             downloads, and tests it (Figure 9.2). A notebook PC is used only as development tool
                             in this case, not as part of the real-time control. The development tools for different PLC
                             manufacturers currently are not interchangable. The application development engineer must
                             use the development tools supplied by the specific PLC vendor.
                                  Assuming that we have the program development tools (i.e., a notebook PC and a
                             PLC specific ladder logic program development environment), the software that runs on
                             the PLCs to control a specific industrial application is the issue discussed here.
                                  There are three main types of programming languages available for PLCs:
                                1. Ladder logic diagrams (LLD) which emulate the same structure of the hard-wired
                                  relay logic diagrams. These have the widest use since most field technicians are
                                  familiar with hardware relay logic diagrams and can understand LLD programs.
                                2. Boolean language is a statement list and is similar to BASIC programming language.
                                3. Flowchart language uses graphical blocks. It is more intuitive than the other two
                                  languages. Although the use of flowchart languages has started to increase in recent
                                  years, LLD is still the dominant language.
                             The flowchart type languages may eventually gain more widespread acceptance. Today,
                             every PLC has its own LLD language and they are not compatible across different PLCs. A
                             flowchart language designed based on standards can generate different run-time programs
                             for different PLCs simply by using a PLC specific compiler. The LLD programming
                             environment for all PLCs looks very similar from the application program development
                             point of view. In the rest of this chapter, only the LLD programs will be discussed, not the
                             specific development environment for a particular PLC.
                                  There is a fundamental difference between the way a PLC executes its program and
                             the way a PC does. The program flow in a PC is controlled by the flow control statements
                             such as do-while, for loops, if-else blocks, function calls, jump or go-to statements. In high
                             level programming languages, it is possible that the program can be limited to a local loop.
                             Whereas a PLC program runs in the so-called scan mode (Figure 9.7 ). The whole program





                                  Update inputs


                                    Execute
                                   ladder logic
                                    program
                                       . .
                                       .
                                       .


                                 Update outputs

                                                        FIGURE 9.7: Ladder logic program execution model in a
                                  Repeat every          PLC. The PLC executes its program in scan mode. All of the
                                   scan period          code is checked for execution every scan period.
   714   715   716   717   718   719   720   721   722   723   724