02-25-2021 03:30 AM
Hey,
I am trying to read the data coming from the Arduino connect in my laptop USB com ports.
I have written the code for reading and writing the data from the COM ports in LabVIEW but LabVIEW is not detecting any COM ports, just only refresh is available while selecting the COM ports. Kindly please help I have attached screenshots of the front panel which shows no COM is seen only the "refresh" option after refreshing still no COM ports are displayed. I have attached a screen snip from the device manager where it shows Arduino is connected to the COM(6) port. Kindly please help me.
02-25-2021 03:43 AM
02-25-2021 07:58 AM
Those Serial Configure VI's belong outside the while loop.
And Bytes at Port is the wrong thing to use about 99.9% of the time.
02-25-2021 08:32 AM
Not much more to add, really. For your immediate issue, we really need to see what software you have installed (LabVIEW and VISA versions specifically). Then there is also the question if the serial ports show up in MAX (they definitely won't if you don't have VISA installed).
But there are some major issues with your code. First is that initialization of your ports need to be outside of your loop. Secondly, you typically have a termination character when using an Arduino (using the PrintLn command). So do not use the Bytes At Port to tell the VISA Read how much data to read. Instead, just set the number of bytes to a large value and the read will grab 1 line at a time (stops reading when the termination character is read, default being the Line Feed). I suggest watching this: VIWeek 2020/Proper way to communicate over serial
02-25-2021 03:28 PM
@StookeyKinder wrote:
This issue is usually caused by an improper or no installation of the NI-VISA driver. Without NI-VISA, MAX is unable to access or create serial, GPIB-VXI, or TCIP/IP interfaces. Make sure you have the latest compatible version of the full NI-VISA driver installed.
Y'all need to pay attention!
"Refresh" is there. NI VISA and Configuration support are installed and compatible with the LabVIEW version.
So, can somebody kindly post up some screenshots about I/O resouse Filtering from the I/O Container right-click options.
02-25-2021 03:55 PM
Given that you are showing only a single COM port on your system, should you really be establishing two different VISA sessions, one for read and one for write. If the intent is for those to both be COM6, it will not work. You should use a single VISA resource for both your read and your write. the other thiing is if you are intending to read a response after you have sent a command to the Arduino, this code will not work. You need to use data flow to control your execution so that th ewrite happens before the read. As written, you really don't know which operation will happen first.