Is comm1 the COM component for the serial port? If so, I guess you must
either assign a string or an array of bytes to the output property, but I'm
not sure because I can't test it here. Otherwise, using VB 2005, you should
consider using the System.IO.Ports.SerialPort class instead.
Armin- Hide quoted text -
- Show quoted text -
Yes, comm1 is the COM component for the serial port. Here is all the
code which is assocaited with this object.
Public Sub SetupCOM(ByVal comPort As Integer)
'initialize the com if it has not been already
If IsNothing(comm1) Then
comm1 = New MSComm
End If
'set the properties of the com port
comm1.CommPort = comPort
comm1.Settings = "57600,n,8,1"
'open the port and clear the buffer if it is not alread open
(which it better not be)
If Not comm1.PortOpen Then
comm1.PortOpen = True
comm1.InBufferCount = 0
System.Threading.Thread.CurrentThread.Sleep(100)
End If
End Sub
Public Sub GetIndicator_Info()
Dim Len As Byte = 6
Dim Cmd As Byte = 7
Dim loPass_byte As Byte = 28
Dim hiPass_byte As Byte = 45
Dim CRClo_byte As Byte = 48
Dim CRChi_byte As Byte = 130
comm1.InBufferCount = 0
comm1.InputLen = 0
comm1.InputMode = InputModeConstants.comInputModeText
Dim i As Integer
Dim Packet(6) As Byte
Packet(0) = 42 'Hex 2A
Packet(1) = 6
Packet(2) = 7
Packet(3) = 28
Packet(4) = 45
Packet(5) = 48
Packet(6) = 130
For i = 0 To 6
Thread.Sleep(5)
comm1.Output = Packet(i)
Next i
End Sub