NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Kriti
Posts: 15
0 Kudos

VISA read stalls after few hours during data acquisition via RS232

I am new to labview and have developed a simple VI for acquiring data from an instruments particular channel via RS232 serial communication. Using VISA READ data is read with handshake mechanism for every 30 secs. With an overnight run for data acquiring it was observed that data acquisition stops after few hours (0 is written thereafter). 

Same procedure was repeated with a code written in VB6.0 and there was no distruption in data acquiring for almost 15-16 hrs.

Please find the VI attached. Could you please suggest someway to over come this problem, or if there is any configuration missing while defining VISA?

 

 

Krithika
Trusted Enthusiast
crossrulz
Posts: 3,802
0 Kudos

Re: VISA read stalls after few hours during data acquisition via RS232

1. Why have the outer case structure?  Get rid of that.

2. If you are using the Termination Character, you do not need the Bytes at Port.  Just wire some very large number into the VISA Read function.

3. Don't close out the port with each read.  Close the port outside of the while loop.

4. Use shift regisers for the error clusters to so that errors are not lost.  You are probably getting an error, but not catching it.

5. There's not point in hiding so many of your controls.  Just make them constants on the block diagram.

6. Try to keep wires flowing from left to right.  It'll make it a lot easier to read the code.

7. Do not use a property node to read a value when a wire is easily available.

8. Why convert the read value to a number and then back into a string?  Why not just use the raw string?

 

Here's a snippet of how I cleaned up the code.  Hopefully it'll help.

 



Kudos always welcome for helpful posts...Kudos always welcome for any post.
Knight of NI
Dennis_Knutson
Posts: 29,306
0 Kudos

Re: VISA read stalls after few hours during data acquisition via RS232

A couple of tweaks. If you want to read every 30 seconds, the wait should not be sequential after the write. Just place it by itself inside the loop. If the instrument really needs 30 seconds to respond after the write, I would change the default timeout value and get rid of the wait completely. Since the read will stop on receiving the termination character or when the timeout is reached, you don't need a fixed wait.

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page