Professional Documents
Culture Documents
5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
1 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
1. Connect the power/ground rails as shown in Figure 2. Use wires to strap all of the
rails together. Do not connect the power rails on the protoboard to the power post;
this post will be used for 9 V power from the wall transformer. The protoboard
ground rails should be tied to the ground power post.
2 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
2. Plug the power connector into the wall transformer jack and use the multimeter to
determine which two pins on the power connector provide +9 V and ground as shown
in Figure 3.
3 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
3. SOLDER wires to the power connector, and connect this to the power/ground posts
on the protoboard. Figure 4 shows a closeup look of the finished board from Figure
19 that shows how the power connector with wires is connected to the protoboard.
The GROUND post is connected to the ground rail, but the +9 V power post connects
to the input power switch.
DO NOT just “crimp” the wires onto the power connector; this will create an unreliable
connection. Please take the time to solder these wires.
4 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
4. Locate power switch, voltage regulator, and fuse in the parts kit as shown in Figure 5.
The switch makes/breaks a connection between the middle pin and the outer pin(s).
5 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
5. Place power switch, voltage regulator, and fuse on the board as shown in Figure 6.
6. Locate LED and 470 Ω resistor SIP (single in-line package) in your parts kit as
shown in Figure 7; use this for a power-on LED. (the SIP is marked as 471).
6 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
7. Place the power-on LED and the 470 Ω resistor SIP on the board as shown in Figure
8; the LED should turn on/off with the power switch. If it does not, try reversing the
orientation of the LED.
7 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
8. The reset pushbutton switch is shown in Figure 9; use the multimeter to determine the
pins that are shorted when the pushbutton is pressed. The other two pairs of pins are
permanently shorted together.
8 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
9. Figure 10 shows the Reset LED, PIC, 10 kΩ resistor SIP, and pushbutton switch
needed for reset circuit.
9 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
10. Figure 11 shows the placement of the PIC18F242 and the reset circuit on board. Note
that the PIC18F242 has two ground (VSS) connections. The decoupling capacitor
between VDD and VSS on the PIC18F242 should be placed DIRECTLY across the
VDD/VSS pins as shown in order for it to be effective. The decoupling capacitor is
POLARIZED, the ‘+’ lead must be connected to VDD. The decoupling capacitor is
very important as the PIC18F242 may operate erratically without it.
11. Figure 12 shows the crystal/ 15 pF capacitor components for the clock circuit; trim
the leads to reasonable lengths.
10 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
12. Figure 13 shows the crystal and capacitors placed on board; place these as close to the
PIC18F242 as you can. The PIC18F242 must be programmed with the ledflash
program before the crystal will oscillate; this sets the configuration bits to select the
correct oscillator configuration. Use an oscilloscope to verify that the crystal is
oscillating.
Figure 13. Crystal and capacitors for oscillator circuit placed on board
11 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
13. Figure 14 shows a typical crystal waveform on the external PIC18 OSC pins; this is
converted to a square wave clock signal within the PIC18.
12 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
14. Figure 15 shows the L2 LED added to board on port RB1 for the ledflash program.
The LED should blink when the PIC18F242 is programmed with the ledflash
program.
13 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
The remainder of this walk through hooks up the serial port connection using a DB9
connector and the MAX202/232 transceiver (16-pin DIP) or MAX 3222 (18-pin DIP).
See the textbook or Maxim datasheet for the detailed pinouts of the MAX 202/232 (the
MAX 202 uses external 0.1 µF capacitors, while the MAX 232 uses 1.0 µF capacitors)
and MAX3222 (uses external 0.1 capacitors and has two extra control inputs). The
MAX3222 is an 18-pin version of the MAX 232/202 that operates from 3.0V to 5.5 V, it
is pin compatible with the MAX 202/232 if you plug the MAX 202/232 into pins 2-17
(i.e. align the bottom of the MAX202/232 with the bottom of the MAX 3222). The two
extra pins on the MAX 3222 are pins 1, 18 (topmost left, right pins). Pin 1 is an EN#
input that should be tied to GND; pin 18 is a SHDN# (Shutdown) input that should be
tied to VDD. Your parts kit may contain either the MAX 202, MAX 232, or MAX3222.
14 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
15. Figure 17 shows the wirewrap tool with a wire stripper contained in the handle, use
this to wire from the DB9 connector to the 5 pin header in your parts kit.
15 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
16. The connection from the DB9 to the 5 pin header is shown in Figure 18. When wire
wrapping, do not let bare wire extend from the post; this will short on an adjacent
post and cause intermittent failures.
16 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
17. Figure 19 shows the DB9 connector and MAX 202/232 placed on board; see the lab
manual for additional details. The DB9 can be glued to the protoboard to form a solid
connection; if it is allow to flop around the wirewrap connections will eventually
break. Test this with the echo.c program.
17 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
18. Figure 20 shows a typical serial waveform from the PC; this is what enters the MAX
202/232. Note that the idle state is a negative voltage, typically about –9 V.
Figure 20. Serial character transmitted by PC to MAX 202/232 (RS232 logic levels)
18 of 19
R. Reese, September 2006/ V0.5
Supplement to Microprocessors: From Assembly to C with the PIC18Fxx2, Charles River Media 2005.
19. Figure 21 shows a serial transmission from the MAX 202/232 to the PIC18F242
using CMOS logic levels.
Figure 21. Serial transmission from MAX202/232 to PIC18 using CMOS logic levels
19 of 19