Im currently working on serial port RS232 communication, im able to set configurations thru serial port to my device, but having problems reading from the port. So im posting the same questions in a few VB forum, with the hope to obtain various valuable comments and suggestions..

I'm sending out command in ascii form, for example:

I want to set the "run" state of spectrum analyzer, its command is Q1 CR

therefore, inside a button event handler, i wrote:

Try

SerialPort1.Write(Chr(81) & Chr(49) & Chr(13))

Catch ex As Exception

MsgBox(ex.ToString)

End Try






As for reading from the serial port part, the problems come where, i put the below source codes, and the results is that the value is changing extremely fast like overflow that i cant really read the values measured. The values received from the spectrum analyzer are integer value. like, -70, etc...sometimes the value remain constant... how do i set the timer so that the port will poll for new incoming data at certain interval, say 1second,... and it discards the same incoming value as the present one, and only display an incoming data which is different from present.

But then, im confused because the fast changing figure are not really numbers we can read, instead i get something like, n ? E, etc.. What should i do with them so that i can read the actual value.

Besides, if i want to display the incoming data in an an real time graph, what should i use inside the toolbox?

'Read signals

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

SerialPort1.WriteLine(Chr(82) & Chr(51) & Chr(13) & vbCrLf)

End Sub

Private Sub DataReceived( _

ByVal sender As Object, _

ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _

Handles SerialPort1.DataReceived

TextBox3.Invoke(New _

myDelegate(AddressOf updateTextBox3), _

New Object() {})

End Sub

Public Delegate Sub myDelegate()

Public Sub updateTextBox3()


End Sub





Your help is very much appreciated!