eBook: Automating Manufacturing Systems; with PLCs
   



TOC PREV NEXT

19.3 AN EXAMPLE


The example beginning in Figure 284 shows a subroutine implementing traffic lights in ST for the ControlLogix processor. The variable 'state' is used to keep track of the current state of the lights. Timer enable bits are used to determine which transition should be checked. Finally the value of 'state' is used to set the outputs. (Note: this is possible because '=' and ':=' are not the same.) This subroutine would be stored under a name such as 'TrafficLights'. It would then be called from the main program as shown in Figure 283.



Figure 283 The Main Traffic Light Program



Figure 284 Traffic Light Subroutine
TOC PREV NEXT

Search for More:

Custom Search