serial communication

wong

Member
Joined
Jul 17, 2008
Messages
13
Location
Johor,Malaysia
Programming Experience
Beginner
Hi,i am using serial communication to read from a plc.The plc will send a string :&H3A as a header byte then C(which is a variable that contains data)I want to read and mask out the header byte.I use the following code but cannot read anything.Any suggestions?

Private Sub btnread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnread.Click
Msg = SerialPort1.ReadExisting
count = Val(Mid(Msg, 3, 2))

Lblno.Text = count
End Sub
 
Back
Top