Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading temperature of MCP9808 via I2C on sbRIO-9627

Hello there,

 

We want to connect a temperature sensor MCP9808 via I2C to our sbRIO-9627. We found two examples on how to read an I2C protocol with an FPGA interface which are linked below.


1. I2C Implementation in LabVIEW FPGA

and

2. I2C Bus Communication Example Using LabVIEW FPGA

 

We are currently using LabVIEW 17.0f2 and an sbRIO-9627 with the following operating system :

 

NI Linux Real-Time ARMv7-A 4.6.7-rt14-ni-5.0.0f0

 

The data sheet of the sensor we use can be found here:

 

MCP9808

 

The code linked in 1 is very well documented and we were able to follow every single step. In the end we got still no signal data on the I2C. The code (I2C_Core.zip) we adapted can be found attached.

 

With the second code we managed to get some data out of the sensor but as it is binary we still need to translate the I2C protocol to an arbitrary temperature. The code we used is attached, it is the mainly the code linked in point 2 above.

 

The address is known (0x18), the "bytes to read" number is known (2, that is 16 bits). The clock (SCL) is connected to RMC/DIO 3 and the data (SCA) is connected to RMC/DIO4. Using a pull up resistance on both SCL and SCA doesn't change the signal.  

Depedending on the clock rate we get different outputs at the "I2C Protocol Ouput Data 0" indicator: 0, 29, 255

 

We would be glad about every hint what to improve on the code to get a simple temperature out of our sensor.

Thank you in advance for your help!

 

I2C post.PNG

 

 

 

 

 

Download All
0 Kudos
Message 1 of 1
(2,643 Views)