LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

The serial problems

hello!

Excuse me, why did the same to PC to send serial data, laptops and desktops with USB 232 serial data receiving circuit. But the desktop and notebook receiving data is not the same, not the baud rate of the test.

0 Kudos
Message 1 of 4
(4,390 Views)

Duplicated post. Discussion continues here.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(4,377 Views)

 

I will accept the 7000 byte why I call serial callback function receiving, receiving incomplete.

The following settings:

 

InstallComCallback (COM_Port, LWRS_RECEIVE, 1, (int) gEventChar[0], Event_Char_Detect_Func, 0);

 

Void CVICALLBACK Event_Char_Detect_Func (int portNo, int eventMask, void *callbackData)

{

Txt_FILE[n]=ComRdByte (COM_Port);

ComRd (COM_Port, Txt_FILE, FILE_ESIZE);

FlushInQ (COM_Port);

}

0 Kudos
Message 3 of 4
(4,371 Views)

Well, your callback is fired on the first byte received in the input queue, there is no guarantee that all subsequent 6999 are there too when you call ComRd, or you have set an insufficient timeout on the read. How much time is your external device expected to take to transmit the whole message?

If you don't want to rely on the timeout on read, you should either wait for all bytes to be present beforre reading or repeat ComRd in a loop and accumulate bytes in a buffer until the message is complete.

In any case you must handle the return code for both ComRdByte and ComRd to be warned for any problem and handle it.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(4,360 Views)