To the USB programmer scheme there were added 2x LEDs and 2x resistors. LEDs are not connected same way - to demonstrate options how you could do it.
Figure 1: PIC18F2550 LED blinker scheme
There are used pins RB6 and RB7 of PIC to control attached LEDs. In a very simple code there is same signal brought into RB6, RB7. But LED will light in opposite - when one is lighting, other one is not.
As a starting point I have used application template compatible with another USB HID bootloader. I have modified all necessary places to change start points from 0x1100 to 0x1000 so it will work with Microchip's USB HID bootloader.
Core part of code is port definition section:
#define LED1 LATBbits.LATB6
#define LED2 LATBbits.LATB7
and execution part:
LED1=1; //simple LED Blinking
LED2=1; //simple LED Blinking
To compile code I have used:
Archive PIC18F2550 Application template package.zip contains:
If you found these information useful, please consider to:
This will allow me to bring more interesting projects for you.
© 2013, Radoslav Kastiel