In some applications, we simulate the USB port to be a COM port (or serial port) with a ttyUSB adapter to communicate with a COM device, and USB-RS485 is one of such devices.
Figure 1. USB-RS485 USB to COM adapter.
This article will give steps to use such devices on myRIO using LabVIEW.
1. Make sure your divce is a ttyUSB device that can be supported by myRIO. You can validate this by the following steps.
Plugin your device to the USB port of myRIO.
Using a ssh tool such as putty to login myRIO.
Type the following commands.
If you can see listed files such as ttyUSB0 ( the postfix number may vary on different myRIOs), then it is a supported device and you can continue with the following steps, or you have to install other drivers for this device to enable to use it.
2. Make LabVIEW recognize the device.
Open /etc/mdev.conf and add the following line under "#typical devices" section. You can edit this file by vi editor on myRIO or copy it to your PC through FTP and send it back after editting it.
ttyUSB[0-9]* root:tty 666
Copy the attached script file "S10SetLnUSB" to /etc/rc5.d/
Change the file to be executable by commands:
#chmod a+x /etc/rc5.d/S10SetLnUSB
Reboot myRIO and open NI MAX to find the myRIO. You will see there is a new "ASRL" device listed under "Devices and Interfaces" of the myRIO, e.g. in the following figure, it is "ASRL3::INSTR". Originally, thre are only 2 "ASRL" devices listed.
Figure 2. Listed devices under myRIO in NI MAX
If you see the new "ASRL" item under "Devices and Interfaces" section of the myRIO, you will be able to use the device now. If it is a USB-RS485, you can take it as a normal COM resource and use LabVIEW VISA APIs