Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa only works after I validate the port

Basic setup:

Win 7 with Labview connected to an infusion pump via RS-232

 

I have a test program that looks for the the right port by pinging the availble COMs with a specific instruction only the pump will understand and respond to, if succeful, it will return the correct COM#.

 

This program was working fine when I had a USB to RS-232 module. But things have changed, and I'm now using a VScom 400E PCIex board which can provides 4 DE-9 connectors (ideal for RS-232). Now my program only works if I hit "validate" in the measurement and automation explorer, and then it only works once, until I hit validate again.

 

I'm not sure what the problem is. I've attached the NI trace file which display three consequetive results. The first is the validate command (to line 7), the second is me running the program the first time and being successful (line 8 to line 18), and the third is the program failing to find the pump (having been run barely 2 seconds later).

 

I've also attached my application for reference. Note that the missing VI convert data to commands for the pump, or input stream to generic data

Download All
0 Kudos
Message 1 of 2
(2,576 Views)

It is the first time that I see the use of visa events and this just for clearing a buffer.

Normally I use a visa resource name control and select the port I want. I don't beleive in automatically finding a correct resource and by wildly asking who are you, I must be sure that no instruments go wild.

I suggest to start with using the example basic serial read write to test your communication.

greetings from the Netherlands
0 Kudos
Message 2 of 2
(2,572 Views)