Robocon 2007 Electronics Quickstart Session 1 Hello Microcontroller
Robocon 2007 Electronics Quickstart! Session 1 Hello! Microcontroller. Prepared by KI Chi Keung [chikeung@ust. hk] WONG Long Sing (Sam) [sam@hellosam. net] Robocon 2007, Hong Kong University of Science & Technology
Today’s Timeline 1. 2. 3. 4. 5. Game Introduction Microcontroller Training Board Development Tools LED, Buzzer and Button Robocon 2007, HKUST
Game Introduction • Manual Machine • Auto Machine Robocon 2007, HKUST
Game Introduction • Output Device – – RC Servo Motor DC Motor Valve Control LCD • Input Device – Joypad (Playstation Controller) – Button – Sensor Robocon 2007, HKUST
Microcontroller The brain of the machine. Why not PC? • Efficiency – Space – Weight – Energy • Direct Control – Discrete Logic – Timing Robocon 2007, HKUST
Microcontroller MCU is • CPU + • Memory (RAM) + • Storage (Flash & EEPROM) + • Handy hardware module for – Communication – Common but hard to code function like Timer Robocon 2007, HKUST
Microcontroller We mainly use • ATMega 128 (Model Number), • which is a 8 -bit AVR MCU (Architecture), • By Atmel (Manufacturer) But then how to use? Read the specification! Robocon 2007, HKUST
Microcontroller Basic about CPU • Run instructions in discrete time defined in the spec. • Run sequentially, non-stop, 24 x 7…if working condition is met. • It does not know about time. The ultimate time source is the Crystal Oscillator. (Basically apply to all IC) Robocon 2007, HKUST
Microcontroller • Every CPU runs machine code • Machine code can be generated from assembly code • Assembly code can be generated from high level language • We use C to code our MCU Robocon 2007, HKUST
Microcontroller • Your program will be the only program running on the chip. There is no OS. • No OS means there is no hardware driver. • Which basically implies printf is not available. • How debug is done? Robocon 2007, HKUST
Training Board IO and Peripherals MCU Power Robocon 2007, HKUST
Software Development • Loading the first program. • C Compiler • Flashing a new program Robocon 2007, HKUST
LED, Buzzer and Button Robocon 2007, HKUST
- Slides: 13