Those Finite State Machines with outputs do have an initial state, but not an 'accept' state. They are known as Mealy Machines. A state transition diagram for a vending machine, an example of one, is shown below.
Transition tables can also be used for these systems and they differ depending upon whether the FSM has an output. The first table is for the first FSM, whilst the second table is for the second FSM.
Input | Current State | Next State |
Nothing | S0 | S0 |
Incorrect Code | S0 | S1 |
Nothing | S1 | S0 |
Correct Code | S0 | S2 |
Nothing | S2 | S0 |
Input | Current State | Output | Next State |
0p | S0 | 0 | S0 |
50p | S0 | 0 | S1 |
50p | S1 | 1 | S2 |
£1 | S0 | 1 | S2 |
0p | S2 | 0 | S1 |
Decision tables let one consider the possible combinations and what should happen as a result.
Example: if the week day is odd then output A, if it is even then output B
Conditions | Specific Data | |
Mon/Wed/Fri/Sun | Y | N |
Tues/Thurs/Sat | N | Y |
Output A | Y | N |
Output B | N | Y |
Y = Yes, N = No
Psuedo code can also used to represent these problems as they would be using similar syntax to inside a computer program, but not in a programming language. For the example shown above the pseudo code would be something like:
If Day = Odd, then Output A
Else Output B
Superb post. Couple of improvements: FSM can be abstract (e.g representing software) as well as physical/mechanical systems. our decision table layout is clear - but probably better to stick with the notation used by the exam board
ReplyDelete