Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with serial communications

I have a machine (Pre-Amplifier) which I want to connect to my pc by a serial port. From the factory of the machine I got a VI to connect it serial and this works. But if the machine is turned off the program (the VI) stays in a loop and hangs.
Is there another way to connect serial to a machine? or does anyone knows a solutions for the hanging?

thanx in advance.
0 Kudos
Message 1 of 11
(3,402 Views)
You should be able to write a vi that won't hang. There are many ways to write a serial communication program - do you have an example of your vi?
0 Kudos
Message 2 of 11
(3,402 Views)
I have attached the drivers that I got for the pre amplifier. In my program I just call the getting started function so it will be initialised.
The only thing I give as input is the string "ID". This returns the Id of the machine.
0 Kudos
Message 3 of 11
(3,402 Views)
Does the machine hang or just the application?
0 Kudos
Message 4 of 11
(3,402 Views)
I have attached the drivers that I got for the pre amplifier. In my
program I just call the getting started function so it will be
initialised.
The only thing I give as input is the string "ID". This returns the Id
of the machine.
0 Kudos
Message 5 of 11
(3,402 Views)
I can't open the attached file. LV states that there is an error in it. Could you please send it again?
0 Kudos
Message 6 of 11
(3,230 Views)
Just the application hangs.
I have debugged it and somewhere in the software it stays looping until it receives 'something' and because the machine is not turned on or not connected the software does not get the 'something'.
0 Kudos
Message 7 of 11
(3,402 Views)
Hello,

Check into the Timeout feature of VISA. In the Instrument IO/VISA/VISA Advanced pallette, you should find a "set timeout" VI (resembling a property node) that will allow you to tell the VISA Read how long to wait before it moves on and gives a timeout error. Then, all you will need to do is add a condition that stops the loop whenever the error cluster contains that same "VI_ERROR_TMO" error. If you would like more information on this function and these errors, see the LabVIEW online help or the VISA programmer's reference, located at http://digital.ni.com/manuals.nsf/websearch/87E52268CF9ACCEE86256D0F006E860D?OpenDocument&node=132100_US

Scott B.
Applications Engineering
National Instruments
0 Kudos
Message 8 of 11
(3,402 Views)
Thank you for the answer. But I have question about it. Could someone give me a simple example vi of this. Because I have tried to make it/understand it, but I can't.

Bakelaar
0 Kudos
Message 9 of 11
(3,402 Views)
Bakelaar,

I have attached a simple example of doing this in LabVIEW 7.0. There is no VISA write in this example, only a read. You would need to add the appropriate write for your instrument. But, you can see how the timeout is set and how you can terminate a loop on the timeout error from the VISA read. Assuming your instrument is powered off, you can set the time that it will wait for a response before it ends the VI.

Scott B.
National Instruments
Applications Engineering
0 Kudos
Message 10 of 11
(3,402 Views)