打印

外文翻译

[复制链接]
1666|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
samplertape|  楼主 | 2013-5-27 22:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ST, AN, TI, se, pi
Chapter 2: Microcontrollers
A microcontroller is an integrated circuit (IC) that is programmable. When you turn on the power to the microcontroller it goes through a series of commands. These commands are put in the chip by you. You can make it do different things by changing the commands (usually called the program). To change the commands you need a device like the PG302. The PG302 lets you download the program from your computer to the microcontroller. This chapter will show you some simple programs and how to download those to
2.0.1The 555 Timer
Creating a Pulse
The 555 is made out of simple transistors that are about the same as on / off switches. They do not have any sense of time. When you apply a voltage they turn on and when you take away the voltage they turn off. So by itself, the 555 can not create a pulse. The way the pulse is created is by using some components in a circuit attached to the 555 (see the circuit below). This circuit is made of a capacitor and a resistor. We can flip a switch and start charging the capacitor. The resistor is used to control how fast the capacitor charges. The bigger the resistance, the longer it takes to charge the capacitor. The voltage in the capacitor can then be used as an input to another switch. Since the voltage starts at 0, nothing happens to the second switch. But eventually the capacitor will charge up to some point where the second switch comes on.
The way the 555 timer works is that when you flip the first switch, the Output pin goes to Vcc (the positive power supply voltage) and starts charging the capacitor. When the capacitor voltage gets to 2/3 Vcc (that is Vcc * 2/3) the second switch turns on which makes the output go to 0 volts.
The pinout for the 555 timer is shown below

Deep Details
Pin 2 (Trigger) is the 'on' switch for the pulse. The line over the word Trigger tells us that the voltage levels are the opposite of what you would normally expect. To turn the switch on you apply 0 volts to pin 2. The technical term for this opposite behavior is 'Active Low'. It is common to see this 'Active Low' behavior for IC inputs because of the inverting nature of transistor circuits like we saw in the LED and Transistor Tutorial.
Pin 6 is the off switch for the pulse. We connect the positive side of the capacitor to this pin and the negative side of the capacitor to ground. When Pin 2 (Trigger) is at Vcc, the 555 holds Pin 7 at 0 volts (Note the inverted voltage). When Pin 2 goes to 0 volts, the 555 stops holding Pin 7 at 0 volts. Then the capacitor starts charging. The capacitor is charged through a resistor connected to Vcc. The current starts flowing into the capacitor, and the voltage in the capacitor starts to increase.
Pin 3 is the output (where the actual pulse comes out). The voltage on this pin starts at 0 volts. When 0 volts is applied to the trigger (Pin 2), the 555 puts out Vcc on Pin 3 and holds it at Vcc until Pin 6 reaches 2/3 of Vcc (that is Vcc * 2/3). Then the 555 pulls the voltage at Pin 3 to ground and you have created a pulse. (Again notice the inverting action.) The voltage on Pin 7 is also pulled to ground, connecting the capacitor to ground and discharging it.
Seeing the pulse
To see the pulse we will use an LED connected to the 555 output, Pin 3. When the output is 0 volts the LED will be off. When the output is Vcc the LED will be on.
Building the Circuit

