300 likes | 522 Vues
Embedded Systems. Introduction to Circuit Design. Hardware/Circuit Design. You won’t be a circuit designer upon completion of this class You will [hopefully] become comfortable working around hardware circuits This is how software engineers become circuit designers, albeit sometimes bad ones
E N D
Embedded Systems Introduction to Circuit Design CSC522
Hardware/Circuit Design • You won’t be a circuit designer upon completion of this class • You will [hopefully] become comfortable working around hardware circuits • This is how software engineers become circuit designers, albeit sometimes bad ones • More often than not, we become system integrators • Conversely, working with software is how hardware engineers become programmers, albeit sometimes bad ones • We will consider the basics CSC522
Hardware/Software Integration • We will be studying hardware/software integration using the Basic Stamp development board CSC522
The Basics (no pun intended) CSC522
Electo-Static Discharge (ESD) • Static electricity • It’s the shock you get when rubbing your feet across the carpet then touching the person next to you • It can destroy electronic components • Ideally we work with hardware in a static safe lab – we are not working in an ideal situation here • Therefore, prior to working with hardware you should touch a metal, grounded object prior to touching the hardware CSC522
Power • Make sure the power is OFF (unplugged) when you are putting components onto the board!!! • Check your work carefully prior to supplying power to the board CSC522
Supply Voltage • Vdd – equivalent to the “+” terminal of a battery (Voltage Drain Drain) • Vss – equivalent to the “-” terminal of a battery (Voltage Source Source) CSC522
Solderless Breadboard(Proto Board) • This is used to create circuits without having to solder parts or have special boards manufactured, thus the name • Used for prototyping circuits, thus the alternate name • Rows on either side of the vertical center are connected together and thus are considered a SINGLE connection CSC522
These 5 holes are connected together Solderless Breadboard(Proto Board) CSC522
Resistor • Resists the flow of electrical current • Some components don’t like a lot of electrical current • Creates a voltage drop across the resistor • Ohm’s Law: V = IR • Amount of resistance is specified in ohms, “Ω” • Resistors come in many values • Two leads (legs) • Resistors are bidirectional • It doesn’t matter which way you insert them into the circuit CSC522
First 3 color bands represent the value in ohms Last color band represents the accuracy in percentage 470 Ω Resistor Schematic symbol See: http://www.ealnet.com/m-eal/resistor/resistor.htm CSC522
Light Emitting Diode (LED) • One way current valve • Important to insert them in the proper direction • Color means nothing in terms of circuit connection • Two leads (legs) • Anode (labeled “+”) • Cathode CSC522
Cathode Anode + Light Emitting Diode (LED) Schematic symbol CSC522
Push Button • Simple input device • Four leads (legs) CSC522
1 4 2 3 1,2 3,4 1,3 2,4 1,4 2,3 Push Button When not pressed, 1 is connected to 4 and 2 is connected to 3 When pressed, the 1 is connected to 2 and 3, and 4 is connected to 2 and 3 Schematic symbol CSC522
Speaker Piezoelectric Speaker (beeper) Schematic symbol CSC522
Activity • Create a [very] simple circuit (see next slide) • DO NOT APPLY POWER UNTIL YOU ARE DONE CONNECTING UP THE CIRCUIT!!! • This one requires no software • Board have a 3-way power switch • Position 0 – off • Position 1 – on but only to circuits • Position 2 – on to circuits and servo drivers CSC522
A Simple Circuit Vdd Vss 470 Ω One lead from each component plugged into same row CSC522
Ice Breaker • Build the following three circuits on the proto-board CSC522
Vdd Vss 470 Ω Vdd Vss 470 Ω 1,4 2,3 Vdd 1,4 2,3 Vss 470 Ω Ice Breaker Circuits/No Code CSC522
Circuits and Code P9 Vss 470 Ω HIGH 9 PAUSE 2500 LOW 9 CSC522
1,4 2,3 Circuits and Code Vdd P9 220 Ω 10k Ω DO DEBUG ? IN9 PAUSE 250 LOOP btnpin VAR Byte btnwrk VAR Byte btnpin = 9 Main: PAUSE 5 BUTTON btnpin, 0, 200, 20, btnwrk, 0, No_Press DEBUG "*" No_Press: GOTO Main Vss CSC522
Circuits and Code P9 FREQOUT 9, 1500, 2000 Vss CSC522
Development Environment • The Basic integrated development environment (IDE) has been installed on all computers • Parallax group in Start menu • If you are doing this at home (or laptop) you should download the latest Basic Stamp IDE from www.parallax.com CSC522
Assignment – The “wordy” version • Two buttons (call them B1 and B2) • Three LEDs,1 yellow, 1 red, 1 green (call them Y, R, and G) • System specification • Start in “home position” • LEDs off • Press B1 one time • Press B2 one time – flash Y slow • Press B2 two times in succession – flash Y medium • Press B2 three times in succession – flash Y fast • Press B1 – return to “home position” • Press B1 two times in succession • Press B2 one time – flash R slow • Press B2 two times in succession – flash R medium • Press B2 three times in succession – flash R fast • Press B1 – return to “home position” • Press B1 three times in succession • Press B2 one time – flash G slow • Press B2 two times in succession – flash G medium • Press B2 three times in succession – flash G fast • Press B1 – return to “home position” • Press B1 four times in succession • Press B2 one time – flash LEDs in order Y-R-G-Y-R-G-… • Press B2 two times in succession – flash LEDs in order G-R-Y-G-R-Y-… • Press B1 – return to “home positin”
Notes • “one time”, “two times”, “three times” means button presses in “rapid” succession • So for example • <home - all LEDs off>, B1 <pause>, B2-B2 <pause>, <Y flashes at medium speed>, B1, <home - all LEDs off> • <home - all LEDs off>, B1-B1-B1 <pause>, B2 <pause>, <G flashes at slow speed>, B2 <nothing changes – G continues to flash at slow speed>, B1, <home - all LEDs off>
Deliverables • A state-machine diagram depicting the operation of the system • Source code • A schematic diagram of the circuit • A working demonstration on the Basic Stamp development board (in class)