ENGG1100 Lecture7: Introduction To Engineering Design (Digital Logic) Part 2 Kin Hong Wong ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 1.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

ENGG1100 Ch7: Introduction To Engineering Design (Digital Logic)
ENGG1100 Ch6: Introduction To Engineering Design (Digital Logic) Part 2 of digital logic KH WONG ENGG1100. Ch6-Digital Logic (part2) v3h1.
ENGG1100 Introduction to Engineering Design Omni-wheel Car Additional Documentation.
Lab7: Introduction to Arduino
Give qualifications of instructors: DAP
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Programming in easyC.
PLC OPERATION & PROGRAMMING Dr. ONUR TOKER. What is a PLC ? PLC is a computer system controlling a process. inputs - the keyboard is analogous to a proximity.
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
State Machines Used to Design Sequential Circuits.
Efficient Path Determining Robot RIT Computer Engineering Senior Design Project Jamie Greenberg Jason Torre October 26, 2004 A motorized robot will navigate.
Arduino. Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
 Main Components:  Sensors  Micro controller  Motor drivers  Chasis.
Programming with Function Blocks
ENGG1100 Lecture 6: Introduction To Engineering Design (Digital Logic) Part 1 Kin Hong Wong ENGG1100. Ch6-Digital Logic (Part1) 25/2/14 1.
Testbed: Exercises.
ENGG1100 Introduction to Engineering Design Digital Logic (Part 2) Prof. Kin Hong Wong Department of Computer Science and Engineering.
ENGG1100 Ch6: Introduction To Engineering Design (Digital Logic) Part 1 KH WONG ENGG1100. Ch6-Digital Logic (v3e2.v5)1.
1 COMP541 State Machines Montek Singh Feb 8, 2012.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
ERGM 1413 Programming and Playing with Intelligent Robots Prof. K.H. Wong Robot building v4.7b1.
Finite State Machines (FSMs) and RAMs and inner workings of CPUs COS 116, Spring 2010 Guest: Szymon Rusinkiewicz.
ENGG1100 Ch5: Introduction To Engineering Design (Digital Logic) Part 1 of digital logic KH WONG ENGG1100. Ch5-Digital Logic (v3e2)1.
Overview of Project 3 Slides are available at : Updated 1/28 Due Date for project has been extended to next Friday 2/6.
11/02/2009CA&O Lecture 03 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
Finite State Machines (FSMs) and RAMs and CPUs COS 116, Spring 2011 Sanjeev Arora.
ENGG1100 Introduction to Engineering Design Digital Logic (Part 1) Prof. Kin Hong Wong Department of Computer Science and Engineering.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4/Lab3.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
Teaching Digital Logic courses with Altera Technology
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
My first robot programming - Simple “Go” Young Joon Kim MSRDS First Beginner Course – STEP4.
4) Design the logic to control the motor on a simple remote control car. There are two buttons on the remote control for the motor. If neither button is.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
Mechanical Components and Programming Ken Youssefi Introduction to Engineering – E10 1.
FlowArm PLTW Programming
Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Programming and Debugging with the Dragon and JTAG Many thanks to Dr. James Hawthorne for evaluating the Dragon system and providing the core content for.
Datapath and control Dr. ir. A.B.J. Kokkeler 1. What is programming ? “Programming is instructing a computer to do something for you with the help of.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
What is Arduino? It's an open source electronics prototyping platform: Open source: resources that can be used, redistributed or rewritten free of charge,
Introduction to the FPGA and Labs
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
Obstacle avoiding robot { pixel }
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
Unit 3: ALGORITHMS AND FLOWCHARTS
Dance robot as a tool for implementation of micro-programming
COMP541 Sequential Logic – 2: Finite State Machines
Lesson 2: Introduction to Control programming using Labview
Evaluation in Engineering Design Process Modeling and FSM
Robot Programming Computer Literacy S2.
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Lecture 24 Logistics Last lecture Today HW7 due today
CSCI1600: Embedded and Real Time Software
CSE 370 – Winter Sequential Logic-2 - 1
CSCI1600: Embedded and Real Time Software
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Robotics Programming Using Shaft Encoders
Lecture 24 Logistics Last lecture Today HW7 due today
Instructor: Michael Greenbaum
Lecture 19 A bigger FSM example: Hungry Robot Ant in Maze.
Presentation transcript:

