Topic: I2C Communication

I started with op-amp testing and came to know that, off-chip components are not available on the board. I already requested those from element 14 in apprehension. Now I am waiting for the resistors and capacitors. I am not getting any response from element 14, Bangalore.


Meanwhile, I am writing the PID in software. For code testing purpose, the variable values need to be communicated to host. I am trying I2C. I am implementing this for the first time. Gagan Luthra's video was very helpful. I have learnt writing to and reading from the buffers. For the computed variables, I wrote a code that sends a variable "num" that keeps on incrementing by 5. When it exceeds 0x0F9 it resets. Strangely, at some points I am getting data that I could not explain. I marked those with yellow. The blue mark  indicates a correct data that was wrong in the previous read.


post_8_3.jpg

I tried to send the data in float. But I could not explain the transmitted data. Knowledge of data representation whether fixed format, how many bits for fractional part etc. is required. This is not a big problem. The data can be converted to int in the program and again reconverted to float in the host. I tried to plot the data, only the axes were displayed, no plot. This is also not a big problem. I could generate a data-file. The plot can be done by other tools.