LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Are there implementation of I2C, SPI, UART in LabView?

Hello LabVIEW Experts,

I am learning Labview Community 2021.

 

I've found that if I want to connect to some 3rd party sensor devices, I would mostly need peripherals such as I2C, SPI and UART.

 

So how do I access this peripherals from within Labview Community 2021?  😊

0 Kudos
Message 1 of 11
(2,995 Views)

First for all of them you need some hardware interface. For UARTs this is usually an RS-232 or RS-422/485 interface. As long as it is recognized by Windows as a serial port, you can use the NI VISA functions in LabVIEW to access it.

 

For I2C and SPI you always need some form of TTL logic interface. What library you can use to implement either of them depends mainly on what hardware interface you use.

Rolf Kalbermatter
My Blog
Message 2 of 11
(2,993 Views)

I have this click board which is wildly used among PIC fans.

https://www.mikroe.com/usb-uart-click

 

Is there any Labview driver for this?  The chip is FT232RL, a very popular USB to UART interface IC.  🤔

0 Kudos
Message 3 of 11
(2,987 Views)

What shows the device manager in Windows when you plugin this board in your computer?

 

Most likely you will need to install either the FTDI Virtual Com port driver or the FTDI D2XX Direct Driver.

 

With the Virtual Com Port driver you can access this board like a serial port in Windows and hence also in LabVIEW through the VISA functions.

With the FTDI D2XX driver you can access its DLL through this library. But the FT232RL does not seem to incorporate the FTDI MPSEE engine, so you can not use the according MPSEE DLLs on top of the D2XX driver that take care of most of the low level bitbang handling for I2C and SPI. Also note that the FTDI driver is in LabVIEW 7.0 format and only is compatible to the 32-bit version of the FTDI DLL. Don't try to use it with 64-bit LabVIEW!!!!!!!

Implementing I2C and SPI on top of the D2XX DLL interface directly would be a major investment in time and effort.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 11
(2,985 Views)

@HKPhysicist wrote:

Hello LabVIEW Experts,

I am learning Labview Community 2021.

 

I've found that if I want to connect to some 3rd party sensor devices, I would mostly need peripherals such as I2C, SPI and UART.

 

So how do I access this peripherals from within Labview Community 2021?  😊


Most common serial busses have a USB type adaptor that installs a virtual com port. Once you have that installed and the virtual com port is recognized by NI-Max as a VISA resource. Communicating with your peripherals is no different than communicating with any other device on a Com port. 

 

BTW: This abstraction is part of the beauty of VISA.

 

Here's some USB adaptors for various serial busses

USB-I2C Adaptor 

CABLE USB HS SPI/I2C/JTAG  

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 11
(2,914 Views)

Yes, I have installed the NI-VISA package and my usb-uart board is shown as serial com port inside MAX!

 

Windows 10 has a built-in driver for Future Tech's chip.  So everything is straight forward!  Labview laptop can be used as data acquisition instrument very easily.😀

Message 6 of 11
(2,905 Views)

But please be aware that the FT232R(L) chip variant is a low cost version in comparison to other FT232 versions such as the FT232HM. As such it is pretty much a pure UART without real support for things like I2C or SPI. It could be simulated with bitbang mode but not for reliable high speed communication.

 

Your FT232RL based board can be used to interface to RS-232, 422 and 485 with according interface circuitry and 3.3V or 5V TTL logic UARTs. Not really more. The FT232HM cables that RTSLVU has provided links for contain the chip version with integrated MPSSE engine that provides integrated support for I2C, SPI and some other digital bus protocols. You do however need to use the FT2Dxx drivers in order to use those modes.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 11
(2,891 Views)

Accidentally, I did find something close to your description:

https://www.mikroe.com/click-usb-adapter

 

It carries a FT2232H dual high speed USB to multi purpose IC.  There is also a Windows 10 driver for it!  😀

0 Kudos
Message 8 of 11
(2,863 Views)

Hi,

 

I used the FT4232H module a lot. Mostly UART and IO.  Also I2C without any problems.

Tried to use it for JTAG without succes. No sure why, have to search dig further into that one.

Recently also use the SPI interface. I found that this works for individual Write/Read actions.

With a SPI device that receives and sends data at the same clock tick it fails. Data send to the SPI device was completely wrong. So I used the same pins as I/O. Got that working but much, much slower.

 

Kees

 

0 Kudos
Message 9 of 11
(2,842 Views)

Did you buy chips from unknown China sellers on Amazin or ebay?

 

They reuse parts from broken gears and also remark them.  🤔

 

Mikroe's parts are genuine.  Their parts work many years.

0 Kudos
Message 10 of 11
(2,836 Views)