// 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(_DDPSTATbits.APIFUL) // APPI is full?
      {
       val = _APPI;         // Read User Input
       for(i=0; i<4; i++)
         {
          while(_DDPSTATbits.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;
}