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.
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.
09-11-2020 07:51 AM
Hi,
I have an electronic module which communicates with a display module using I2C. I need to disconnect the display module and display the same stuff (what it used to display on the display module) , on a PC monitor instead.Got USB 8451 for this purpose.
8451 is getting recognized by labview on USB port.As a starting step , I am just using the same program in Labview examples for I2C with the name "Digital line readI2C script.vi." I select the USB port (only one displayed in the list),I/O voltage level as default 3.3V and start the program.Whether my module is ON or OFF , and line number anything from 1 to 7, it gives me same result without any error , i.e. the "value" is always True(ON)
I2C is completely new field for me and i might be doing something totally wrong. Just want some hint about what I am doing wrong here, and the pathway to get the things done.
Solved! Go to Solution.
09-11-2020 09:32 AM
At the beginning of the year, someone handed me an NI USB-8451 and said "We need to communicate with a SPI Chip -- figure it out!". Now, SPI isn't I²C, but the USB-8451 does both, and there are similarities in the software, some maybe my experience will help.
Like I²C, SPI has a Basic Programming Model and a Scripting Programming Model. The one piece of "free advice" I was given was to stick with the Basic Programming Model. I had three types of SPI chip to program -- an A/D converter, a D/A converter, and a 16-Bit Digital Register, able to program the bits as Readable or Writable, as needed. I wrote a hand-full of sub-VIs that did the following:
I also had to learn that when you write data to a SPI chip, it sends you back data on another line. If you are doing a real "Write" command, you ignore those bits, but if you are trying to do a Read, you get them by doing a "dummy Write" to get them "pushed back" to you.
So with a handful of my custom VIs to "hide the details" for the various Chips I was using, it was fairly easy to get SPI to work.
I recommend you examine the Basic Programming Model on pages 5-1 and 5-2 of the 845x Manual, and write your own "wrapper" VIs for the basic I²C functions using Property Nodes (for Configure), I2C Write, I2C Read, and I2C Write Read VIs that come with the 845x Software.
Bob Schor
09-14-2020 07:32 AM
@maccapple wrote:
I have an electronic module which communicates with a display module using I2C. I need to disconnect the display module and display the same stuff (what it used to display on the display module) , on a PC monitor instead.Got USB 8451 for this purpose.
Is the display module the I2C master? I doubt it is. But you need to give us model numbers or documentation to verify. So if my assumption is correct, you will need to act as an I2C slave. You cannot use an USB-8451 to act as an I2C slave; you will need to get an USB-8452.
09-15-2020 06:47 AM
Sorry I did not clarify it properly before.
Yes the display module is a I2C master. Confirmed with our R and D who designed it.Also, the communication is in both directions. The display module not only displays information but also has buttons which controls the electronic module.
09-15-2020 07:34 AM - edited 09-15-2020 07:35 AM
@maccapple wrote:
8451 is getting recognized by labview on USB port.As a starting step , I am just using the same program in Labview examples for I2C with the name "Digital line readI2C script.vi." I select the USB port (only one displayed in the list),I/O voltage level as default 3.3V and start the program.Whether my module is ON or OFF , and line number anything from 1 to 7, it gives me same result without any error , i.e. the "value" is always True(ON)
Well, your VI isn't even doing I2C. It is just reading from one of the DIO lines on the board (there are 8, labeled P0.0 through P0.7). If you don't have those wired up, then you will just read a 1 (on) due to the built-in pull-up resistor.
Something like this is what you should do for a simple read. If you have to do a register read from a device, then you need to use the Write-Read function instead with some additional code to build up the request bytes.
09-15-2020 09:12 AM
Thanks.
I'll check up if I can find any issue with the data from the hardware side.
09-15-2020 10:27 AM
Thanks.
I'll check up if I can find any issue with the data from the hardware side.