// include file #include <xc.h> // set up config bits #pragma config FWDTEN = OFF // initialize variables unsigned int val; int i; unsigned int oval; int main(void) { while(1) { if(APPSbits.APIFUL) // APPI is full? { val = _APPIN; // Read User Input for(i=0; i<4; i++) { while(APPSbits.APOFUL); // APPO is full? oval = val&0xFF; if(oval < 0x20) oval = 0x20; oval |= 0x20202000; _APPO = oval; // Send to MPLAB X IDE val >>= 8; } } } return 0; }