Lukas PHOTO Tutorial
п»їPIC 16F877A Tutorials for Pitt Robotics Club
Lukas Hoffmann, 2010
These lessons demonstrate how to code simple input & output to your robot making use of the popular PICTURE 16F877A microcontroller. They help you to get your receptors & power generators working. Other code is up to you!
Questions? Visit our website: http://www.pitt.edu/~sorc/robotics/ Email: [email protected] com
The tutorials presume basic understanding of programming and electronics. In case you are new to programming, you should understand basics of C or C++. Recognize an attack know rudimentary electronics, as well as how to construct simple circuits.
I acquired most of this information from the PIC MCU Compiler reference manual & the help of other golf club members. You are invited to edit or perhaps add new lessons. Please email the golf club if you generate another training.
Introduction to the PIC16F877A
How to hook up the PIC therefore it will manage?
twenty Megahertz crystal oscillator
2 7-20pf capacitor
Black & red cables
> several. 2 volt battery
For use with a higher ac electricity supply, you will need to use a voltage regulator to convert the larger voltage to 5v. Typically a 7805 is used. Check out the datasheet by looking Google " 7805 voltage regulatorвЂќ.
Understand what know how these materials function or the actual look like, appear it up on the net.
1 . Insert PIC on breadboard. Refer to pin diagram over for pin number numbers. To avoid confusion, navigate the PICTURE so the dimple on top encounters the same way while the pin diagram. installment payments on your Connect breadboard side whitening strips - capacity to power (red strips), surface to ground (black strips). Just like the lower part 2 wire connections below. Individuals strips have become referred to as " powerвЂќ & " groundвЂќ.
3. Power to Pin you (Vpp) вЂ“ red cable (connected by way of 47k Resistor in between) 4. Capacity to Pin 10 (Vdd) вЂ“ red cable
5. Surface to Pin number 12 (Vss) вЂ“ dark-colored wire
6. Power to Pin number 32 (Vdd) вЂ“ red wire
several. Ground to Pin thirty-one (Vss) вЂ“ black line
8. Ravenscroft Oscillator to Pins 13 & 14 (OSC1, OSC2), the polarity doesn't matter. (polarity sama dengan which in the 2 wire connections goes in which hole). 9. Capacitor into power & ground вЂ“ make sure the polarity is correct based on the datasheet pertaining to the capacitor. If not it could destruction the outlet. 10. Earth to battery ground (-) вЂ“ dark-colored wire.
11. Power (red) to electric batteries (+) вЂ“ red line. Or, solder that wire to a change & manage another wire from the in order to battery power, so you can switch the power on & off.
If perhaps using ac electricity regulator:
organic battery power cable goes into volts regulator insight
breadboard earth strip visits battery ground
voltage limiter output wire (+5 volts) goes to breadboard power tape. voltage limiter ground wire goes to breadboard ground strip
What do the pins imply?
The pins RB0-RB7, RC0-RC7, and RD0-RD7 are digital I/O hooks. The buy-ins CCP1 and CCP2, which usually share locations with RC1 and RC2, can be used for a PWM sign (see DC Motor tutorial). The pins AN0-AN7 will be for analog I/O (see Photoresistor tutorial). TX and RX happen to be for debugging I/O (see Output Communications to Pc tutorial). The pins cope with power/ground, the clock signal, and programmer I/O.
A PIC is made of a lot of " jacks. вЂќ Each port is designated with a letter, RB0-RB7 are a dock. RC0-RC7 and RD0-RD7 are a port too. RA0-RA5 and RE0-RE2 are usually ports, but with fewer buy-ins. Some of these hooks have special purposes, yet most works extremely well as fundamental input/output buy-ins.
For example , you can set flag RB0 being either an input pin number, or an output flag. As an input flag, the digital voltage around the pin may be read in. For example , in the event RB0 is connected to earth (0v), then you certainly would go through a digital zero. If RB0 was connected to power (5v), then you could read an electronic 1 . On the other hand, if you planned to set RBO as an output flag, you could tend to make RB0 either always be 5v, or perhaps 0v. This could be used, for example , to turn away or on the LED, in order to turn off or on a motor.
How to program the PHOTO?
I leave out...