01-15-2015 04:30 AM
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,
Solved! Go to Solution.
01-15-2015 04:44 AM
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.
01-15-2015 05:03 AM
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,
01-15-2015 05:15 AM
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).
01-15-2015 06:37 AM
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.
01-15-2015 08:19 AM