01-20-2016 04:24 AM
I apologize for not being able to show you my actual code, however, my question will sort of start off at a higher level to begin with, anyways. I can find out later what I am allowed to share from work if truly need be.
Basically, I found a significant delay(6ms) after writing out of data(using Visa Write) on a RS-232 port and reading it in on the other side(using Visa Read). To reduce the amount of code complicating the matters I am currently using the "Continuous Serial Read And Write" example to perform a loop back test using on the single port and am finding the same delay. I observe the delay by time stamping out to a file after the message has been written and after the message has been read in, keeping each step aligned within a flat sequence structure to ensure the order is correct. [Visa Write]->[Time Stamp]->[Visa Read]->[Time Stamp]
1. I am using a termination character
2. The port I am using for this specific test is a built in one on the back of a desktop computer.
3. Baud Rate is 9600.
4. The delay is a very consistent 6ms when the size of the write is 3 bytes, but can jump back and forth between 6-8ms when the size is 7 or 8 bytes.
5. The same delay occurs the same no mater if the Visa Read is set to asynchronous or synchronous.
My question is if there is any thing obvious that could cause this 6ms delay. I do not have a lot of experience with serial ports or labview, but from what I am seeing it appears to me the delay is occurring with the visa read. I would think a simple loop back should be far less than 1 ms.
I appreciate any help, and again apologize for not showing any code at this point. I can find out later what I am allowed to share.
01-20-2016 04:34 AM - edited 01-20-2016 04:35 AM
Hi GameDev,
I would think a simple loop back should be far less than 1 ms.
You really think so?
With 9600baud it takes ~10/9600s ~= 1ms to transfer 1 byte. 3 bytes will take atleast 3ms. 8 bytes will take >= 8ms. Simple math!
Serial port operations usually are done asynchronously: Even when the VISAWrite call is done the data isn't transferred to the "cable", it's just written into the serial port transfer buffer! So you need to add additional delays for the serial port driver and hardware… (The same applies to the receive buffer!)