Testing USB Powered PIC18LFXXXX

by Dan Peirce

Translated from dokuwiki July 20, 2013

Table of Contents

Regulator Board

The USB regulator board purchased from Mouser comes preassembled except for the voltage supply pins. The board comes with a three pin breakaway header. I broke off one pin so that the other two could be inserted into the 3.3 volt and ground holes on the regulator board (the unregulated 5V pad/hole left empty). This way the two pins of the header then fit into the power rails of the breadboard. I added jumpers to the solderless breadboard to join the two positive power rails together and to joint the two negative rails together. I also inserted jumpers to the power pins of the PIC IC.

Programming Header

Five wires were used on the programming header. In APSC1299 we only use four wires but I felt it would be better if the students could read the voltage supplied to the PIC in MPlab. The extra wire is for Vdd which lets the PIC read this voltage. Power should be applied to the regulated board before connecting the PICkit2 (otherwise the PICkit2 will not detect the 3.3 volts from the regulator and may attempt to supply 5 volts to the board).

For testing I used the blinkD0.c file from lab3 of APSC1299. The only change required was to explicidly turn off the Brown Out Reset Enable. In the image below both the MPlab IDE output window and some of the BLINK_D0.c code can be seen.


As with the original program the PIC is left at the default internal clock frequency. At 3.3V this MCU should not be clocked at more than 16 MHz.


I have also purchased some PIC18LF2620 MCUs. I believe we do not actually require all the pins available on the PIC18LF4525. The PIC18LF2620 is the same in most respects but it only has 28 pins rather than 40 and comes in a package that is half as wide.

Differences between the PIC18LF4525 and The PIC18LF2620.

PIC18LF4525 compared to PIC18LF2620
PIC18LF4525 PIC18LF2620
Has D portNo D Port
Program Memory 48KBytesProgram Memory 64KBytes
ADC 13 chADC 10 ch
two Vdd pinsonly one Vdd pin
40 pins28 pins
0.6 inch wide DIP0.3 inch wide PIC

For testing I used the blinkD0.c file from the PIC18LF4525 project.

  1. Changed the file name to blinkB0.c

  2. Changed all references to the D port to the B port.

  3. included p18f2620 rather than p18f4525

Changes to wiring

  1. Popped the PIC18LF4525 out of the breadboard and popped the PIC18LF2620 in.

  2. Moved a ground wire from pin 12 to pin 8 (on the other side of the chip the power and ground did not need to be moved even though the designation of the pins are different they are the same distance from the top of the IC).

  3. Removed a Vdd wire (only one used on the PIC18LF2620)

  4. Moved the LED over to B0 (pin 21).

The Progamming adaptor wiring is the same as the PIC18LF4525.

Parts for Physics1600