Appendix D

Interfacing The PIC18F4321 to a Personal Computer or a Laptop Using PICkit™ 3

Appendix D contains the procedure for how to download a compiled C-program (compiled using the MPLAB C18 compiler of Appendix C) from a personal computer or a laptop into the PIC18F4321's memory. Microchip's PICkit3 is used to accomplish this. The PIC18F4321 is contained on the breadboard. Note that the PIC18F4321-based hardware on the breadboard is designed and built by the designer for a specific application.

After successful downloading of the desired program, the PIC18F-based breadboard can be disconnected from the Personal computer or Laptop. The PIC18F4321 chip on the breadboard can then execute the programs downloaded into its memory upon activating the RESET pushbutton. Thus, the desired task can be accomplished.

Finally, for C programs to work with PIC18F4321 I/O, certain configuration commands are necessary. The following configuration commands should be inserted after #include <p18f4321.h>:

#pragma config OSC = INTIO2 // Select internal oscillator
#pragma config WDT = OFF // Watch Dog Timer OFF
#pragma config LVP = OFF // Low Voltage Programming OFF
#pragma config BOR = OFF // Brown On Reset OFF

Appendix D contains the following:

D.1 INITIAL HARDWARE SETUP FOR THE PIC18F4321
D.2 CONNECTING THE PERSONAL COMPUTER (PC) OR THE LAPTOP TO THE PIC18F4321 VIA PICkit™ 3
D.3 PROGRAMMING THE PIC18F4321 FROM A PERSONAL COMPUTER OR THE LAPTOP USING PICkit™3

D.1 Initial Hardware ...

Get Fundamentals of Digital Logic and Microcontrollers, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.