PIC18F4550 : How to convert 16 bits integer to two 8 bits chars in C?
Try these:
unsigned char get_LSB (int n)
{    
    unsigned char lsb = (unsigned char) (n &amp; 0xFF); // mask the lower 8 bits
    return lsb;
}

unsigned char get_MSB (int n)
{  
    unsigned char msb = (unsigned char) (n &gt;&gt; 8);// shift the higher 8 bits
    return msb;
}