LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Read is Slow

Solved!
Go to solution

Hi Folks.

 

I am reading information for a device which sends out its info on startup to the serial port. The VI attached reads it and takes the relevant information from it. The only problem is that it is quiet slow. It takes a few seconds for the data to show up, approx 5 seconds. It should be almost instantaneous as I have seen using hyperterminal. Any idea why this may be?

 

Thanks,

 

Mark.

0 Kudos
Message 1 of 4
(4,301 Views)

Hi Mark,

 

Your timeout is set to 10 seconds, is it possible, that not all 150 bytes are available immediately? Other than that, you should add a stop event case. If you don't have that, you have to click stop and then read to stop the VI.



Remember Cunningham's Law
Message 2 of 4
(4,280 Views)
Solution
Accepted by topic author MarkGreally

Does the instrument use a termination character?  If so, use it.  It will make your life A LOT easier.  Most instruments use a Carriage Return to terminate a message.  If you have that enabled, then the VISA Read would stop when that termination character is found. 

 

If, however, your instrument does not use a termination character, then you need to know EXACTLY how many characters are send out of instrument for the message.  If you guess too few bytes, then you will not get all of the data.  If you guess too many bytes, then you will have to wait for the timeout to happen.

 

So if the message is not 150 bytes, you will be sitting there waiting for 10 seconds.  If the instrument had the termination character, just enable the use of it on the VISA Configure Serial Port and your issue would go away.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 4
(4,255 Views)

I changed the byte count to 130 which is the actual length and now works instantanously. There is no termination character from the device but it is of a fixed length.

 

Thanks for your help.

0 Kudos
Message 4 of 4
(4,206 Views)