ā 69 ā
8
Chapter
' Communication Port Settings ****************************************************************
If Com5.Value = True Then
Comm_port = 5 ' COM5
ElseIf Com4.Value = True Then
Comm_port = 4 ' COM4
ElseIf Com3.Value = True Then
Comm_port = 3 ' COM3
ElseIf Com2.Value = True Then
Comm_port = 2 ' COM2
Else
Comm_port = 1 ' COM1
End If
If SPD192.Value = True Then
Comm_speed = "19200," ' 19200bps
ElseIf SPD96.Value = True Then
Comm_speed = "9600," ' 9600bps
Else
Comm_speed = "38400," ' 38400bps
End If
If Even1.Value = True Then
Comm_parity = "E," ' Even parity
ElseIf Odd1.Value = True Then
Comm_parity = "O," ' Odd parity
Else
Comm_parity = "N," ' Parity none
End If
PauseTime = 0.2 ' Sets the wait time. (0.2 sec)
idx = 0
' Opening the Communication Port *************************************************************
MSComm1.CommPort = Comm_port ' COM port settings
MSComm1.Settings = Comm_speed & Comm_parity & "8,1"' Speed / Party / 8bit_Data / Stop_1bit
MSComm1.PortOpen = True ' Port open
' Setting the Communication Number for the Other Party ***************************************
St = Val(Stno1(idx).Text)
Stno = St Mod 256
Stno1(idx).Text = Str(Stno)
' Processing the Address *********************************************************************
AD$ = Str(Val(Address(idx).Text) - 1)
AD$ = Right$(("00000" & AD$), 5)
Area = Val(Left$(AD$, 1))
Adrsh = Int(Val(Right$(AD$, 4)) / 256)
Adrsl = Val(Right$(AD$, 4)) Mod 256