What is a Microcontroller (Paralax, v2.2, student guide, 2004)
.pdfPage 316 · What’s a Microcontroller?
Figure E-1
Identification Window
Example: BASIC Stamp 2 not found on COM ports.
√Close the Identification Window.
√Make sure the serial cable is properly connected.
√Try the Run → Identify test again.
√If you know the number of the COM port, but it does not appear in the Identification Window, use the Edit Port List button to add that COM port, and then try the Run → Identify test again.
√If you have more than one COM port, try connecting your Board of Education or BASIC Stamp HomeWork Board to a different COM port and see if Run → Identify works then.
√If you have a second computer, try it on the different computer.
If you get the error message “No BASIC Stamp Found” but the Run → Identify test shows a “Yes” in both columns for one of the COM ports, you may need to change a setting to your FIFO Buffers. This is happens occasionally with Microsoft Windows® 98 and XP users. Make a note of the COM port with the “Yes” messages, and try this:
Windows® 98:
√Click on your computer desktop’s Start button.
√Select Settings→ Control Panel → System → Device Manager → Ports (COM & LPT).
√Select the COM port that was noted by the Run → Identify test.
√Select Properties → Port Settings → Advanced.
√Uncheck the box labeled “Use FIFO Buffers” then click OK.
√Click OK as needed to close each window and return to the BASIC Stamp Editor.
√Try downloading a program once more.
Windows® 2000:
√Click on your computer desktop’s Start button.
Appendix E: Trouble-Shooting · Page 317
√Select Settings → Control Panel → System → Hardware → Device Manager → Ports (COM & LPT).
√Select the COM port that was noted by the Run → Identify test.
√Select → Port Settings → Advanced.
√Uncheck the box labeled “Use FIFO Buffers” then click OK.
√Click OK as needed to close each window and return to the BASIC Stamp Editor.
√Try downloading a program once more.
Windows® XP:
√Click on your computer desktop’s Start button.
√Select Control Panel → Printers and Other Hardware.
√In the “See Also” box select System.
√Select Hardware → Device Manager → Ports.
√Enter the COM port number noted by the Run→ Identify test.
√Select Port Settings → Advanced.
√Uncheck the box labeled “Use FIFO Buffers” then click OK.
√Click OK to close each window as needed and return to the BASIC Stamp Editor.
√Try downloading a program once more.
Windows® XP Pro:
√Click on your computer desktop’s Start button.
√Select Control Panel → System → Hardware → Device Manager → Ports(COM & LPT1).
√Select the Communications Port number noted by the Run → Identify test.
√Select Properties → Port Settings → Advanced.
√Uncheck the box labeled “Use FIFO Buffers” then click OK.
√Click OK to close each window as needed and return to the BASIC Stamp Editor.
√Try downloading a program once more.
If none of these solutions work, you may go to www.parallax.com and follow the Support link. Or, email support@parallax.com or call Tech Support toll free at 1-888-99-STAMP.
Appendix F: More about Electricity · Page 319
Appendix F: More about Electricity
What’s an Electron? An electron is one of the three fundamental parts of an atom; the other two are the proton and the neutron. One or more protons and neutrons stick together in the center of the molecule in an area called the nucleus. Electrons are very small in comparison to protons and neutrons, and they orbit around the nucleus. Electrons repel each other, and electrons and protons attract to each other.
What’s Charge? The tendency for an electron to repel from another electron and attract to a nearby proton is called negative charge. The tendency for a proton to repel from another proton and attract an electron is called positive charge. When a molecule has more electrons than protons, it is said to be negatively charged. If a molecule has fewer electrons than protons, it is said to be positively charged. If a molecule has the same number of protons and electrons, it is called neutrally charged.
What’s Voltage? Voltage is like electrical pressure. When a negatively charged molecule is near a positively charged molecule, the extra electron on the negatively charged molecule tries to get from the negatively charged molecule to the positively charged molecule. Batteries keep a compound with negatively charged molecules separated from a compound with positively charged molecules. Each of these compounds is connected to one of the battery’s terminals; the positively charged compound is connected to the positive (+) terminal, and the negative compound is connected to the negative (-) terminal.
The volt is a measurement of electric pressure, and it’s abbreviated with a capital V. You may already be familiar with the nine volt (9 V) battery used to supply power to the Board of Education or HomeWork Board. Other common batteries include the 12 V batteries found in cars and the 1.5 V AA batteries used in calculators, handheld games, and other devices.
What’s Current? Current is a measure of the number of electrons per second passing through a circuit. Sometimes the molecules bond in a chemical reaction that creates a compound (that is neutrally charged). Other times, the electron leaves the negatively charged molecule and joins the positively charged molecule by passing though a circuit like the one you just built and tested. The letter most commonly used to refer to current in schematics and books is capital ‘I’.
What’s an amp? An amp is the basic unit of current, and the notation for the amp is the capital ‘A’. Compared to the circuits you are using with the BASIC Stamp, an amp is a very large amount of current. It’s a convenient value for describing the amount of current that a car battery supplies to headlights, the fan that cool a car’s engine, and other high power devices.
What’s Resistance? Resistance is the element in a circuit that slows down the flow of electrons (the current) from a battery’s negative terminal to its positive terminal.
The ohm is the basic measurement of resistance. It has already been introduced and it’s abbreviated with the Greek letter omega (Ω).
What’s a Conductor? Copper wire has almost no resistance, and it’s called a conductor.
Page 320 · What’s a Microcontroller?
BONUS ACTIVITY: OHMS LAW, VOLTAGE, AND CURRENT
This activity applies some of the definitions just discussed.
Ohm’s Law Parts
(1) |
Resistor – 220 |
Ω (red-red-brown) |
|
(1) |
Resistor – 470 |
Ω (yellow-violet-brown) |
|
(1) |
Resistor – 1 kΩ |
(brown-black-red) |
|
(1) |
Resistor – 2 kΩ |
(red-black-red) |
|
(1) |
LED – any color |
Test Circuit
The resistance value of Ri in Figure F-1 can be changed. Lower resistance allows more current through the LED, and it glows more brightly. Higher resistance values will cause the LED to look dim because they do not allow as much current to pass through the circuit.
√Disconnect power to your Board of Education or HomeWork Board whenever you modify the circuit.
√Build the circuit shown starting with a 220 Ω resistor.
√Modify the circuit by replacing the 220 Ω resistor with a 470 Ω resistor. Was the LED less bright?
√Repeat using the 1 kΩ resistor, then the 2 kΩ resistor, checking the change in brightness each time.
Appendix F: More about Electricity · Page 321
|
|
|
Vdd |
Vin |
Vss |
Vdd |
|
|
X3 |
|
+ |
R1 |
R2 R3 R4 |
P15 |
|
||
|
|
|
|||
|
|
|
P14 |
|
|
|
|
|
P13 |
|
|
|
Ri |
|
P12 |
|
Figure F-1 |
|
|
P11 |
|
||
|
|
|
P10 |
|
LED Current Monitor |
|
|
|
P9 |
|
|
|
|
R1 = 220 Ω |
P8 |
|
|
|
LED |
P7 |
|
|
|
|
R2 = 470 Ω |
|
|
||
|
P6 |
|
|
||
|
|
R3 = 1 kΩ |
P5 |
|
|
|
|
R4 = 2 kΩ |
P4 |
|
|
|
|
P3 |
|
|
|
Vss |
|
|
P2 |
|
|
|
|
P1 |
|
|
|
|
|
|
P0 |
|
|
X2
If you are using a 9 V battery, you can also compare the brightness of a different voltage source, Vin. Vin is connected directly to the 9 V battery’s + terminal, and Vss is connected directly to the battery’s negative terminal. Vdd is called regulated 5 V. That’s about half the voltage of the 9 V battery.
√If you are not using a 9 V battery, stop here and skip to the Calculating the Current section below. Otherwise, continue.
√Start with the circuit shown in Figure F-1, but use a 1 kΩ resistor.
√Make a note of how bright the LED is.
√Disconnect power
√Modify the circuit by disconnecting the resistor lead from Vdd and plugging it into Vin.
√When you plug the power back in, is the LED brighter? How much brighter?
DO NOT try the Vin experiment with a 220 or 470 Ω resistor, it will supply the LED with more current than it is rated for.
Calculating the Current
The BASIC Stamp Manual has some rules about how much current it can supply to circuits. If you don’t follow these rules, you may end up damaging your BASIC Stamp.
Page 322 · What’s a Microcontroller?
The rules have to do with how much current an I/O pin is allowed to deliver and how much current a group of I/O pins is allowed to deliver.
Current Rules for BASIC Stamp I/O Pins
•An I/O pin can “source” 20 mA. In other words, if you send the HIGH signal to an I/O pin, it should not supply the LED circuit with more than 20 mA.
•If you rewire the LED circuit so that the BASIC Stamp makes the LED turn on when you send the LOW command, an I/O pin can “sink” up to 25 mA.
•P0 through P7 can only source up to 20 mA. Likewise with P8 through P15. If you have lots of LED circuits, you will need larger resistors so that you don’t draw too much current.
If you know how to calculate how much current your circuit will use, then you can decide if it’s OK to make your LEDs glow that brightly. Every electronic component has rules for what it does with voltage, resistance, and current. For the light emitting diode, the rule is a value called the diode forward voltage. For the resistor, the rule is called Ohm’s Law. You need to figure out how much current your LED circuit is using. There are also rules for how current and voltage add up in circuits. These are called Kirchoff’s Voltage and Current Laws.
Appendix F: More about Electricity · Page 323
Vdd – Vss = 5 V The voltage (electrical pressure) from Vdd to Vss is 5 V. This is called regulated voltage, and it works about the same as a battery that is exactly 5 V.
Vin – Vss = 9 V If you are using 9 V battery, the voltage from Vin to Vss is 9 V. Be careful. If you are using a voltage regulator that plugs into the wall, even if it says 9 V, it could go as high as 18 V.
Ground and/or reference refer to the negative terminal of a circuit. When it comes to the BASIC Stamp and Board of Education, Vss is considered the ground reference. It is zero volts, and if you are using a 9 V battery, it is that battery’s negative terminal. The battery’s positive terminal is 9 V. Vdd is 5 V (above the Vss reference of 0 V), and it is a special voltage made by a voltage regulator chip to supply the BASIC Stamp with power.
Ohm’s Law: V = I × R The voltage measured across a resistor’s terminals (V) equals the current passing through the resistor (I) times the resistor’s resistance (R).
Diode Forward Voltage: When an LED is emitting light, the voltage measured from anode to cathode will be around 1.6 V. Regardless of whether the current passing through it is a large or a small value, the voltage will continue to be approximately 1.6 V.
Kirchoff’s Voltage Law Simplified: voltage used equals voltage supplied. If you supply a circuit with 5 V, the number of volts all the parts use had better add up to 5 V.
Kirchoff’s Current Law Simplified: current in equals current out. The current that enters an LED circuit from Vdd is the same amount of current that leaves it through Vss. Also, if you connect three LEDs to the BASIC Stamp, and each LED circuit draws 5 mA, it means the BASIC Stamp has to supply all the circuits with a total of 15 mA.
Example Calculation: One Circuit, Two Circuits
Calculating how much current an LED circuit draws takes two steps:
1.Figure out the voltage across the resistor
2.Use Ohm’s Law to figure out the current through the resistor.
Figure F-2 shows how to figure out the voltage across the resistor. The voltage supplied is on the left; it’s 5 V. The voltages used are on the right. The voltage we don’t know at the start is VR, the voltage across the resistor. But, we do know that the voltage across the LED is 1.6 V (the diode forward voltage). We also know that the voltage across the parts has to add up to 5 V because of Kirchoff’s Voltage Law. The difference between 5 V and 1.6 V is 3.4 V, so that must be the voltage across the resistor VR.
|
|
|
|
Appendix F: More about Electricity · Page 325 |
|
|
|
|
V = I × R |
|
|
|
|
|
3.4V = I × 470Ω |
||
|
|
|
I = |
3.4V |
|
|
|
|
|
||
+ |
|
|
I = |
470Ω |
Figure F-3 |
|
|||||
3.4 V |
I X 470 Ω |
0.00723 |
Ω Current through |
||
|
|
V |
the Resistor |
||
- |
|
|
I = |
0.00723A |
|
|
|
||||
|
|
|
|||
|
|
|
I = |
7.23 A |
|
|
|
|
|
||
|
|
|
|
1000 |
|
I = 7.23mA
Yes, it’s true ! 1 A = 1 V/Ω (One amp is one volt per ohm).
Let’s say you turned two LEDs on at the same time. That means that inside the BASIC Stamp, it is supplying the circuits as shown in Figure F-4. Have we exceeded the 20 mA limit? Let’s find out. Remember that the simplified version of Kirchoff’s Current Law says that the total current drawn from the supply equals the current supplied to all the circuits. That means that I in Figure F-4 has to equal the total of the two currents being drawn. Simply add the two current draws, and you’ll get an answer of 14.5 mA. You are still under the 20 mA limit, so your circuit is a safe design.
|
|
|
|
|
|
|
|
Vdd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I = ? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I = I1 + I2 + ...Ii |
Figure F-4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Total Current |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
7.23 mA |
|
|
|
|
|
|
470 Ω |
7.23 mA |
|
|
|
|
|
|
470 Ω |
I = 7.23mA + 7.23mA |
Supplied to |
|
|
|
|
|
|
|
|
|
|
|
|
|
I = 14.5mA |
Two LED |
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Circuits |
|
|
|
|
|
|
|
LED |
|
|
|
|
|
|
|
|
LED |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
Vss |
|
|
Vss |
|
|
Page 326 · What’s a Microcontroller?
Your Turn – Modifying the Circuit
√Repeat the exercise in Figure F-2, but use Vin – Vss = 9V. The answer is VR = 7.4 V
√Repeat the exercise in Figure F-3, but use a 1 kΩ resistor. Answer: I = 3.4 mA.
√Use VR = 7.4 V to do the exercise in Figure F-3 with a 1 kΩ resistor. Answer: I = 7.4 mA.
√Repeat the exercise shown in Figure F-4 with one of the resistors at 470 Ω and the other at 1 kΩ. Answer: I = 7.23 mA + 3.4 mA = 10.63 mA.