LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using I/O Assistant with Serial

I'm trying to read in streaming serial data on Com 1 from a digital flowmeter which outputs 3 numbers per line (pressure, temperature, and flowrate). I can read the data via Hyperterminal, the "Open VISA Session" button in MAX, and the sample VI that can read from a serial port.

When I select the COM port under the "Select Instrument" tab in the "Instrument I/O Assistant" and click the "Run" button, I get the following error message:
"Timeout expired before operation completed. VISA Status code: bfff0015"

Also, the "Code generation type" dropdown box is grayed out. My timeout is 2000 ms. If I increase the timout to 3000ms, the system just hangs.

Does anyone know where this error is coming from and how to fix it? I'm interest
ed in using the assistant because I'd like to use the automatic parsing feature without having to delve into the low-level code to do that myself. Thanks!
0 Kudos
Message 1 of 16
(3,804 Views)
What steps have you added to your Instrument I/O Assistant VI? I assume you have more than the one Select Instrument step, since you are getting an I/O error.

Also, you said the instrument streams data - does this mean you don't have to send a command to the instrument before you retrieve data? If this is the case, make sure you are only using a Read and Parse step in your Assistant - you do not want a Write or a Query step.
0 Kudos
Message 2 of 16
(3,803 Views)
I get the error with both the "Select Instrument" step and the "Read and Parse" step. Those are the only two steps I have added. I still get the error even if I just have the "Select Instrument" step.

You are correct that I do not have to send a command to the flowmeter before I retrieve data. In fact, the flowmeter will not accept any commands (it's a read-only device, meaning that you can't write anything to it).
0 Kudos
Message 3 of 16
(3,802 Views)
So you get a timeout error with only a Select Instrument Step in your task list? That is odd. Can you do me a favor and create a NI-Spy log for this?

To do this, launch NI Spy from the National Instruments Start Menu, and then launch Instrument I/O Assistant. Click the blue arrow button in NI Spy to begin a capture, then Run the Instrument I/O Assistant task to reproduce the timeout, and then click the red X in NI-Spy to stop the capture. Finally, in NI Spy, go to File>>Save As and save a log of the capture and attach it in your reply.

This will help determine which VISA calls are timing out.

-Tommy
0 Kudos
Message 4 of 16
(3,802 Views)
Tommy,

Attached is my NI Spy output.

Neville
0 Kudos
Message 5 of 16
(3,802 Views)
Neville - is this spy log from when a VISA timeout error occurred? There aren't any timeouts in the log file.
0 Kudos
Message 6 of 16
(3,802 Views)
Tommy,

I'm sorry for the error. It turns out it didn't time out. It only times out when you add the "Read and Parse" step, which, by the way has all the boxes totally grayed out (i.e., I can't enter or change any parameters).

Here is an NI Spy file with the timeout.

Thanks!
Neville
0 Kudos
Message 7 of 16
(3,802 Views)
Thanks Neville - this spy log indicates it is timing out when trying to read from the instrument session. I just wanted to confirm where the timeout was happening. I would be curious to see the difference in the VISA calls that the I/O Assistant makes compared to the VISA calls made when you succeed from Hyperterminal or MAX. Can you do the same thing with Spy as you did with I/O Assistant, but do it with MAX this time? This way I can see what a successful Spy log looks like and see what the differences are.

-Tommy
0 Kudos
Message 8 of 16
(3,802 Views)
Tommy,

I just tried it and noticed I got the same error (BFFF0015)in MAX when my serial cable was unplugged that I got in the I/O Assistant.

I'm attaching 2 NI Spy files of MAX: one with the serial cable connected and one with the cable disconnected.

Thanks so much for your help with this!

Neville
0 Kudos
Message 9 of 16
(3,802 Views)
Neville - The only difference between the successfull MAX case and the I/O Assistant failure that I can see is that MAX is doing the I/O asynchronously, and I/O Assistant is doing a synchronous Read. This shouldn't make a difference. The only other possible difference I can think of is the way an instrument session is opened. If you notice in your spy record of the failure in I/O Assistant, there is a call that looks like:

viOpen (0x001B10A0, "ASRL1::INSTR", 4, 0, 0x0022C7D0)

Can you do another spy log for me? Can you get a log of the viOpen in the MAX case, so we can compare the viOpen call in the successfull case and the failure case? Thanks for helping us out with this - hope
fully we can track this down for you soon.

-Tommy
0 Kudos
Message 10 of 16
(3,807 Views)