| Joel | People | Hobbies | Fun | Miscellaneous | |||||||||
|
The Basic PIC 16F84 Circuit
The basic PIC 16F84 circuit is depicted in this drawing. This circuit represents the minimum external components you will need. The 16F84 is in the center, the crystal resonator is the brownish colored component in the upper left corner and the rest are resistors (each are 10KΩ). The first thing you may notice is there are a lot of resistors. Most of the resistors are pull-up resistors on unused I/O pins. In a real circuit, these resistors would be replaced with some kind of load, an LED or an I/O pin on another logic chip perhaps. Since the 16F84 uses CMOS technology, it is important to connect unused I/O lines to Vdd through a pull-up resistor, otherwise the pins will "float". When you build your circuits, remove the pull-up resistors from any I/O pin you connect to other devices. Eight of these resistors are completely unnecessary since the 16F84 has internal pull-ups on the port B pins. These internal resistors are weak, but using them reduces the number of required external components considerably. You will need to activate the internal pull-ups in software.
The microprocessor is fully functional in this circuit. However, you won't know if it is doing anything since there are no I/O devices connected to it. Let's replace some of the pull-up resistors with LEDs so we can see something happening.
Adding I/O Devices to the Basic Circuit
Port A is a 5-bit I/O port (represented by pins 17, 18, 1, 2 and 3) and Port B is 8-bits wide (represented by pins 6, 7, 8, 9, 10, 11, 12 and 13). We are going to connect two LEDs to two of the pins on Port A. In this revised circuit, the pull-up resistors on pins 17 and 18 of the PIC have been replaced with two LEDs. If you want to connect additional LEDs, feel free. Pins 1,2 and 3 of the PIC are the remaining three I/O pins for Port A. Pin 4 is connected through a pull-up resistor in these diagrams making it look as though it were just another I/O pin. It is not. Pin 4 is the MCLR line. Notice the LEDs are connected to ground through 680Ω current-limiting resistors. In this configuration, a logic "1" on the I/O pin turns on the LED. This is intuitive, but the port lines source current with this arrangement. CMOS devices are better at sinking current than sourcing it. If the LEDs are connected to Vdd through the current limiting resistor, the port line will sink current. This means a logic "O" turns on the LED which is counter-intuitive. For experimenting purposes, you might want to stick with connecting your LEDs to ground. Just make sure you don't exceed the current ratings on the I/O pins. Consult the spec sheet for specifics. Where To Go From Here Of course, this circuit doesn't do anything on its own without a program loaded into the MCU. Use this basic circuit as a test platform to practice different programming tasks. You might want to use this circuit to learn such programming tasks as turning on and off the LEDs in a pattern, or get them to respond to inputs on the other I/O lines. 1 The connections for these other options are different than what is shown in this circuit. Also, you'll need to set the appropriate configuration bits at programming time.
|
||||||||
| Tell me what you think | Copyright © 2000 Joel T. Anderson | |