i need help reading and writing data to a serial port.
the settings for the port are correct (from manual of device):
baud rate: 19.2K
data bits: 8
parity: None
start bits: 1
stop bits: 1
what is the "address" used in the manual?
with the exception of the address assignment message the general format of messages between the personal computer and the instrument will be in the format:
<address><OP>[<PARAM>[,<PARAM>...]]:<CR><LF>
the instrument will echo back the message recieved from the personal computer using te general format:
<address>*OK[<PARAM>[<PARAM>...]]:<CR><LF><ETX>
Visual Basic code:
do i need an imports system.io. ... ?
can someone please help me?
tnx,
chris,
the settings for the port are correct (from manual of device):
baud rate: 19.2K
data bits: 8
parity: None
start bits: 1
stop bits: 1
what is the "address" used in the manual?
with the exception of the address assignment message the general format of messages between the personal computer and the instrument will be in the format:
<address><OP>[<PARAM>[,<PARAM>...]]:<CR><LF>
the instrument will echo back the message recieved from the personal computer using te general format:
<address>*OK[<PARAM>[<PARAM>...]]:<CR><LF><ETX>
Visual Basic code:
VB.NET:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SerialPort1.Open()
SerialPort1.Write("STAR<08FF>:<CR><LF>")
'STAR<adress>:<CR><LF>
'As an assignment of a new address regardles of whether an address is
'currently assigned or not. This address will be recognized in all subsequent messages.
'Messages which contain an address other than that assigned to the device will be ignored.
SerialPort1.ReadTo(Label1.Text)
SerialPort1.Write("<08FF>*RE<1>:<CR><LF>") '08FF is chosen by myself, so i don't think it's the right one
'<adress>*RE<file#>:<CR><LF>
'Informs the instrument of a request to read the history file screen data for the designated history file.
'The message is echoed back to validate the communications channel, or an error message if the requested file number is invalid
'or does not contain sweep nor normalized sweep data.
' SerialPort1.Write("<08FF>*OK*RE<1>:<CR><LF>") '<address>*OK[<PARAM>[<PARAM>...]]:<CR><LF> => string to read data?
SerialPort1.ReadTo(Label2.Text)
SerialPort1.Close()
End Sub
End Class
do i need an imports system.io. ... ?
can someone please help me?
tnx,
chris,