vending machine
play

Vending machine A design-example by Ingo Sander William Sandqvist - PowerPoint PPT Presentation

Vending machine A design-example by Ingo Sander William Sandqvist william@kth.se System Control We will design the block System Control COIN_PRESENT DROP COIN DROP BOTTLE RECEIVER GT_1_EURO DROP_READY SYSTEM EQ_1_EURO CONTROL


  1. Vending machine A design-example by Ingo Sander William Sandqvist william@kth.se

  2. System Control We will design the block System Control COIN_PRESENT DROP COIN DROP BOTTLE RECEIVER GT_1_EURO DROP_READY SYSTEM EQ_1_EURO CONTROL LT_1_EURO DEC_ACC RETURN_10_CENT COIN RETURN ACCUMU- CLR_ACC CHANGER_READY LATOR Return only 10 cents coin. William Sandqvist william@kth.se

  3. Coin Reciever The System Control unit controls a number of subsystems from other suppliers. Coin Reciever . Drop Bottle . Coin Return . COIN_PRESENT COIN RECEIVER GT_1_EURO SYSTEM EQ_1_EURO CONTROL LT_1_EURO DEC_ACC ACCUMU- CLR_ACC LATOR A ACCUMULATOR counts up the amount of paid coins. • Signal COIN_PRESENT indicates that there are coins and the ”amount” is indicated by the signals GT_1_EURO , EQ_1_EURO , LT_1_EURO . • With the signals DEC_ACC and CLR_ACC the systemcontrol unit can reduce the amount by 10 cents, or reset the ACCUMULATOR . William Sandqvist william@kth.se

  4. Coin Return SYSTEM CONTROL RETURN_10_CENT COIN RETURN CHANGER_READY With a pulse on RETURN_10_CENT the coin return unit will eject 10 cent, and signal CHANGER_READY when this is done and the unit is ready for the next command. William Sandqvist william@kth.se

  5. Drop Bottle DROP DROP BOTTLE DROP_READY SYSTEM CONTROL With a pulse on DROP the drop bottle unit will eject a bottle, and signals DROP_READY when this is done and the unit is ready for the next command. William Sandqvist william@kth.se

  6. Block diagram COIN_PRESENT DROP DROP BOTTLE GT_1_EURO DROP_READY SYSTEM COIN EQ_1_EURO CONTROL RECEIVER LT_1_EURO DEC_ACC COIN RETURN RETURN_10_CENT CLR_ACC CHANGER_READY Signal properties • ◦ DROP_READY is active for a clockperiod after the bottle is ejected ◦ CHANGER_READY is active for a clockperiod after a 10 Cent coin is ejected ◦ Because of the mechanical properties the following signals are active and inactive for several clock periods: COIN_PRESENT ( active for several clockperiods after the coin is inserted )  DROP_READY ( active for several clockperiods at bottle ejection )  CHANGER_READY ( inactive for several clockperiods at coin ejection ) 

  7. Use a Moore-machine State NEXT STATE OUTPUT STATE REGISTER DECODER DECODER Output- Input- signals signals Clk • Construction of a state machine for the controller of a vending machine • Assumptions - Moore-machine - Stateregister implemented with D-flip-flops William Sandqvist william@kth.se

  8. Function diagram for vending machine • Coin input Reset – 10 Cent, 50 Cent, 1 Euro • Coin return – 10 Cent Nej Myntinkast no • Price of one bottle registrerat? – 1 Euro Ja yes Sum < 1€ Summa? Sum= 1€ Sum > 1€ Mata ut Retur flaskan 10 Cent Minska Nollställ summan summan William Sandqvist william@kth.se

  9. State diagram COIN _ PRESENT (a) COIN _ PRESENT COIN _ PRESENT (b) _ 1 _ LT EURO We draw a COIN _ PRESENT state diagram (c) _ 1 _ EQ EURO from the _ 1 _ GT EURO functional DROP _ READY CHANGER _ READY (d) (f) diagram : DROP _ 10 _ RETURN CENT DROP _ READY CHANGER _ READY (e) (g) DEC _ ACC CLR _ ACC

  10. State diagram (a) Wait for coin input (b) Register coin? (c) Coin is registered (3 cases) (d) Eject bottle (e) Reset sum (f) Return 10 Cent (g) Decrease sum 10 Cent William Sandqvist william@kth.se

  11. Block schematic Insignals State register Outsignals D A A COIN_PRESENT D LT_I_EURO Clk DROP EQ_I_EURO RETURN_I0_CENT GT_I_EURO D B B D Next State Output DROP_READY Decoder Clk Decoder CHANGER_READY CLR_ACC DEC_ACC A D C C D B Clk C William Sandqvist william@kth.se

  12. State encoding Idea: Let the states that are close together in the state diagram have codes with unit distance. (b) next to (c) 7 states 3 state variables A, (d) next to (e) B, C are needed (a) next to (b) AB (f) next to (g) 00 01 11 10 0 a Ø d f C 1 b c e g (Ø = don’t care) The number of inputs is large, 6, total there may be nine variables in Karnaugh maps ??? William Sandqvist william@kth.se

  13. State encoding A B C COIN _ PRESENT AB (a) 000 00 01 11 10 COIN _ PRESENT 0 a Ø d f C COIN _ PRESENT 1 b c e g (b) _ 1 _ LT EURO 001 (Ø = don’t care) COIN _ PRESENT State variable ABC, eg. (c) 011 in state (c) is _ 1 _ EQ EURO A = 0, B = 1 and C = 1 _ 1 _ GT EURO DROP _ READY CHANGER _ READY 100 110 (d) (f) DROP _ 10 _ RETURN CENT DROP _ READY CHANGER _ READY 111 101 (e) (g) DEC _ ACC CLR _ ACC

  14. Coded state table? From the state diagram, you can set up the following coded state table. How do we avoid the complexity of nine variables? William Sandqvist william@kth.se

  15. Variable-Entered Mapping (VEM) Variable-Entered Mapping can be helpful when you need Karnaugh diagrams with many variables. You write functional expression of Karnaugh diagrams. A + D A AB 00 01 11 10 0 0 Ø 1 1 C 1 0 EQ + GT 0 0 Variables William Sandqvist william@kth.se

  16. Next state - D A A + D A AB EQ : EQ_1_EURO GT : GT_1_EURO 00 01 11 10 0 0 Ø 1 1 C 1 0 EQ + GT 0 0 + = = ⋅ ⋅ + ⋅ ⋅ + ⋅ A D A B EQ A B GT A C A William Sandqvist william@kth.se

  17. Next state - D B B + D B AB EQ : EQ_1_EURO CP : COIN_PRESENT 00 01 11 10 0 0 Ø 1 0 C + = = ⋅ ⋅ + ⋅ + ⋅ ⋅ + ⋅ ⋅ B D A B EQ B C B C CP A B C 1 CP EQ 0 1 B Easy to miss! William Sandqvist william@kth.se

  18. Next state - D C CP : COIN_PRESENT DR : DROP_READY C + D C AB CR : CHANGER_READY 00 01 11 10 0 CP Ø DR CR + = = ⋅ ⋅ + ⋅ ⋅ C D A C CP B C DR C C 1 1 0 0 1 + ⋅ ⋅ + ⋅ A B CR B C William Sandqvist william@kth.se

  19. Output signals The output signals are the "pulses" which are generated when passing through the states d, f, e, g. = DROP AB C = _ CLR ACC ABC = _ 10 _ RETURN CENT A B C = _ DEC ACC A B C William Sandqvist william@kth.se

  20. Implementation of the vending machine ” students must master the the design of simple combinational and sequential digital systems” You do that now! When they call from CocaCola, it's just for you all”Digital Designers” to adopt the mission ... William Sandqvist william@kth.se

  21. William Sandqvist william@kth.se

  22. What will happen in state Φ ? AB Φ 00 01 11 10 0 a Ø d f C 1 b c e g Φ = ( 010 ) ABC + = ⋅ ⋅ + ⋅ ⋅ + ⋅ ⇒ + = ⋅ ⋅ + ⋅ ⋅ + ⋅ = + ( 010 ) 1 1 1 1 0 1 A A B EQ A B GT A C A EQ GT EQ GT ABC + = ⋅ ⋅ + ⋅ + ⋅ ⋅ + ⋅ ⋅ ⇒ + = ⋅ ⋅ + ⋅ + = ( 010 ) 1 1 1 1 ... 1 B A B EQ B C B C CP A B C B EQ ABC + = ⋅ ⋅ + ⋅ ⋅ + ⋅ ⋅ + ⋅ C A C CP B C DR A B CR B C ⇒ + = ⋅ ⋅ + ⋅ ⋅ + ⋅ ⋅ + ⋅ = + ( 010 ) 1 1 1 1 0 0 0 0 C CP DR CR CP DR ABC + + + = − − = → Φ 1 010 , 110 , 011 , 111 , , , A B C d c e William Sandqvist william@kth.se

  23. What will happen in state Φ ? + + + = − − = → Φ 1 010 , 110 , 011 , 111 , , , A B C d c e In Φ -state we are stuck, or Φ we go to (c) and then on. Or we go to (d) and offers soft drinks, or we go to (e) and resets any previous payment. Obviously, we need to purchase a reset circuit that ensures that the machine always starts in (a) 000 ! Otherwise we will have legitimate complaints from the customers! RESET-generator William Sandqvist william@kth.se

  24. William Sandqvist william@kth.se

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend