LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boxcar SR245 comunication

Hey everyone:

 

I use the example VI downloaded from NI website (as attached) for boxcar SR245 comunication via RS232. The output to SR245 seems OK. However, the input from SR245 keeps changing when I run the program once after another.  Anyone also use this example VI? What is your experience? Thanks!

 

 

 

 

0 Kudos
Message 1 of 2
(2,600 Views)

Hi,

Instead of using Bytes at Port, I'd simply read a fixed number of bytes - with a timeout.  If you know exactly how many bytes to expect, then read that many bytes.  If you don't know how many bytes to expect, then wire a 'large' number - like 1024 - to byte count, and ignore timeout errors.

I've found Bytes at Port to be unreliable!

 

As a matter of good practice, don't expect local-variables to be updated "instantly".  In your VI it would be better to wire the delay (following VISA Write) directly from the case to the "Wait ms" function.

 

By the way, I WAS going to warn you about the uninitialized shift-register in the while-loop, but realized it's always assigned -1 - and that works as start-offset for Match Pattern - very nice!Smiley Happy 

 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 2
(2,584 Views)