LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Running NI CVI81 rs232 samples

I am trying to understand how RS232 commands are sent out the serial port.  I have a loopback cable going to COM2 of my pc and using hyperterminal to check the commands going out COM1.  When I run LabWindows/CVI RS232 serial sample, and step through the code, the hyperterminal receives the command after I have step past several lines of code form where I expect to see the command??? 
0 Kudos
Message 1 of 2
(3,639 Views)
By default, the CVI RS-232 library pushes data to the serial driver (via ComWrt, ComWrtByte) asynchronously.  The library maintains its own output queue (for each thread) to which ComWrt posts data.  There is a separate thread running in the background that monitors this queue and continually passes its contents to driver.  This means that even though a call to ComWrt returns, the data has likely not yet been passed to the driver.  That only happens when a context switch occurs that allows the background thread to run.  This could explain the delay you are seeing.

You can disable the output queue by using OpenComConfig and passing -1 as the output queue size.  This causes ComWrt to pass the data to the driver before returning.

Hope this helps.

Mert A.
National Instruments
0 Kudos
Message 2 of 2
(3,635 Views)