ENGG1100 Ch7: Introduction To Engineering Design (Digital Logic)

Slides:



Advertisements
Similar presentations
Unit 4 - I Said Stop!. Introduction New Topics Timing Parallelism Sequence of Operations New Features NXT terminals New Functions Wait For.
Advertisements

X Y 1. Forces Table/Ramp Earth Fe on b Fe on b x Fe on b y Ft on b Fx = Fe on b x Fy = Fe on by + Ft on b.
Introduction to Programming
NATIONAL RESILIENCE UPDATE NATIONAL RESILIENCE UPDATE 2.
Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
GROBI Gizmo Remote Operated Bluetooth Interface Sponsor: Calit 2 Mentors: Paul Blair & Javier Rodriguez Molina Team: Kristi Tsukida & Eldridge Alcantara.
Regional Workshop on the 2010 World Programme on Population and Housing Censuses: International standards, contemporary technologies for census mapping.
EducateNXT Robot Sumo. EducateNXT What is Sumo? Sumo is a competitive contact sport where a wrestler (rikishi) attempts to force another wrestler out.
Copyright © 1997 Altera Corporation download from: P.1 One Hot State Machine vs Binary/Gray Code State Machine Danny Mok Altera.
Section 2. Overview Finite state machine Homework 2 preparation Q&A.
State Machines March 18, Compositional Systems | Summary Composition is a powerful way to build complex systems. PCAP framework to manage complexity.
Finite State Machines (FSM)
1 A latch is a pair of cross-coupled inverters –They can be NAND or NOR gates as shown –Consider their behavior (each step is one gate delay in time) –From.
LO: Were learning to understand how logic applies to us when building applications.
Logic Gates Some Most All Learning Objective
Chapter #8: Finite State Machine Design 8
Guidelines for Field Veterinarians and Para-professionals on the Surveillance of Avian Influenza KOIKE I. (Technical Consultant) 2007.
EMS1EP Lecture 9 Analog to Digital Conversion (ADC) Dr. Robert Ross.
ENGG1100 Ch6: Introduction To Engineering Design (Digital Logic) Part 2 of digital logic KH WONG ENGG1100. Ch6-Digital Logic (part2) v3h1.
Programming with Ladder Logic
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Engineering H193 - Team Project Gateway Engineering Education Coalition P. 1 Spring Quarter 2007 Guidelines for Flow Charts and Pseudocode Week 5 Day 1.
ENGG1100 Lecture 6: Introduction To Engineering Design (Digital Logic) Part 1 Kin Hong Wong ENGG1100. Ch6-Digital Logic (Part1) 25/2/14 1.
LEGO WeDo: The science and engineering of robotics Teacher: Ms. Andersen Assistant: Ms. Ferris Your name: ________________________________.
ENGG1100 Lecture7: Introduction To Engineering Design (Digital Logic) Part 2 Kin Hong Wong ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 1.
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.
Program ultrasonic range sensor in autonomous mode
// This is a simple control program Move forward 200 units Turn right 90 Move forward 100 units Turn right 45 Move forward 100 Turn right 45 Move forward.
ERGM 1413 Programming and Playing with Intelligent Robots Prof. K.H. Wong Robot building v4.7b1.
Forging new generations of engineers
ENGG1100 Ch5: Introduction To Engineering Design (Digital Logic) Part 1 of digital logic KH WONG ENGG1100. Ch5-Digital Logic (v3e2)1.
Implementing software in IEC Languages in IEC IEC uses the following languages Instruction List – Assembly level programming using.
Overview of Project 3 Slides are available at : Updated 1/28 Due Date for project has been extended to next Friday 2/6.
Elegant avoiding of obstacle Young Joon Kim MSRDS First Beginner Course – STEP5.
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.
Unit 9 – “A BIG State Machine”. Introduction New Topics Nested Case Structures Reusable Code.
Basic Gates 1.1 Basic Digital Logic: AND, OR and NOT gates ©Paul Godin Created August 2007 Last Update Sept 2013.
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.
1 ENGG 1015 Tutorial Three Examples of Finite State Machines Supplementary notes Learning Objectives  Learn about Design of Finite State Machines Ack.:
ENG2410 Digital Design LAB #7 LAB #7 Sequential Logic Design “Sequence Recognizer” Using both Schematic Capture and VHDL.
The George Washington University Electrical & Computer Engineering Department Dr. S. Ahmadi Class 3.
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.
Vex Robotics Program Two: Using two motors. Program two: using the motors In the last section, you learned how to turn on one motor. Now, you will take.
Obstacle Detection. In the previous program the robot moves forward and then checks for something in the way. As we observed it only checks for things.
Vex Robotics program three: using motors and sensors together.
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.
Mealy Machines Finite State Machines with Outputs given on the transitions.
LOGICFUSION’S HANDS-ON ROBOTICS EV3 LEVEL 2! Welcome to.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
The Corridor Challenge
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
ECET 402 Help Bcome Exceptional / snaptutorial.com
Introduction Robotics Challenge
Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Evaluation in Engineering Design Process Modeling and FSM
Sensors and Logic Switches
M.VIKRAMADITYAN Graduate Student Mechanical Engineering
CSE 370 – Winter Sequential Logic-2 - 1
Introduction to Wiring Logic Gates
My first robot programming - Simple “GoTo”
Objectives Construct truth tables for the following logic gates:
Obstacle Detection.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Lecture 19 A bigger FSM example: Hungry Robot Ant in Maze.
Presentation transcript:

