Hi Sujith
There are two ways. The portable and non-portable way.
******************* Non-portable ********************
unsigned char *ptr = &usWord;
send-routine(*ptr++);
send-routine(*ptr);
*****************************************************
This works but the order of the bytes is 'endian' dependent. Big-endian (like HC12) or little-endia (like 80186).
If usWord is 0x1234, the data sent will be 0x12, 0x34 when big-endian or 0x34, 0x12 when little endian.
Generally network ordering (as used by Internet etc.) corresponds to the big-endian ordering.
******************* portable ************************
send-routine((unsigned char)(usWord>>8));
send-routine((unsigned char)(usWord));
*****************************************************
The portable version will give the same results as the non-portable when using the HC12. The portable case also specifically sends in network order.
Regards
Mark Butcher
www.mjbc.ch / www.uTasker.com