Link to home
Create AccountLog in
Avatar of Colin
ColinFlag for United States of America

asked on

How to clear unwanted characters from COM buffer

I am suppose to be getting back in my COM Buffer the word " LH FLUSH" however along with the LH FLUSH I get the following "UU LH FLUSH" or "UU LH FL?SH" I clear my InBuffer however I still get the result above. My code is below:

            serialPort.BaudRate = "9600"
            serialPort.PortName = "COM" & activeport
            serialPort.Parity = IO.Ports.Parity.None
            serialPort.DataBits = 8
            serialPort.StopBits = 1
            serialPort.RtsEnable = True
            serialPort.Open()


 serialPort.Write("<@:L" & tempArray(0) & Total_Bytes & "<" & UpdatePoint & "," & "0" & Int_Rank & "," & GageDescription & "," & USL & "," & LSL & ">")
                    System.Threading.Thread.Sleep(100)
                    serialresponse1 = serialPort.ReadExisting


What Am I doing Wrong?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Colin

ASKER

Yes you were correct I was sending the commands too fast so the device was not responding in the correct time

Thanks.
That is what handshaking/flow control configuration are designed for.  Does the device require any handshaking, like request-to-send or XOn/XOff?  I see where you had RtsEnable set to true, but you didn't set anything for Handshake...