LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Instrument Communication Problem

I have a Pressure control device that I communicate with via serial port using VISA with LabVIEW 7.1. I have written the driver which does nothing more than ask the instrument for a reading on channel 1 and 2. If I run this driver alone, it operates flawlessly over and over. However, when I include this driver in my main application, it fails to get a reading at least one out of every ten tries. I am only polling it every 8 seconds and it has its own dedicated serial port. Any suggestions as to why this is happening?
0 Kudos
Message 1 of 4
(2,562 Views)
Hi,
 
What do you mean by "running this driver alone"?  Do you use Labview at this point and run it only once or is it standalone?  If standalone, what form does the driver take (dll, exe, obj)?
 
How do you set it up in your main application?  Do you open / configure the port, then proceed to read it within a loop, then close the port upon exiting the loop?
 
I am wondering if it is related to some sort of timing issue.  Not necessarily due to the serial communication, but rather from the speed at which the pressure sensor samples and prepares the data fro transmition.  However, 8 seconds should be more than enough... but you never know.  What does the mfg recommend as far as taking measurements?  Can't be this... I've worked with pressure transducers where we took readings 100 times per second..  but this was done using a DAQ card.... 
 
Are you able to post the portion of your vi which shows the serial communication?  If possible in version 7.0..  or an image.
 
Also, any information on the mfg and model number. 
 
A reading every 8 seconds should be fine..  When it fails to get a reading, do you get an error message on the serial vi?  If so, can you post the error?  Can you also describe what you get (if anything) when it fails to get a reading?  
 
Ray
Message 2 of 4
(2,560 Views)
Nevermind, I found the problem. When I run my main application, a subVI before hand writes to the buffer. Then when I try to read a different value, I get the previous command from the buffer. I solved it by flushing the buffer before I take a new reading. Thanks for your reply though!
Message 3 of 4
(2,544 Views)
Hi,
 
No problem.  Glad you resolved the issue. 
And thanks for sharing, it may help someone in the future.
 
😄
 
Message 4 of 4
(2,540 Views)