LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA read very slow communication

Solved!
Go to solution

Hi,

 

Im using VISA serial communication in my project and i noticed that the read block is working very slow.
I have microcontroller which connected through XBee modules to my Laptop.
The baud rate currently is 9600 due to the fact that change this factor in each component in the line will not make a difference at all.
Also I checked this with XCTU terminal and its working fine (very fast). so its can't be something else except from the read VISA.
Please see attached VI file.

 

Thanks for any help,

0 Kudos
Message 1 of 6
(6,403 Views)

Does your serial communications use a termination character and if so, have you configured it? I suspect that the VISA Read is timing out (you can also change the timeout) because either the termination character isn't configured or there aren't as many bytes at the serial port as you have asked it to read.

 

Unfortunately I can't open your VI as I don't have LV2014 (if you can save for LV2013 or take a screenshot I can have a look) but those are the first things that I'd check.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 6
(6,391 Views)

Thanks for your reply Sam,
Regarding your question, no I didn't configured a termination character, I would like that the read buffer will read permanently all the time.
The microcontroller send data according to the code and the events in the state machine.
Please advise if it's possible?
Please find attached picture.
Thanks,test2.jpg

0 Kudos
Message 3 of 6
(6,381 Views)
Solution
Accepted by doron_str@walla.com

If you don't use a termination character, then the VISA read will sit and wait until 100 characters have been received by the COM port or the timeout elapses (which is probably something long like 5-10 seconds). You can change the timeout (using a property node) or reduce the number of characters you read each time the loop runs.

 

Without a termination character, you will need to build up your own string buffer using a shift register - each time you do a VISA read, add it to the string on the shift register and then do some string parsing to pick out the commands from your microcontroller (e.g. Alarm, coordinates) and remove everything before the commands from the buffer (e.g. if you started the VI in the middle of a command then you would want to discard that data).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 6
(6,369 Views)

Thanks Sam,


The issue resolved following your suggestion "You can change the timeout (using a property node)" .
I simply added the property node and configure time and its now working fine.

 

Thank you very much for your prompt assistance. 

0 Kudos
Message 5 of 6
(6,351 Views)
That is not a very robust solution. Why have you configured the VISA Read to wait for a termination character when you haven't configured the writer to send one? If you don't program the micro to send one, you can use the VISA Bytes at Serial Port function.
0 Kudos
Message 6 of 6
(6,333 Views)