Pic Mplabx Procedure
Pic Mplabx Procedure
#include <P18F4550.h>
void main(void)
{
Unsigned int i, j, x;
TRISB=0; // port b as O/P
LATB=0;
i=0x04;
j=0x05;
x=i+j;
PORTB=x;
PORTC=i;
PORTD=j;
#include <P18F4550.h>
void T0Delay(void);
void main(void)
{
TRISB=0; // configure Port B as output
While(1)
{
PORTB= 0x55; // load Bit Pattern
T0Delay ( );
PORTB= 0xAA;
T0Delay ( );
}
}
void T0Delay ( )
{
T0CON=0x08; // Timer0, 16 bit, no prescaler
TMR0H=0x9E; // load Higher byte in TMR0H
TMR0L= 0x58; // Load Lower byte to TMR0L
T0CONbits.TMR0ON=1; // start the timer for upcount
While(INTCONbits.TMR0IF==0); // Check for overflow
T0CONbits.TMR0ON=0; //Turnoff timer
INTCONbits.TMR0IF==0; // clear the Timre0 flag
}