LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why the RS232 library function "ComWrt()" don't work?

I use RS232 function ComWrt() to send a null terminated string, I use GetUserEvent to manage the contro panel comand buttons ,and when the user press some button it uses CmWrt() to send data, but at the same time i've installed a SerialComm Callback to listen for incomming data requests. The problem is that when the user pres"F1 send data", it doesnt send nothing to the other PC, but whe I run the programm in the debbug mode that is what happens: I puted a breakpoint exactly before the ComWrt() and I start a debbug with F8 (step into), so when i pass trouhg the function it sends the data and the programm in the other side responds to the data sended.?Why it only works in debbug mode? In release mode the programm runs
and nothing happen when I push "F1 send Data".(looks like there's no function in the instructions sequence)
0 Kudos
Message 1 of 3
(3,252 Views)
Hi,

I had a look a the ComWrt() function. You should be aware that it does NOT send the data. It only puts the data into the output queue of the serial port AND returns immediatly.

So there should be another task, which does the actual sending of the data in the queue.
If there's a immediate thread switch after you ComWrt() command, that task won't get any processor time. If you step through your source code in debug mode, the timing is totally different.

Ok, so far the theory. What you could try is calling the GetOutQLen() function directly after calling ComWrt(). Check whether the bytes are already sent. If not wait, then check again.

You should also check the mails about the topics 'RS232' and 'synchronous' in that forum.

Hope I could help you


Bye
Message 2 of 3
(3,252 Views)
Also check the mail with the topic "problems using comport" from yesterday !
0 Kudos
Message 3 of 3
(3,252 Views)