TMS Async operating modes

 I am running TMS async v 2.1.0.1 under C++ buiilder 10.3.3 Community edition. I have external hardware sending RS232 data to C++ Builder running on a Dell vostro 230  with windows 7 64 bit.

 I send a handshake to my external hardware and  receive a return handshake which is captured by VaComm1RxChar(). I then send another handshake and my external hardware immediately sends a stream of data which I wish to accumulate in the software buffer so that I can read it out later. VaComm1RxChar() does the handshaking well but I do not know how to switch it off at runtime in such a way that the data that follows then accumulates in the software buffer without involving VaComm1RxChar() again. I have played with a serial port component from a different supplier which had an 'autoreceive' switch which did divert the data in that manner but it had other problems so I  abandoned it.

Does TMSAsync have a switch or other facility that will allow me to divert the incoming data away from VaComm1RxChar() and into the software buffer only so that it can be read out later ?

OnRxChar is triggered when data is received and you could read the incoming buffer from there but you are not forced to do this. In other words, if after the handshake, you no longer read a single char from OnRxChar but instead want to read data from vaComm with vaComm.ReadBuf() and monitor vaComm.ReadBufUsed to check when sufficient data from the stream is in the read buffer, you can do this outside the OnRxChar event handler.

Thank you for your reply. However, I think I need some more clarification. If I understand you correctly the OnRxChar event handler continues to trigger while data comes in but the data will accumulate in the buffer as long as I don't attempt to read it using ReadChar(). So, after the initial handshaking I have made my code bypass the ReadChar() instruction in the event handler on each input byte and it just exits the routine instead. However, I find that after the data input has finished arriving ReadBufUsed() always returns zero. If, on the other hand, I do read each byte using readChar() I find that the correct number of bytes have arrived each time. So why does the data not stay in the input buffer when I don't attempt to read it?

Yes, as long as you do not perform a read operation, the data accumulates in the read buffer.

If there continues to be incoming data without your code performs read (like ReadChar / ReadBuf / ...) the value for ReadBufUsed should increase. So, I suggest to ensure you stop performing reads and you should see ReadBufUsed change.
Thank you. You are perfectly correct so I've managed to find and eliminate an unwanted purge instruction. However, I find that my data is somewhat corrupted which indicates another fault im my code. Is there any facility to write a logfile of what arrives in the buffer so that I can check it against what my program is reading?

Regards

Edward