- #1
- 4,472
- 1,245
I am using a C compiler to develop firmware for a PIC microcontroller. This microcontroller needs to comunicate with a device with an 8 bit wide data bus. However, the device takes in 16 bit words in 2 consecutive steps. I need to be able to split up the upper and lower bytes in my program. How is this done easily? I'm familiar with BASIC and the hex() function and all the string manipulations/conversions to/from decimal, etc. but new to C. Is there an easier way than dumping the 16 bit hex word into memory and then picking it out one byte at a time? I believe C allows this and I may have to resort to it. Any advice?