LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find a delay time in RS-232

I am trying to connect a balance from Mettler.
 
Despite of almost successful work, I have a trouble to setup between write a command and read data via serial communication.
(Labview Version 8.2.1 and most version for other things)
 
The balance manual indicates I have to setup some handshake mode(CTS, XOR, off) for fast data trasmission.
By default the handshake(HS) mode is "HS Pause" which means some transmission by one second.
 
After modifying the HS XON or off, I wrote my private code to find out the delay time between VISA write and VISA read. (see attachment)
The delay time I observed is around 500 ms (too delayed).
 
However, I have lost frequently some data in continuous execution in 500ms or longer(~1000ms) delay time.
(Sometimes, syntax error sign or blank string was transfered.)
 
My question is how to know the optimum delay time for each instrument??
Or is there some special writing method of command in VISA WRITE function to troubleshoot for my problem?
 
Thank you in advanced.
 

메시지가 08-19-2007 10:34 PM에 labmaster에 의해 편집되었음

0 Kudos
Message 1 of 10
(4,599 Views)
One problem you may have is that in frame 1 of your stacked sequence, you are executing the wait statement concurrently with the VISA write.  So if the VISA write takes longer than 200 msec, you have effectively no wait after it is done writing out the data.  (By the way, what is in frame 0?)
 
Does your device send a termination character?  Perhaps you should not wait at all, and do a VISA read in a loop accumulating the data in a shift register until either you read the termination character, or you hit your own timeout function to end the loop.
0 Kudos
Message 2 of 10
(4,586 Views)

The attahment is an example code for finding some optimal delay time.

(Therefore, please don't care the detail.)

Even in finding the delay time, there are some data loss in continous executing. 

0 Kudos
Message 3 of 10
(4,581 Views)
Make sure the delay happens after the VISA write, not in the same frame as the VISA write.  That means creating another frame.  Try that and see what happens.  By the way, flat sequence structures are generally preferred over stacked sequences.
 
What does the data look like?  Does it have a termination character?  Is it the same length every time?  What is your baud rate?  How many bytes of data are you expecting?  How do you know you are losing data?
 
With your timing functions, your initial time is occurring before the loop.  It could be captured right as you start the VI (most likely), or after the intialization strings, or after the VISA write.  There is no data flow with respect to the Get Time function and the other steps that are occurring before the loop.  What time frame are you trying to measure?  You would want to place that Get Time Function in a sequence that occur right before you do whichever step you are trying to measure so that you can control which instant the timing starts.
 
You say "there is some data loss in continous executing."  How are you continuously executing?  I hope not with the Run Continuous button, in which case the serial configuration VI would be running on every iteration.  What does that VI do?  Could it be doing something to reset the COM port causing the buffer to get flushed?  Since you have no real program loop with a Stop button, the VI looks like it is a run once (Write one query, Read one response) type of VI.

Message Edited by Ravens Fan on 08-20-2007 01:03 AM

0 Kudos
Message 4 of 10
(4,576 Views)
Dear Friends
 
I am also having problem in serial read, actually i am trying to read pressure from Meriam 2110P smart pressure gauge
 
pls see the attached sub vi which i am using in the main program
 
the problem is it is outputting the data for some time and some time not, the serial bytes to read also 0 by the time(it says seriam read error)
 
i feel the problem is some thing related buffer but still i could not come to a conclusion
 
pls advise me to get the data from the instruments continuously
 
Thanks and Regards
 
Sekar
Engineer-LabVIEW
Emerson
0 Kudos
Message 5 of 10
(4,558 Views)
You can try to use this VI after you written out over the serial port.
0 Kudos
Message 6 of 10
(4,541 Views)

Hi Nitroic

thanks

can u send me the vi in LV 8.2

and i am getting error -1073807252 over run error

if there is a solution pls mail me

 

Regards

sekar

0 Kudos
Message 7 of 10
(4,512 Views)

Help/explain error says

Error -1073807252 occurred at an unidentified location

Possible reason(s):

VISA:  (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived.

Then the question is whether the error is occurring at the VISA write or VISA read.  I would guess the read.  Make sure the serial port buffer is sized large enough.

0 Kudos
Message 8 of 10
(4,505 Views)

I saved it for LabView 8.2 and wrote you an example how i use my VI.

Sorry i don't know this error but maybe the example will help you.

0 Kudos
Message 9 of 10
(4,480 Views)
Dear,
 
Thank you for the reply.
I found the final solution.
 
Actually, I used some I/O funcitons such as VISA Flush I/O buffer(mask C0) and VISA Set I/O Buffer Size(mask 60).
Normally, I am very qurious about how to clean the COM port.
 
Thank you in advance.
 
0 Kudos
Message 10 of 10
(4,443 Views)