mvPradeepemb (11/6/2008)
Hi All, Private Sub MSComm1_OnComm() Text1.Text = Text1.text & MSComm1.input
End Sub
First off, do as Keith suggested in the Form1_Unload event. Secondly, the way you're using the On_Comm event is like firing a scatter gun with a 6 inch barrel. That is to say it's not discriminating as to what fired On_Comm. On_Comm will fire when any change at the port occurs, including changes in Output, DTR, CTS, Received data, Input & Output Buffer properties and a bunch more. The code below is suitable for inputting text data. The Input mode doesn't typically have to be defined at run time because it's the default value at design (Properties Window) time. Option Explicit
Private Sub Form_Load() MSComm1.InputMode = comInputModeText ' Default in properties window End Sub
Private Sub MSComm1_OnComm() Dim InBuffer As String InBuffer = MSComm1.Input If MSComm1.CommEvent = comEvReceive Then Text1.Text = Text1.Text & InBuffer End If End Sub
Now some Microcontrollers can TX & RX both ASCII and Byte data as HEX. Which are you attempting to input and do you also have to send data to the controller?
________________________________________________________________ "So much to learn. So little time to do it. Wise men know it's later than one thinks"! Mark's Syntax.Zip Pause Sub I don't answer programming questions via PMs. That's what the forum is for!
|