From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Advanced API for C with NI-8451

Hello,

i want to use a humidity sensor with an i2c comunication sequence described in the attached file. Using the NI-845x basic I2C API i get a communication error. Therfore i have to program a script with the advanced i2c API. Can anyone help me how to use the ni845xI2cScriptxxxx commands (for c) to map the communication sequence of this sensor ?

 

Thanks a lot !

 

0 Kudos
Message 1 of 5
(4,449 Views)

@BBaffoun wrote:

Hello,

i want to use a humidity sensor with an i2c comunication sequence described in the attached file. Using the NI-845x basic I2C API i get a communication error. Therfore i have to program a script with the advanced i2c API. Can anyone help me how to use the ni845xI2cScriptxxxx commands (for c) to map the communication sequence of this sensor ?

 

Thanks a lot !

 


Are you or your manager willing to pay this person to write the code for you?

0 Kudos
Message 2 of 5
(4,440 Views)

Hey Nyc,

 

what kind of help do you need? The communication sequence for your humidity sensor doesn't contains anything, which is not a normal I²C communication. Which error do you receive if you uise the basic I²C API? An error reported by the API can be a result of wrong cabling, missing termination resistors, logical issues and so one.

You will receive more attention from the forum user, if you attach you current code too.

 

Stephan

0 Kudos
Message 3 of 5
(4,418 Views)

Hey Stephan,

 

i think, the challenge consists in mapping the "transmission start" sequence !!!

 

i've attached my current code. After the write / read command i get the error code = -301742: "slave can't recognize the address and the direction byte of the i2c master"

0 Kudos
Message 4 of 5
(4,411 Views)

I think the transmisson start sequence only looks a little bit confusing, but is the regular start condition for an I²C transmission. The start of a transmision is defined as the falling edge of the Data line during a high signal on the SCK (Serial Clock) line.

 

I2C Bus Specification
http://i2c.info/i2c-bus-specification

 

And if I take a look into the communication sequence, the last part of the transmission start is a falling edge of the SCK line during a high signal of the Data line. I think the picture should show that you need this special transision and any other changes of the SCK and Data line are ignored.

 

Stephan

0 Kudos
Message 5 of 5
(4,407 Views)