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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW serial communication on Mac without VISA?

Hi all,

I downloaded the Labview community edition with the intent to play around with microcontrollers (Arduino and similar boards). They typically connect through the serial port. I'm using a recent Mac (intel) with the latest OS. Today I'm using various languages to do this already e.g. C/C++, Python, Julia, Matlab and browsers. 

 

It turns out, however, that the VISA package that is needed for serial communication using LabVIEW is not compatible with the latest Mac OS (12.2). 

 

My simple question is: Is there a way to access the serial port in LabVIEW without using VISA?

0 Kudos
Message 1 of 7
(1,068 Views)

First did you try installing NI VISA 20?  Did an error occur during install?

 

It is likely that Monterey has some backward compatibility built in even if NI documentation does not specifically state compatibility.   And that of course makes sense, the release date of the latest version of NI VISA precedes the release of MacOS 12.2 by months.

 

So, try it! Then let us plebiscites, who actually wait two whole months before upgrading our Development Machines, know how you are doing on the (b)leading edge.


 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 7
(1,051 Views)

Yes, I installed VISA 21 and the installation worked.  But using one of the LabVIEW examples "Simple Serial.vi" I could not access the serial port and I got an error. After that I read that VISA 21 is not compatible with MacOS 12 I uninstalled it. Uninstalling VISA was quite an involved procedure.

 

Accessing the serial port on macOS is rather simple in most languages, since the drivers are provided already by the OS, and I assume it must be possible to do also in LabVIEW without VISA. 

 

(It used to be safe (advisable) to stay behind the newest macOS, but nowadays macOS has been targeted by an increased amount of nasty malware so the current recommendation is to stay up to date.)

 

 

0 Kudos
Message 3 of 7
(1,003 Views)

Yes, LabVIEW has low level serial port drivers that bypass the VISA Layer on the Communications Pallet.

 

I'm sincerely surprised that the VISA install worked but the example threw an error.  Did you record the error so we could point to a specific reason?


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(995 Views)

This is great news, "low level serial port drivers" for LabVIEW (without using VISA) would solve my problem.

 

I tried to find them in "Data Communication" pallet but nothing.

In the "Instrument I/O -> Serial" pallet there is only VISA drivers.

 

Do you know the file names? Maybe I can do a search for them.

 

Many thanks!

 

I did not record the error, unfortunately.

0 Kudos
Message 5 of 7
(990 Views)

@JÞB wrote:

Yes, LabVIEW has low level serial port drivers that bypass the VISA Layer on the Communications Pallet.

 

I'm sincerely surprised that the VISA install worked but the example threw an error.  Did you record the error so we could point to a specific reason?


I'm not sure about the Mac, but those low level serial port drivers on Windows have been long ago discontinued (more than 20 years ago) and have AFAIK never worked on MacOS X as they used the Macintosh device manager API which Apple has only partly supported for a few versions in Mac OS X but somewhere around 10.7 completely obsoleted.

 

There are DLL drivers on Windows that directly access the Windows COMM API but they are not from NI. And I'm pretty sure someone might have cooked up something similar for the Mac but if it is available for free somewhere is a big question. And no even using that API won't be a guarantee that it will just work with a new OS version. Apple's track record about keeping such things compatible isn't quite very good. Pure serial port communication is fairly simple by using the standard Unix APIs such as open(), read(), write(), close(). Things get slightly more involved when you want to do "special" things such as setting the baudrate which requires calling tcgetaatr(), tcsetattr() and possibly ioctl() and fnctl().

All these functions can be also called using the Call Library Node if you know in which shared library they are, usually libc.so on normal Unix systems but not sure about Mac OS X.

 

But in order to open the right port you need to know the device string to use and that is nastier. Mac OS X is not Unix in such respects and rather than just enumerating the /dev/* filesystem you have to call another MacOS X specific API called IOKit Library. That is nastier to use as you tend to need to use callback functions for that and that is not solvable with the Call Library Node itself so you end up writing a serial port shared library anyhow and reinvent half of NI-VISA.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(976 Views)

Ok, it seems a little involved to use the serial port in LabVIEW without VISA right now. 

To just play around a little with LabVIEW I piped the serial port to TCP using netcat with this command (example using port 1234 and serial port: /dev/cu.usbmodem78301801)

 

nc -l 1234 > /dev/cu.usbmodem78301801 < /dev/cu.usbmodem78301801

 

This works for me now since LabVIEW can access TCP.

 

Thanks for the explanation.

0 Kudos
Message 7 of 7
(951 Views)