|
Topic: DMD0503 Example 1 - A Simple 2-State Process |
|
|
Example 1: A Simple 2-State Process
The process will use one momentary push button to turn the motor on, and a second momentary switch to turn it off. The machine operator will press the appropriate push button for a second or so.
From this description it’s easy to see that there two states of the process: ON and OFF. |
|
|
|
To help see the relationship between the two methods in problem solving, first look at the state diagram implemented first as a traditional ladder logic program, then implemented as a stage program.
When the Off push button (X1) is pressed, it opens the normally closed X1 contact, which resets the latch. Motor output Y0 turns off when the latch coil C0 goes off.
|
|
The stage programming solution is shown below. The two Stage instructions S0 and S1 correspond to the two states OFF and ON. In the ladder rungs below, each stage box belongs to its respective stage. Recall that the PLC only scans the rungs in a stage when the stage is active.
When the On push button (X0) is pressed, a stage transition occurs. The Jump to Stage (JMP) S1 instruction executes, which disables Stage S0 and enables Stage S1. Since Stage S1 follows after Stage S0 in the logic of this example, it will be executed on this same scan.
On the next PLC scan, the CPU will not execute Stage S0, but will execute stage S1.
In the On State (Stage S1), the unconditional output Y0 turns the motor on.
When the Off push button (X1) is pressed, a transition back to the Off State occurs. The Jump to Stage (JMP) S0 instruction executes, which disables Stage S1 and enables Stage S0.
On the next PLC scan, the CPU will execute Stage S0 and will not execute Stage S1, so the motor output Y0 will turn off.
The Off state (Stage S0) will be ready for the next cycle.
|
|
At first the advantage to Stage Programming might not be obvious; in fact, the stage program is actually longer than the ladder logic program. But, as control problems grow in complexity, stage programming will quickly out-perform traditional ladder logic programming methods in simplicity, program size, execution speed, etc. Initial Stages
To begin our process control in the OFF state (with the motor off) similarly to how the ladder logic program works, no modifications to the Program code block are required. The PLC will scan contact X0 after power-up, because stage S0 is enabled automatically because it is the Initial Stage.
Both programs can be changed so that the motor is ON at power-up. |
|
|
|
Stage S1 and its contents must be moved so that it is now the first stage in the Program code block.
Notice that the stages were not renumbered, it’s simply the placement within the program that determines which stage is the Initial Stage. |
|
|
|
|
Stage Programming Concepts
Example 1 - A Simple 2-State Process
Example 2 - A Lamp On/Off Controller
Example 3 - A Garage Door Opener
Example 4 - Parallel Processing
Review - Steps to Writing Successful Stage Programs Stage Instructions in the Do-more Controller
|
|
|