Sunday, 11 September 2016

flipflop - How to lift the Flip Flop D equations of an ASM-Chart?


For example, I have the following ASM-Chart already done,which represents an automatic door :enter image description here


With moving sensors...


It has 4 state blocks, there are 3 Inputs:



P - Presence Sensor, A - door is completly open , F - door completly closed;


And 2 outputs: SF-The direction of the door (closing or opening) with SF = 1 means its closing and finally ON - which means the engine is working (the door is moving).


I have now to lift the state equations for Flip Flop's D. I already have the solutions but i don't know how to get there or what method to use,enter image description here



Answer



Hint: build a truth table for the next-state logic as a function of the current-state and input values. Since there are 2 bits of current-state (x1,x0) and 3 bits of input (P,A,F), there will be at most 32 rows in the table (2^5=32) if you draw out the full grid.


The process is basically just following the edges that transition from one state to the next state. Wherever the edge goes through a decision condition, the next state also depends on that input condition. Note: I am assuming True=1 and False=0, and I'm using _ to represent a don't care term. Here's the basic pattern for a truth table for 4 states, without considering the input conditions.


x1  x0  P   A   F   |   D1  D0  
0 0 _ _ _ |
0 1 _ _ _ |
1 0 _ _ _ |

1 1 _ _ _ |

For the first state (0,0), the next state depends on input P. The inputs A and F are ignored in this state. So the truth table row for state=(0,0);P=0;A=0;F=0 must set next-state=(0,0); and the truth table row for state=(0,0);P=1;A=0;F=0 must set next-state=(0,1).


x1  x0  P   A   F   |   D1  D0  
0 0 0 _ _ | 0 0
0 0 1 _ _ | 0 1
0 1 _ _ _ |
1 0 _ _ _ |
1 1 _ _ _ |


We also get the same output if A is 1, so those two rows can be copied for the A=1 variation. The extra terms will be reduced when you do the K-map. Or you can eliminate the duplicated rows from the truth table by designating the A and F inputs as "don't care". (Often that is indicated by "X" instead of "0" or "1", which incidentally makes the instructor's choice of x as a variable name somewhat nonstandard. Usually in the real world we use "s" to indicate next state.) Since you're going to be writing out the equations manually, might as well just mark A and F as don't care, so there's less stuff to write.


From state (0,1), the next state depends on input A (but not the other inputs).


x1  x0  P   A   F   |   D1  D0  
0 0 0 _ _ | 0 0
0 0 1 _ _ | 0 1
0 1 _ 0 _ |
0 1 _ 1 _ |
1 0 _ _ _ |
1 1 _ _ _ |


The edge from state (0,1);A=0 leads to state (0,1).


x1  x0  P   A   F   |   D1  D0  
0 0 0 _ _ | 0 0
0 0 1 _ _ | 0 1
0 1 _ 0 _ | 0 1
0 1 _ 1 _ |
1 0 _ _ _ |
1 1 _ _ _ |

The edge from state (0,1);A=1 leads to state (1,0).



x1  x0  P   A   F   |   D1  D0  
0 0 0 _ _ | 0 0
0 0 1 _ _ | 0 1
0 1 _ 0 _ | 0 1
0 1 _ 1 _ | 1 0
1 0 _ _ _ |
1 1 _ _ _ |

Follow the same basic procedure to build out the rest of the truth table. The state machine output terms are developed in the same way.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...