Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Read Causes Blue Screen: Device_Corrupted_Model

I am performing this serial read using a USB-232 converter. I read in a line of data approximately once every 2 seconds and the crash happens at different amounts of times each time I run the program. For example sometimes I can run for 15 minutes and sometimes I crash after 5.
0 Kudos
Message 1 of 4
(3,535 Views)
Hello Brad,

Thank you for contacting National Instruments.

There are a number of things that could be causing your problem. I am going to offer a few suggestions that may or may not work, but I want to try to narrow down the source.

First, ensure that you are not opening and closing your connection to the serial port every 2 seconds. In other words, if you are using a loop to read data from the USB-232 converter, place the VISA Configure Serial Port.vi and VISA Close.vi before and after the loop.

Second, try reading your data more frequently and in smaller "chunks." Reading large amounts of data at one time using a USB-232 converter can sometimes cause problems. Experiment with different read times.

Finally, if neither of the pervious suggestio
ns work, try reading the same data from a serial port attached to your computer. Also, if possible, try using the USB-232 converter on a different computer. Let me know the results, and we will take it from there.

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,535 Views)
Matt

You are correct in the fact that I do open and close the port every two seconds and I agree that this probably does lead to my crash. The problem is that if I open and close the port just on the outside of the loop I never get any new data. The program will read all of the bytes in the buffer (256 usually) and then continue to run without ever reading any more new information. I know that my device always puts out data (about 16 bytes every 1.5 sec) since I have a com port monitoring program that continually will read in data if I just use that. I do not understand why LabView won't read in new data if the VISA connection is left open.

As for the other ideas, I read in 14 bytes at a time and my computer only has USB ports.
0 Kudos
Message 3 of 4
(3,535 Views)
Hello Brad,

LabVIEW actually will allow you to continually acquire new data while the VISA connection is left open.

Place a VISA Read within a while loop, with a VISA Open and Close on either side of the loop. Place a Wait function within your while loop to acquire data at the time interval of your choice. This setup will read X number of bytes from the serial port every X ms, as specified by your VISA Read and Wait functions.

You may want to include some form of handshaking in your code so that the read executes only when there is data available at the serial port.

If you are interested in getting the acquired information out of the read loop without stopping the loop, you may want to consider using local variables or property nod
es.

I hope this helps. Let me know if you have further questions.

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,535 Views)