I am running in a circle here and hope someone can pull me out.
I am getting 3 bytes from an ADC over I2C which is declared as Data_Hi ,Data_Mid and Data_lo in the correct order as the ADC send them out ,
from the screen print you will see that the data is correct Hi_byte = 0 ,mid_byte = 0xdc and Lo_byte = 0xd5
I use the following to combine the 3 bytes
Code: Select all
ChannelResult = 0 // Long variable
ChannelResult = ( Data_Hi <<16) OR ( Data_MID << 8) OR ( Data_Lo)
the variable is cleared so all bytes should be zero(0) before the shifting starts how come it change to FF when shifting the byte and only happening on the 3rd byte (bit 16-23) and seems also on bit 24-32)
I am pulling the little bit hair I am having also out now
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)