//This example switches the PortC.2 LED on when an SD card is not
//inserted, and switches it off when an SD card is inserted.

sbit LED at LATC2_bit;
sbit SD_CD at PORTB.B1;

void main() {
  OSCCON = 0b01110000;          //8MHz
  PLLEn_bit = 1;                //Enable PLL (now 48MHz)
  TRISC2_bit = 0;               //Make PortC.2 an output
  TRISB1_bit = 1;               //Make PortB.1 an input
  PCFG10_bit = 1;               //Make PortB.1 digital (not analogue)
  RBPU_bit = 0;                 //Enable weak pull-ups on PortB
  while (1) {
    LED = SD_CD;
  }
}