ENGG1100 Lecture7: Introduction To Engineering Design (Digital Logic) Part 2 Kin Hong Wong ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 1

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Overview Part 1 (late week): Introduction – 1.1 What is Digital logic? – 1.2 Digital operations (AND, OR, NOT) – 1.3 Truth table – 1.4 Robot Hardware – 1.5 Software implement of digital operations Part 2 : Hardware/software Implementation – 2.1 Robot system – 2.1 Use of If-then-else (software method 1) – 2.2 Use of switch case (software method 2) – 2.3 Finite state machines ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 2

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors 2.1 The Intelligent Robot system ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 3 Arduino board (programs to be run in the Arduino computer): : Loop { If …. then…. else…. } In1 In2 In3 In4 Out1 Out2 Out3 Out4 Motor drivers Magnetic sensors S1, S2 Magnetic strips S2 S1 RM1 RM2 LM1 LM2 Our debug interface Board Programmer to update the program USB cable L293D H-bridge

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Our debug (interface) board You may use the debug board provided to connect input/output signals to the Arduino board ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 4

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Sensors of our robot Magnetic Switch Sensors – S1,S2,S3 each can be ‘1’ or ‘0’ – Magnetic field detected =>Si=0 – No Magnetic field detected =>Si=1 ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 55 S2 S3 S1 The robot is facing you

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Motors of our robot Motors: LM1, LM2, RM1 and RM2 – Instruction LM1(0) sets LM1 to be 0 – Instruction LM1(1) sets LM1 to be 1 Motor control method – {LM1=1 and LM2=0}=> Left-motor moves forward – {LM1=0 and LM2=1} => Left-motor moves backward – {LM1=0 and LM2=0} => Left-motor stops – Similar for the right-motor ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 66 RM1 RM2 LM1 LM2 The robot is facing you

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Software: Programing procedures Document about the use of Arduino – eLearning: Workshop 2: Introduction to Arduinohttps://elearn.cuhk.edu.hk/webapps/login/ – Edit program Compile Download to the SMART-car-board Run the program ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 7

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors 2.2 Method 1: to implement logic operations in a program using Logic Formula (use of IF-Then-Else) ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 8

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Using two sensors S2,S1 to follow a magnetic stripe Sensors: S2 S1 ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 9 Magnetic sensors S1, S2 Terminal 9 S2 S1 Magnetic field detected =>Si=0 No Magnetic field detected =>Si=1 Top down view Forward

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Method 1 (Use of If-then-else): This program will enable the robot to follow the magnetic path The program segment: Void loop() { LM1(0);LM2(0);RM1(0);RM2(0); //comment :LM1 =S1 AND S2 If (S1()==1 && S2()==1) LM1(1); Else LM1(0); //comment :LM2 = S1 OR S2 If (S1()==1 || S2()==1) LM2(1); Else LM2(0); } Notations used in the program Void Loop ( )= repeated the execution of the lines inside { } LM1(0) sets the digital output LM1 to 0 LM1(1) sets the digital output LM1 to 1 == means condition && means logic operation AND || means logic operation OR ! means logic operation NOT //comment, for you to put in your own notes ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 10 S2 S1 RM1 RM2 LM1 LM2 You may need to write S1(),S2(),LM1(),LM2(), etc. for your own system

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors 2.2 Software Method 2 : to implement logic operation in a program using truth table (Use of Switch-Case) ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 11

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Exercise2.1: Truth table example to make our robot to follow the magnetic strip Case 1)S1=1 (no mag. strip detected), S2=1 (no mag. strip detected) on both sides of magnetic strips: Robot should move forward 2)S1=1, S2=0 (robot deviates to the left side of the magnetic strip): Robot should turn right 3)S1=0, S2=1 (robot deviates to the right side of the magnetic strip): Robot should turn left 4)S1=0,S2=0 (robot reaches the terminal) : Robot should stop ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 12 Case InputsOutputs S1S2LM1LM2RM1RM2 1) ) 10?__ 3) 01?__ 4) 00?__ ?__ ?__ ?__ Magnetic strip S1 S2 forward:LM1, LM2, RM1, RM2=“1010” turn right:LM1, LM2, RM1, RM2=“1000” turn left:LM1, LM2, RM1, RM2=“0010” S1 S2 Fill in the table (control truth table) Robot Magnetic field detected =>Si=0 No Magnetic field detected =>Si=1

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors After the truth table is obtained we will use “Switch – case” in a program to implement it You may treat it as a table lookup method In English it means: – If INPUT is code1, result 1 will occur – If INPUT is code2, result 2 will occur – If INPUT is code3, result 3 will occur – Etc…… switch (INPUT) { case code1 : result 1; break; case code2 : result 2; break; case code3 : result 3; break; : } ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 13 Code_i=inputs for row i of a truth table Result_i=output for row i of a truth table

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Program example for our robot You only need to edit the program to change the desired truth table The program segment that produces the truth table on the right void LogicTable() { // S2,S1 are the least significant 4 bits of IN_sensor in the program switch (IN_sensor) // 0b00FEDCBA { case 0bxxxxxx11 : LM1(1);LM2(0);RM1(1);RM2(0); break; case 0bxxxxxx10 : LM1(1);LM2(0);RM1(0);RM2(0); break; case 0bxxxxxx01 : LM1(0);LM2(0);RM1(1);RM2(0); break; default : LM1(0);LM2(0);RM1(0);RM2(0 ); break; } ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 14 InputsOutputs S2S1LM1LM2RM1RM Magnetic sensors S1, S3 S2 S2 S3 S1

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors 2.3 Introduction to Finite State Machines We will have three examples here: a)Simple finite state machine (no sensor). E.g.: The dancing robot b)An finite state machine uses 2 sensors. E.g. The robot that follows the magnetic strip c)An finite state machine uses 3 sensors. E.g. The robot that follows the magnetic strip, and stops when it detects a magnet in the front. ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 15

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Understanding finite state machines Example of a door – State – Transition – Transition condition – Entry action ENGG1100. Ch7-Digital Logic (part 2) 16/02/

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Example in life State of a student at CUHK Start: go to state 1 State 1=Year 1: – entry action: register 12 courses – Transition: go to state 2 after 1 year State 2=Year 2: – entry action: register 12 courses – Transition: go to state 3 after 1 year State 3=Year 3: – entry action: register 12 courses – Transition: go to state 4 after 1 year State 4=Year 4: – entry action: register 8 courses and FYP Final_year_project – Transition: go to stop after 1 year Stop: Graduation ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 17 State1: Year 1 Reg. 12 course go to state 2 after 1 year go to state 3 after 1 year go to state 4 after 1 year graduation State2: Year 2 Reg. 12 course State3: Year 3 Reg. 12 course State4: Year 4 Reg. 8 Course & FYP after 1 year

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors 2.3a) The simple state machine (no transition condition ) The robot that dances with a pattern – Forward 2 seconds, turn left 2 seconds and turn right 2 seconds, stop and repeat the pattern again Video demo: ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 18

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Simple finite state machine for (3a) : No sensor input (no transition condition) ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 19 Entry action: Move Forward Output: LM1,LM2,RM1,RM2=1010 E: Turn Left Output: LM1,LM2,RM1,RM2=0010 E:Turn Right Output: LM1,LM2,RM1,RM2=1000 Transition: After 2 seconds E:Stop Output: LM1,LM2,RM1,RM2=0000 After 2 seconds Transition: After 2 seconds State1 State2 State3 State4 Start Entry actions Transition Flow diagram Baisc form

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Implementation of the finite state machine for (3a) Part of the sample source code is shown below: switch(state) { case STATE1: LM1=1;LM2=0;RM1=1;RM2=0;SPEED=200; //entry action DELAY_TIME=2000; // transition :delay 2 seconds motors(LM1,LM2,RM1,RM2,SPEED,SPEED,DELAY_TIME); state=STATE2; // next state will be state2 break; //end of the current state case STATE2: LM1=0;LM2=0;RM1=1;RM2=0;SPEED=200;DELAY_TIME=2000; // delay 2 seconds motors(LM1,LM2,RM1,RM2,SPEED,SPEED,DELAY_TIME); state=STATE3; //next state will be state3 break; //end of the current state // to be continued on next page ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 20 Use of DELAY: DELAY_TIME=2000 motors(LM1,LM2,RM 1,RM2,SPEED,SPEE D,DELAY_TIME); Set motor to run forward with speed=200 Exercise: explain the meaning of state 2 You may need to write the function motors( ) for your project

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Continue from last page Exercise 2.2 case STATE3: (fill in by students) break; case STATE4: (fill in by students) break; default: //none of above will be forced to run state4 state=STATE4; break; } ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 21 Exercise2.2: Fill in the missing programs in state 3 and 4

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors 2.3b) A finite state machine uses 2 sensors (with transition condition) E.g. The robot that follows the magnetic strip ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 22

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Example in life (with transition condition : study hard) State of a student at CUHK Start : go to state1 State 1=Year 1: – entry action: register 12 courses – Transition: if (study hard) promote to state2 (year2) else go back to state 1 State 2=Year 2: – entry action: register 12 courses – Transition: if (study hard) promote to state3 (year3) else go back to state 2 State 3=Year 3: – entry action: register 12 courses – Transition: if (study hard) promote to state4 (year4) else go back to state 3 State 4=Year 4: – entry action: register 12 courses – Transition: if (study hard) promote to stop(graduation) else back go to state4 Stop: Graduation ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 23

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Demo for 2.3b) An finite state machine uses 2 sensors The robot can follow the magnetic strip Video Demo: Demo programs may be available from the eLearning: Workshop 2: Introduction to Arduino Two-State FSM demo 7.4bhttps://elearn.cuhk.edu.hk/webapps/login/ ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 24

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors 2.3c) Add another sensor at the front to detect the target object Sensors: S2, S1 are facing the ground to detect the magnetic stripe S3 is facing the front, used to detect the target object – S3=1 if no object is detected – S3=0 if an object is detected ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 25 Magnetic sensors S1, S3 S2 25 S2 S3 S1

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors A finite state machine uses 3 sensors E.g. Follow the magnetic strip, find the CAN and stop Video Demo : – The robot finds the CAN using the magnetic strip placed under the testing board and stops ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 26 S2 S3 S1 Obstacle End point RM1,RM2 LM1,LM2 Start point

ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 27 Finite state machine using 3 sensors (s1, s2, s3)with transition conditions for (3c) Flow diagram Basic form

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Program 3c (S1, S2, S3 are used) S1, S2 for following the magnetic strip S3 for detecting the CAN The sample source code (program_segment3) is shown below: switch(state) { case STATE1: // forward for 1 second LM1=1;LM2=0;RM1=1;RM2=0; SPEED=200;DELAY_TIME=10; motors(LM1,LM2,RM1,RM2,SPEED,DELAY_TIME); // if ( S3()==1 && S2()==1 && S1()=0 ) state=STATE2; else if(S3()==1 && S2()==0 && S1()=1) state=STATE3; else if((S3==0) || (S3()==1 && S2()==0 && S1()=0)) state=STATE4; break; case STATE2: //robot turns left LM1=0;LM2=0;RM1=1;RM2=0;SPEED=200;DELAY_TIME=10; motors(LM1,LM2,RM1,RM2,SPEED,DELAY_TIME); // if ( S3()==1 && S2()==1 && S1()=1 ) state=STATE1; //back to state 1 else if(S3()==1 && S2()==0 && S1()=1) state=STATE3; else if((S3==0) || (S3()==1 && S2()==0 && S1()=0)) state=STATE4; break; ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 28 If S3=0, a CAN is detected, next state is state4 Move forward for 1 second Robot deviated to the right, goto state 2 Robot deviated to the left goto state 3

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors case STATE3: //robot turns right // To be filled by students as an exercise case STATE4: //stop // To be filled by students as an exercise default: //none of above states state=STATE4; LM1=0;LM2=0;RM1=0;RM2=0; SPEED=200;DELAY_TIME=10; motors(LM1,LM2,RM1,RM2,SPEED,DELAY_TIME); break; } ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 29

Intro. | Robot | If-Then-Else | Switch-case | FSM | no sensor | 2 sensors | 3 sensors Demos A demo of a robot carrying two CANs and bring them simultaneously to the destination. Arduino software: ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 30

Overall summary In digital logic part 1 and 2, we learned – What is digital logic – Digital logic operations represented by Digital logic formula method Truth table method Their implementation methods using programs – Finite state machines Theory and implementations – Use the above to control a robot for specific tasks ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 31

End ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 32

ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 33 Appendix A : Answer: Exercise 2.1:Truth table example to make our robot follow the magnetic strip Case 1)S1=1 (no mag. strip detected), S2=1 (no mag. strip detected) on both sides of magnetic strips: Robot should move forward 2)S1=1, S2=0 (robot deviates to the left side of the magnetic strip): Robot should turn right 3)S1=0, S2=1 (robot deviates to the right side of the magnetic strip): Robot should turn left 4)S1=0,S2=0 (robot reaches the terminal) : Robot should stop Case InputsOutputs S1S2LM1LM2RM1RM2 1) ) ) ) Magnetic strip S1 S2 forward:LM1, LM2, RM1, RM2=“1010” turn right:LM1, LM2, RM1, RM2=“1000” turn left:LM1, LM2, RM1, RM2=“0010” S1 S2 Fill in the table Robot Magnetic field detected =>Si=0 No Magnetic field detected =>Si=1

Appendix B: Answer for Ex2.3 case STATE3: LM1=1;LM2=0;RM1=0;RM2=0;DELAY_TIME=2000; motors(LM1,LM2,RM1,RM2,SPEED,SPEED,DELAY_TIME); state=STATE4; break; case STATE4: LM1=0;LM2=0;RM1=0;RM2=0;SPEED=200;DELAY_TIME=2000; motors(LM1,LM2,RM1,RM2,SPEED,SPEED,DELAY_TIME); state=STATE1; break; default: //none of above will be forced to run state4 state=STATE4; break; } ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 34 Exercises: explain the meaning of state 3 and 4