Place the 555 across the middle line of the breadboard so that 4 pins are on one side and 4 pins are on the other side. (You may need to bend the pins in a little so they will go in the holes.) Leave the power disconnected until you finish building the circuit. The diagram above shows how the pins on the 555 are numbered. You can find pin 1 by looking for the half circle in the end of the chip. Sometimes instead of a half circle, there will be a dot or shallow hole by pin 1.
Before you start building the circuit, use jumper wires to connect the red and blue power rows to the red and blue power rows on the other side of the board. Then you will be able to easily reach Vcc and Ground lines from both sides of the board. (If the wires are too short, use two wires joined together in a row of holes for the positive power (Vcc) and two wires joined together in a different row of holes for the ground.)
Connect Pin 1 to ground.
Connect Pin 8 to Vcc.
Connect Pin 4 to Vcc.
Connect the positive leg of the LED to a 330 ohm resistor and connect the negative end of the LED to ground. Connect the other leg of the 330 ohm resistor to the output, Pin 3.
Connect Pin 7 to Vcc with a 10k resistor (RA = 10K).
Connect Pin 7 to Pin 6 with a jumper wire.
Connect Pin 6 to the positive leg of the 220uF Capacitor (C = 220uF). (You will need to bend the positive (long leg) up and out some so that the negative leg can go in the breadboard.
Connect the negative leg of the capacitor to ground.
Connect a wire to Pin 2 to use as the trigger. Start with Pin 2 connected to Vcc.
Now connect the power. The LED will come on and stay on for about 2 seconds. Remove the wire connected to Pin 2 from Vcc. You should be able to trigger the 555 again by touching the wire connected to pin 2 with your finger or by connecting it to ground and removing it. (It should be about a 2 second pulse.)
Making it Oscillate
Next we will make the LED flash continually without having to trigger it. We will hook up the 555 so that it triggers itself. The way this works is that we add in a resistor between the capacitor and the discharge pin, Pin 7. Now, the capacitor will charge up (through RA and RB) and when it reaches 2/3 Vcc, Pin 3 and Pin 7 will go to ground. But the capacitor can not discharge immediately because of RB. It takes some time for the charge to drain through RB. The more resistance RB has, the longer it takes to discharge. The time it takes to discharge the capacitor will be the time the LED is off.
To trigger the 555 again, we connect Pin 6 to the trigger (Pin 2). As the capacitor is discharging, the voltage in the capacitor gets lower and lower. When it gets down to 1/3 Vcc this triggers Pin 2 causing Pin 3 to go to Vcc and the LED to come on. The 555 disconnects Pin 7 from ground, and the capacitor starts to charge up again through RA and RB.

To build this circuit from the previous circuit, do the following.
Disconnect the power.
Take out the jumper wire between Pin 6 and Pin 7 and replace it with a 2.2k resistor (RB = 2.2K).
Use the jumper wire at pin 2 to connect Pin 2 to Pin 6.
Now reconnect the power and the LED should flash forever (as long as you pay your electricity bill).
Experiment with different resistor values of RA and RB to see how it changes the length of time that the LED flashes. (You are changing the amount of time that it takes for the Capacitor to charge and discharge.)
Formulas
These are the formulas we use for the 555 to control the length of the pulses.
t1 = charge time (how long the LED is on) = 0.693 * (RA + RB) * C
t2 = discharge time (how long the LED is off) = 0.693 * RB * C
T = period = t1 + t2 = 0.693 * (RA + 2*RB) * C
Frequency = 1 / T = 1.44 / ((RA + 2 * RB) * C)
t1 and t2 are the time in seconds. C is the capacitor value in Farads. 220uF = 0.000220 F. So for our circuit we have:
t1 = 0.693 * (10000 + 2200) * 0.000220 = 1.86 seconds
t2 = 0.693 * 2200 * 0.000220 = 0.335 seconds
T = 1.86 + 0.335 = 2.195 seconds
Frequency = 0.456 (cycles per second)


2.0.2 PG302 Setup

The Software CD contains a setup.exe file in the PG302 folder. Double click on this file to run it and follow the instructions.
(Click here to download the software from our website.)
There are two setup options that you may want to change at some point in the future. The first option is Auto Erase. In most situations you will want to leave this on so that the chip is erased before programming it with new code. The second option is Auto Verify. This option automatically verifies that the code was programmed correctly. If a chip has not been erased before programming, this option will find that error. Leave these options on while working through the projects in this chapter.
When programming a chip, insert it in the green socket so that pin 1 of the chip is in the same corner as the handle of the socket. The handle of the green socket should be in the up (open) position. Then lock the chip into the socket by pushing the handle down into the closed position.




相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