-
see the output
Hi everybody
i hv questions to ask. Please take a look at the following code.
While moRS232.Read(1) = -1
End While
If i want to know what the Read method is reading, i can write the output to the console. Is it "console.writeline.......something " ? can anyone advice ?
besides, does anyone know how this code is used and why "- 1" is used in this case ?
Hereby, i would like to thank u all first....thank u very much
-
Re: see the output
Hi
You can use console.writeline everywhere and the lines will be display the output window.
Regards
Jorge
-
Re: see the output
Hi,
moRS232 refers to the com settings, part of the code is shown below.
Private Sub btnOpenCom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenCom.Click
moRS232 = New Rs232()
Try
'// Setup parameters
With moRS232
.Port = miComPort
.BaudRate = CInt(txtBaudrate.Text)
.DataBit = 8
.StopBit = Rs232.DataStopBit.StopBit_1
.Parity = Rs232.DataParity.Parity_None
.Timeout = CInt(txtTimeout.Text)
.WorkingMode = CType(IIf(chkOl.Checked, Rs232.Mode.Overlapped, Rs232.Mode.NonOverlapped), Rs232.Mode)
btnAsyncTx.Enabled = (.WorkingMode = Rs232.Mode.Overlapped)
btnAsync.Enabled = (.WorkingMode = Rs232.Mode.Overlapped)
chkOl.Enabled = False
End With
'// Initializes port
moRS232.Open()
'// Set state of RTS / DTS
moRS232.Dtr = (chkDTR.CheckState = CheckState.Checked)
moRS232.Rts = (chkRTS.CheckState = CheckState.Checked)
Catch Ex As Exception
MessageBox.Show(Ex.Message, "Connection Error", MessageBoxButtons.OK)
Finally
btnCloseCom.Enabled = moRS232.IsOpen
btnOpenCom.Enabled = Not moRS232.IsOpen
btnTx.Enabled = moRS232.IsOpen
btnRx.Enabled = moRS232.IsOpen
btnCheck.Enabled = moRS232.IsOpen
End Try
End Sub