How to Run PIC18F Program on PIC18F4550 Microcontroller Kit ?

We are using PIC18F4550 and MPLAB IDE to Run this Program.

For Running PIC ( Peripheral Interface Controller) Program on PIC18F4550 kit. We require:

1) PIC18F4550 Kit

2) MPLAB IDE

3) PIC Loader Software ( Used to write a program on the microcontroller)

Steps:

1) Create a new project in MPLAB IDE. Ex: LED Blink

2) Build the project

3) Open the PIC Loader -> Click on Bootloader -> Open hex generated file of the build project -> From Program tab click on Write Device -> After that press reset button on PIC18 -> After that Run -> Break/Pause -> Bootloader -> Run

Video For Easy Understanding:

 


Program:

 #include <xc.h>


void main(void) {
    TRISB=0;
    PORTB=128;
    TRISC=0;
    PORTC=0XFA; 
    while(1)
    {
            PORTB = 0xFF;            // All led 8bit ON 
            for(int j=0;j<7;j++) 
            {     
              PORTB=PORTB<<1;       // Left Shift 1 bit 
              
              // Delay
              for(int i=0;i<5000;i++)
              for(int k=0;k<100;k++);
            } 

            PORTB = 0x80;
            for(int j=0;j<7;j++)
            {    
              PORTB=PORTB>>1;     
              
              for(int i=0;i<5000;i++)
              for(int k=0;k<100;k++);
            }
    }
}




Previous
Next Post »