|
Topic: DMD0505 Example 2 - A Lamp On/Off Controller |
|
|
Example 2: A Lamp On/Off Controller
This next example will work through a situation common to those new to stage programming, and will illustrate the need for a clear understanding of the different states of the process and the consequences of defining the states incorrectly.
|
|
|
|
Next draw the state transition diagram. Note that this example differs from the motor example, because now there is only one push button.
When implemented as a stage program this solution would flash the light on or off each scan &endash; definitely not the desired result!
|
|
The solution is to make the push and the release of the push button separate events.
At power-up the control process starts in the OFF state.
When the input switch X0 is pressed, the control process will transition to the Push-ON state.
When X0 is released, the control process will transition to the ON state.
When in the ON state, a similar push and release cycle of X0 will take the control process back to the OFF state.
Now there are two unique states (OFF and ON) used when the push button is released, which is what is required to solve the control problem.
|
|
The desired power-up state is OFF, so Stage S0 is the first stage in the program making it the initial stage.
Note that even as the control programs grow more complex, it is still easy to correlate the state transition diagram with the stage program. |
|
|
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
|
|
|