I2C Write Data Format Problems Hex/Int | Cypress Semiconductor
I2C Write Data Format Problems Hex/Int
See the attached project.
What I am trying to do is read data, then send it to a 0-5V DAC chip (MCP4725). I have no problem reading the data, but when it goes from my data buffer to be written to the I2C port, something bad happens, because the DAC does not respond correctly. See the picture I captured in the zip file. The value of the data is, correctly, 0xA1, or 161. If I manually retype '0xA1' in the bracket instead of putting the variable, it works like it is supposed to. Do I need to 'cast' the hex as an integer somehow, or inform the compiler what type of data it is?
I know, this is probably extremely basic C programming stuff, but please bear with me.