ENGG1100 Ch7: Introduction To Engineering Design (Digital Logic) Part 3 of digital logic KH WONG ENGG1100. Ch7-Digital Logic (part 3) v3h

Use a finite state machine to control the robot Part3 Use a finite state machine to control the robot ENGG1100. Ch7-Digital Logic (part 3) v3h

ENGG1100. Ch7-Digital Logic (part 3) v3h Overview Understanding finite state machines 3a) A simple finite state machine (no sensor) E.g.: The dancing robot 3b) An finite state machine uses 2 sensors E.g. The robot that follows the magnetic strip 3c) A finite state machine uses 3 sensors E.g. Follow the magnetic strip, find the CAN and stop ENGG1100. Ch7-Digital Logic (part 3) v3h

Understanding finite state machines Example of a door State Transition Transition condition Entry action http://en.wikipedia.org/wiki/State_diagram ENGG1100. Ch7-Digital Logic (part 3) v3h

ENGG1100. Ch7-Digital Logic (part 3) v3h 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: Transition: go to state 3 after 1 year State 3=Year 3: Transition: go to state 4 after 1 year State 4=Year 4: entry action: register 8 courses and Final_year_project Transition: go to stop after 1 year Stop: Graduation ENGG1100. Ch7-Digital Logic (part 3) v3h

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, stops and repeat the pattern again Video demo: http://youtu.be/iyakbVyoafI ENGG1100. Ch7-Digital Logic (part 3) v3h

ENGG1100. Ch7-Digital Logic (part 3) v3h Simple finite state machine for (3a) : No sensor input (no transition condition) Entry actions Transition 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 State1 State2 State3 State4 Start Flow diagram Baisc form ENGG1100. Ch7-Digital Logic (part 3) v3h

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 state=STATE3; //next state will be state3 // to be continued on next page Use of DELAY: DELAY_TIME=2000 motors(LM1,LM2,RM1,RM2,SPEED,SPEED,DELAY_TIME); Set motor to run forward with speed=200 System call to ask the motor to work Exercise: explain the meaning of state 2 ENGG1100. Ch7-Digital Logic (part 3) v3h

Continue from last page 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; state=STATE1; break; default: //none of above will be forced to run state4 } Exercises: explain the meaning of state 3 and 4 ENGG1100. Ch7-Digital Logic (part 3) v3h

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 3) v3h

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: Transition: if (study hard) promote to state3 (year3) else go back to state 2 State 3=Year 3: 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 3) v3h

Demo 3b) An finite state machine uses 2 sensors The robot can follow the magnetic strip Video Demo: http://youtu.be/NWHjWrq_VoY Please refer to the program of demo 3c, Demo 3b and demo3c are using the same program. ENGG1100. Ch7-Digital Logic (part 3) v3h

ENGG1100. Ch7-Digital Logic (part 3) v3h 3c) A finite state machine uses 3 sensors E.g. Follow the magnetic strip, find the CAN and stop Video Demo : http://youtu.be/JEQkuax7lKE The robot finds the CAN using the magnetic strip placed under the testing board and stops S2 S3 S1 Obstacle End point RM1,RM2 LM1,LM2 Start point ENGG1100. Ch7-Digital Logic (part 3) v3h

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

ENGG1100. Ch7-Digital Logic (part 3) v3h 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; if ( S3()==1 && S2()==1 && S1()=1 ) state=STATE1; //back to state 1 Move forward for 1 second If S3=0, a CAN is detected, next state is state4 Robot Deviated right, goto state 2 Robot Deviated left goto state 3 ENGG1100. Ch7-Digital Logic (part 3) v3h

ENGG1100. Ch7-Digital Logic (part 3) v3h case STATE3: //robot turns right LM1=1;LM2=0;RM1=0;RM2=0; SPEED=200;DELAY_TIME=10; motors(LM1,LM2,RM1,RM2,SPEED,DELAY_TIME); // if ( S3()==1 && S2()==1 && S1()=1 ) state=STATE1; else if(S3()==1 && S2()==1 && S1()=0) state=STATE2; else if((S3==0) || (S3()==1 && S2()==0 && S1()=0)) state=STATE4; break; case STATE4: //stop LM1=0;LM2=0;RM1=0;RM2=0; default: //none of above states state=STATE4; } If S3=0,a CAN is detected Next state is state4 State4 is the stop state, the robot stops ENGG1100. Ch7-Digital Logic (part 3) v3h

ENGG1100. Ch7-Digital Logic (part 3) v3h Summary In digital logic part 1,2 & 3, we learned What is digital logic Digital logic operations represented by Digital logic formula method Truth table method Their implementation methods using programs Final state machines Theory and implementations Use the above to control a robot for specific tasks ENGG1100. Ch7-Digital Logic (part 3) v3h

ENGG1100. Ch7-Digital Logic (part 3) v3h End ENGG1100. Ch7-Digital Logic (part 3) v3h