1. Describe the function program in as much detail as possible from the point of view of the outside world.
2. Identify all inputs and outputs.
3. List all the states of distinct machine and indicate the transitions.
4. Write the program.
Rather than describing programming of state machine in abstract terms, let’s develop a simple control application of real-world exhibit using state machine techniques. Much more complex programs can be built using the same principals interestingly, while a more complex program will certainly have many more states, each state will likely be simple.
The example transitions program sequentially from one state to the next. This is not a state programming requirement you may jump from any state to any other. A more complex program will likely jump around based on varying input conditions.
Describe the function of the program.
The first step in a state machine program developing (and, indeed, any program) is to clearly state the functional objectives:
As a visitor walks through the display, a detector motion triggers the PLC. The PLC will then trigger a DMR (digital message repeater) to play one of several available sound effects. To prevent repetition, the sounds are selected at “random.” A short delay is provided after each effect to prevent the next sound effect triggering by the same visitor.
We will accomplish the “random” selection of the next SFX by using a look-up table that contains three sets of all available message numbers in a non-sequential order due to the inherent problems with random number generation. The next step is to analyze the functional description, and create I/O tables. We usually select a digital message repeater that has a contact that is active as long as the clip is playing thus, the program doesn’t care how long any of the individual SFX are.