LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is the second serial read delayed 30 sec?

I have two digital scales connected through two separate serial ports. The first one reads fine, the second one reads but the display is on like a 30 sec delay. It is reading the string, because if you put weight on the scale and then let off, the readout will eventually show the weight that you put on the scale
0 Kudos
Message 1 of 5
(2,646 Views)
I can only guess without knowing the instrument or seeing your code but it sounds like the read timeout is set to 30 seconds and the read is waiting for 30 seconds because you have specified the number of characters to read and the instrument's not sending that number. VISA Read waits until the specified number of characters is read or the timeout value is reached. You may also have specified the VISA Read to terminate when a termination character is received. Again, VISA Read will wait until either the term character is seen or the timeout occurs.
0 Kudos
Message 2 of 5
(2,646 Views)
two ideas where to look at:
1: use two treats (independend while-loops) to read the two scales (look if your VISA version supports independent reads, maybe update your VISA driver)
2: if your scales send continiusly values, make shure you empty the buffer to get the most recent values. if you use VISA read with enabled termination char, a simple read with number of bytes (from bytes in buffer) doesn't do the job :-).
monitor the number of bytes in the buffer to make shure you are reading fast enough.
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 5
(2,646 Views)
Yes the scales do send continous data, so how do you empty the buffer.
0 Kudos
Message 4 of 5
(2,646 Views)
'VISA flush I/O Buffer.vi' should work (Somewhere in VISA advanced)
or a 'read VISA while bytes @ port >0' construct
see attached vi.
But keep in mind that you have to sync your data flow after that. the head of your next data might be cutted.
maybe you want to collect the strings read the hole buffer and use a match pattern to get the last valid reading.
something like "[~\f]+\f$" if a formfeed is your termination character


Henrik
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 5
(2,646 Views)