On Saturday 26 April 2003 08:33 am, Mccauley, Daniel H wrote: > I have a few 16 bit variables i would like to split into two 8-bit > numbers which I will then write to an I2C EEPROM device (24xx00 > EEPROM). Any suggestions on what the best way to do this is??? Assuming that: * you're using C * you've already typedef'd uint8 and uint16 to be 8 bit and 16 bit ints then this is the cleanest way to do it (and generates the best code in most 8 bit C compilers): union { uint16 w; uint8 b[2] } u; u.w = my16BitNumber; writeByte(u.b[0]); writeByte(u.b[1]); -- Ned Konz http://bike-nomad.com GPG key ID: BEEA7EFE -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu