06-02-2025 11:33 AM
I have several NI USB to RS485 converters on my system that need to run in 2 wire mode. One converter goes to a device that I communicate with directly in LabVIEW, and I can use a property node to set the wire mode without an issue. Unfortunately, the second converter goes to some hardware that is controlled via third party software, which then sends out the data to be read by LabVIEW. I can open a VISA session on that port and set it to 2 wire, but that setting isn't retained when I close the VISA session so the other program can access the device. I can go into MAX and change the wire setting, but that doesn't get retained when the computer restarts. Is there a way to permanently set the default wire mode to 2 wire, or to programatically do what I currently manually do in MAX? I'm running LV23.
07-30-2025 09:54 AM
I never found a way to permanently set the wire configuration, but I did figure out several ways to change this programmatically. It did required editing the Windows Registry.
I searched the Windows Registry for the name of the com port (e.g. COM1), and then found the key that controls the wire mode. I wrote a VI to modify that registry key, but that would only work if you ran LabVIEW as a admin (not just under an admin account). I was able to cobble together a Powershell script that would change that registry key. I could call that script via LabVIEW, but I would still get a prompt asking if I wanted to allow Powershell to make changes to the system, so I ended up setting up an automated task that runs the script after the user logs on.