Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C & SPI Driver API with cRIO-9046 and NI-9402

Hi all, I'm trying to communicate with a Kelly Pneumatics mass flow sensor with I2C communication. I've used the NI USB-8452 successfully but Windows cannot reliably record data at 2kHz so I've moved on to Real Time and FPGA. I'm using a cRIO-9046 and NI-9402 for digital I/O. I'm also using the I2C & SPI Driver API I found on the NI website for the communication code.

 

Disclaimer: I'm a mechanical engineer and I've only been using LabVIEW since April-ish so I am by no means proficient with LabVIEW code, but I have learned a lot since then, so bear with me.

 

That being said, I follow the instructions and configure the clock/data lines in "I2C FPGA.vi" to "Mod1/DIO1" and "MOD1/DIO0" respectively then load the VI onto the FPGA. I use the I2C Host.vi on the cRIO and fill in the parameters:

 

Port Number = 0

Address = 0x10

Clock Rate = 400kHz

Write Data = 0x06

Read Data = 9 bytes

 

I highlight port number because I have no idea what this is relative to? What is this "port"? When I run code with this port, I get the attached error. When I use any other port I get an error stating that the configuration does not exist. I have yet to read any data from my flow sensor. When probing wires, I found that in the Host > Read > Call Configure > Check idle.vi (2nd instance) is returning the error because the device is timing out according to the code in Check Idle.vi. I tried replacing the comparison with a constant "False" and the problem is that the "I2C Protocol Action 0" is never setting status to "True." What does this all mean?

 

Also to note: I hooked up an O-scope to the setup and am not seeing any signal at all when running the code. In the test panel for 9402, running the panel and setting the "port0/line0:3" line 0 to  "high" or "low" is the only time I see anything on the O-scope. I also have no idea how these lines work or what they are referring to physically.

0 Kudos
Message 1 of 2
(902 Views)

2 weeks later no replies... can anyone help??? Even if there was a way to use the USB-8452 with a real-time target that would be helpful too.

0 Kudos
Message 2 of 2
(861 Views)