LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with serial & GPIB in a sequence

Hello,
I have problems with sending commands and receiving data out of a sequence
loop from/to a Multimeter and power supply. The instruments work fine with
simple single visa serial or GPIB Vi`s.
For simple mesurements I need to transmit only com port number(or visa
device), write string, receive string
switching some relays in between, some delays.
There are always errors. Maybe the opening and closing or timing is not ok.
Problems are always with the second command or receive strings to the
devices.
Can somebody send me an easy sample vi for RS232 and for GPIB Interfaces
that is working in a test sequence loop.
Thank you
H.Schmiele
h-s-@gmx.de
0 Kudos
Message 1 of 6
(3,382 Views)
"Anja_S." wrote:

> Hello,
> I have problems with sending commands and receiving data out of a sequence
> loop from/to a Multimeter and power supply. The instruments work fine with
> simple single visa serial or GPIB Vi`s.
> For simple mesurements I need to transmit only com port number(or visa
> device), write string, receive string
> switching some relays in between, some delays.
> There are always errors. Maybe the opening and closing or timing is not ok.
> Problems are always with the second command or receive strings to the
> devices.
> Can somebody send me an easy sample vi for RS232 and for GPIB Interfaces
> that is working in a test sequence loop.
> Thank you
> H.Schmiele
> h-s-@gmx.de

This can be a problem with using sequences. I might suggest that you in
stead
use
SubVIs and use the error I/O to make the data dependant flow.

A couple of things to check in the presetn vi.
1) Only open the VISA reference once at the beginning and close at the end.
If you are opening a closing for every loop (assuming this is in a loop) this
can cause problems.

2) make sure you have enough delay between when you write the command and when
you
receive the response.

3) Dont mix the write and read to different devices. Although they are
addressed, if you write to a device
(to ask for data) you should read from that same device before you write /
read from another.

4) Check the DMM. some of these want to send their data every time they are
addressed.
If this one does that you only write to it once and then keep reading.

5) Check the sequence locals (if you are using them) and make sure you have
not
crossed the wires.

If none of this solves it you could send me the vi (ver.51 or earlier) and
I will have
a look at it.
Good Luck
Kevin Kent
0 Kudos
Message 2 of 6
(3,382 Views)
[posted and mailed]

Anja_Schmiele@gmx.de (Anja_S.) wrote in
<8t9gkd$5ep$00$1@news.t-online.com>:

>Hello,
>I have problems with sending commands and receiving data out of a
>sequence loop from/to a Multimeter and power supply. The instruments
>work fine with simple single visa serial or GPIB Vi`s.
>For simple mesurements I need to transmit only com port number(or visa
>device), write string, receive string
>switching some relays in between, some delays.
>There are always errors. Maybe the opening and closing or timing is not
>ok. Problems are always with the second command or receive strings to
>the devices.
>Can somebody send me an easy sample vi for RS232 and for GPIB Interfaces
>that is working in a test sequence loop.

Serial comms is never easy. You need to give us s
ome more information, such
as what the errors are. Is it possible that each iteration of the loop you
are opening a reference (eg VISA) and forgetting to close it? Alternatively
you could place the initialisation outside the loop and the close after
loop termination (this will increase efficiency).


--

Alexander C. Le Dain, PhD
ICON Technologies Pty Ltd
http://www.icon-tech.com.au

******************************************************************
* The LabVIEW FAQ http://www.icon-tech.com.au/thelabviewfaq.html *
******************************************************************
0 Kudos
Message 3 of 6
(3,382 Views)
H.Schmiele wrote:

>>There are always errors. Maybe the opening and closing or timing is
not ok.

If you are on a Windows platform, use the tool NI Spy that will show
each VISA call along with its parameters and results. That should
clear up which function call is failing.

Alexandar wrote:

>>Alternatively you could place the initialisation outside the loop and
the close after loop termination (this will increase efficiency).

I agree that you should not open and close the port continuously. If
you are using LabVIEW 6i, you can just use the port name such as ASRL1
and let LabVIEW handle the opening and closing for you to avoid such
problems.

Dan Mondrik
Senior Software Engineer, VISA
National Instruments


Sent via Deja.com http://www.deja.com/
Befo
re you buy.
0 Kudos
Message 4 of 6
(3,382 Views)
Hello,
and thank you all for your answering.
Well I managed the problem in between, although is is never easy to
communicate with different instruments.
I learned a lot about it with that work. For a TTI Multimeter I did not have
a driver. A simple vi serial or GPIB did work sometimes but not in a
sequence or loop. I think it was a timing problem with it. Even problems
with the standard visa functions. All the Instruments react different.I have
found some sample vi's in the
internet, that have been able to communicate without time out errors or
other error messages for serial and GPIB.The same vi did not work with
another power supply. That one worked easiely with the standard GPIB vi's.
With the next new instruments I
will try to use the GPIB or visa fu
nctions again. Thank you also for the
hint using ni spy. It may help me watching the communication with all the
different instruments.
Initialisation, opening and closing is very important too. There are very
often errors with it. So let's see how it will work.

Have a nice day
0 Kudos
Message 5 of 6
(3,382 Views)
Your VISA GPIB problems MAY be related to my post "viWrite vs.
viWriteAsync"



Alex wrote:
>
> [posted and mailed]
>
> Anja_Schmiele@gmx.de (Anja_S.) wrote in
> <8t9gkd$5ep$00$1@news.t-online.com>:
>
> >Hello,
> >I have problems with sending commands and receiving data out of a
> >sequence loop from/to a Multimeter and power supply. The instruments
> >work fine with simple single visa serial or GPIB Vi`s.
> >For simple mesurements I need to transmit only com port number(or visa
> >device), write string, receive string
> >switching some relays in between, some delays.
> >There are always errors. Maybe the opening and closing or timing is not
> >ok. Problems are always with the second command or receive strings to
> >the devices.
> >Can somebody send me an easy
sample vi for RS232 and for GPIB Interfaces
> >that is working in a test sequence loop.
>
> Serial comms is never easy. You need to give us some more information, such
> as what the errors are. Is it possible that each iteration of the loop you
> are opening a reference (eg VISA) and forgetting to close it? Alternatively
> you could place the initialisation outside the loop and the close after
> loop termination (this will increase efficiency).
>
> --
>
> Alexander C. Le Dain, PhD
> ICON Technologies Pty Ltd
> http://www.icon-tech.com.au
>
> ******************************************************************
> * The LabVIEW FAQ http://www.icon-tech.com.au/thelabviewfaq.html *
> ******************************************************************


--
Mike T
0 Kudos
Message 6 of 6
(3,382 Views)