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.  PIC18F2550 LED blinker scheme

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.  PIC18F2550 LED blinker on experiment solderless breadboard in action

Figure 2: PIC18F2550 LED blinker on experiment solderless breadboard in action

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:

main.c
#define LED1     LATBbits.LATB6
#define LED2     LATBbits.LATB7

and execution part:

main.c
void main(void)
{
     //init TRIS
     TRISBbits.TRISB4=0;
     TRISBbits.TRISB5=0;
     TRISBbits.TRISB6=0;
     TRISBbits.TRISB7=0;
     //infinity loop
     while(1)
     {
          LED1=1;           //simple LED Blinking
          LED2=1;           //simple LED Blinking
          Delay10KTCYx(250);
          Delay10KTCYx(250);
          LED1=0;
          LED2=0;
          Delay10KTCYx(250);
          Delay10KTCYx(250);
     }
}

To compile code I have used:

Archive PIC18F2550 Application template package.zip contains:

  • PIC18F2550 / PIC18F2455 LED blinker schematics compatible with USB programmer
  • user applications template working/compatible with Microchip's USB HID bootloader including compiled PIC18F2550_Application_template_RKA.hex file generated by MPLAB C for PIC18 v3.46 in LITE mode, that you can upload into PIC using USB programmer

If you found these information useful, please consider to:

in EUR
in USD

(Article created 5.1.2014)

  • hw_projects/pic_projects/pic18f2550/pic_test_programs/pic_led_blinker.txt
  • Last modified: 06.01.2024 21:03
  • by 127.0.0.1