Oh hum, Hi ho Hi ho, its off the plank I go This sort of stuff is naughty! You assume and have to control if the compiler is big or little end-in Dennis -----Original Message----- From: Michael Rigby-Jones [SMTP:mrjones@NORTELNETWORKS.COM] Sent: Wednesday, 22 March 2000 21:05 To: PICLIST@MITVMA.MIT.EDU Subject: Re: 16-bit arithmetic in C Ok, been doing a bit of fiddling. I found an include that I downloaded while back, but never really looked at. Amongst other stuff, the file defines the following: #define byte0(x) (unsigned char)(*(((unsigned char *)&x)+0)) #define byte1(x) (unsigned char)(*(((unsigned char *)&x)+1)) To use this you would do the following (assuming count is your 16bit var): byte0(count) = CCPR1L; byte1(count) = CCPR1H; This compiles to the expected 4 instructions. The file, along with some other good stuff for HiTech C can be found at http://www.keyghost.com/ Regards Mike Rigby-Jones << File: ATT00003.html >>