VB serial comms

B

Thread Starter

Brad Stallion

Currently I am trying to communicate with an external device via a rs-232 connection. Using mscomm with VB6. I am able to send the device a 4 byte data packet to which it responds with a 3 byte packet repeatedly until it receives a 1 byte stop command or another 4 byte packet data request. The received data is then parsed to retrieve only the last byte.

For reasons unknown to myself, the OnComm event is fired 3 times resulting in the 3rd byte being extracted and displayed 3 times. Something easily written around but I have opted to try using different methods.

Currently the RTthreshold is set to 3, as is InputLen. If i set InBufferCount = 0 after the Input has been transfered to a string then the OnComm event only fires once leaving me with just the one copy of the 1st byte (exactly what I want!). But this becomes a problem when I try and loop the whole process to receive different data from the device. It appears that because I set the InBufferCount to 0 that it prevents OnComm from firing more than once.

Is there any way to alter the InBufferCount settings again to allow it to fire again? Or is my only option to leave InBufferCount alone and just parse the resultant string?

Many thanks,
Brad
 
Top