B.2.4 Code Example

Paste the configuration and this simple code example in test.c:

void main() 
{ 
    TRISB=0x00; //All pins as output 
    PORTB=0;    //All pins off 
    while(1)    //main loop 
    { 
        PORTBbits.RB0=1; //Turn RB0 on 
        PORTBbits.RB1=1; //Turn RB1 on 
        PORTB=0;  //All pins off 
    } 
}

PIC