'A program to read and write the log frequency information from N1MM ' and to allow Linrad to set the frequencies of the HPSDR radios. ' The Linrad data comes to this program via TCP. A TCP Client has been added to ' Linrad. ' On the N1MM computer this program runs as a TCP Server, receiving that data. ' This program also sends frequency commands to the Giga HPSDR radio ' [the N1MM 1st Radio] via a virtual com port. ' It reads band and frequency information from N1MM. ' It receives band/radio information from the Mac Pro Radio controller via the ' RadioManager app running on the MacPro, and uses that information to set the Band ' for the non-Giga SDRs on N1MM. This information comes via the TCP server as well. ' N1MM connects to this program via a virtual serial port; N1MM thinks that this ' program is a Kenwood Radio and communicates with it using Kenwood CAT commands. 'This program uses inpout32.dll to communicate with the bandswitch. 'Inpout32.bas must be included as a module in this program. Rem These are the data pins on the 25 pin d-sub: Rem 2 = bit0 Rem 3 = bit1 Rem 4 = bit2 Rem 5 = bit3 Rem 6 = bit4 Rem 7 = bit5 Rem 8 = bit6 Rem 9 = bit7 Rem printer outputs are as follows: ' 903 is 64 '2304 is 96 '3456 is 97 '5760 is 128 '10368 is 129 '24192 is 160 Public Bandz As String Public newf As String Public oldfreqstr As String Public shortdata As String Public gigafreq As Double Public gigafreqstr As String Public textin As String Public mdmode As String Public mdmode2 As String Public mdmode3 As String Public mdmode4 As String Public mdmode5 As String Public mdmode6 As String Public mdmode7 As String Public newf2 As String Public newf3 As String Public newf4 As String Public newf5 As String Public newf6 As String Public newf7 As String Public sinput As String Public ginput As String Public hinput As String Public iinput As String Public jinput As String Public kinput As String Public minput As String Public ninput As String Public position As Long Public position2 As Long Public position3 As Long Public position4 As Long Public position5 As Long Public position6 As Long Public position7 As Long Public position8 As Long Public positionb As Long Public position2b As Long Public position3b As Long Public position4b As Long Public position5b As Long Public position6b As Long Public position7b As Long Public position8b As Long Public delta As Long Public delta2 As Long Public delta3 As Long Public delta4 As Long Public delta5 As Long Public delta6 As Long Public delta7 As Long Public newstring As String Public newstring2 As String Public newstring3 As String Public newstring4 As String Public newstring5 As String Public newstring6 As String Public newstring7 As String Public ind As Integer Dim strData As String ' string for received data for giga from Linrad Dim strData2 As String 'string for received data for giga from HPSDR Dim strData3 As String 'string for received data for 50 MHz Dim strData4 As String 'string for received data for 144 MHz Dim strData5 As String 'string for received data for 432 MHz Dim strData6 As String 'string for received data for 1296 MHz Dim strData7 As String 'string for received data for 222 MHz Dim strData8 As String 'string for data to send to N1MM from giga for bandswitch Option Explicit Dim PortAddress As Integer Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Command2_Click() tcpClient.Close tcpClient.RemoteHost = "192.168.1.97" tcpClient.RemotePort = 2000 tcpClient.Connect End Sub Private Sub Command1_Click() Unload Form1 tcpServer.Close tcpClient.Close If (MSComm1.PortOpen = True) Then MSComm1.PortOpen = False End If If (MSComm2.PortOpen = True) Then MSComm2.PortOpen = False End If If (MSComm3.PortOpen = True) Then MSComm3.PortOpen = False End If If (MSComm4.PortOpen = True) Then MSComm4.PortOpen = False End If If (MSComm5.PortOpen = True) Then MSComm5.PortOpen = False End If If (MSComm6.PortOpen = True) Then MSComm6.PortOpen = False End If If (MSComm7.PortOpen = True) Then MSComm7.PortOpen = False End If Close #1 End End Sub Public Sub Form_Load() Timer1.Interval = 500 ' Enable timer. Timer1.Enabled = True Form1.Show '// Set the LocalPort property to an integer. '// Then invoke the Listen method. tcpServer.LocalPort = 100 tcpServer.Listen tcpClient.RemoteHost = "192.168.1.97" tcpClient.RemotePort = 2000 tcpClient.Connect Text1 = "" Text3 = "" Text4 = "" Text6 = "0" Text7 = "0" Text8 = "0" Text10 = "0" Text11 = "0" Text12 = "0" newf = "00050125000" mdmode = "2" sinput = "" ginput = "" hinput = "" iinput = "" jinput = "" kinput = "" minput = "" ninput = "" strData = "" strData2 = "" strData3 = "" strData4 = "" strData5 = "" strData6 = "" strData7 = "" Bandz = "1400000" Text17.Text = tcpClient.State PortAddress = &H378 'MSComm1 is COM26-->COM2, and connects to N1MM to set non-Giga bands in N1MM If (MSComm1.PortOpen = True) Then MSComm1.PortOpen = False End If MSComm1.CommPort = 26 MSComm1.InputMode = comInputModeText MSComm1.Settings = "9600,n,8,1" MSComm1.Handshaking = comRTS ' MSComm1.DTREnable = True MSComm1.RTSEnable = True MSComm1.InputLen = 1 MSComm1.RThreshold = 1 MSComm1.SThreshold = 1 MSComm1.InBufferCount = 0 MSComm1.PortOpen = True 'MSComm2 is COM19-->COM20, and is used to communicate with gigaSDR If (MSComm2.PortOpen = True) Then MSComm2.PortOpen = False End If MSComm2.CommPort = 19 MSComm2.InputMode = comInputModeText MSComm2.Settings = "4800,n,8,1" MSComm2.Handshaking = comRTS ' MSComm2.DTREnable = True MSComm2.RTSEnable = True MSComm2.InputLen = 1 MSComm2.RThreshold = 1 MSComm2.SThreshold = 1 MSComm2.InBufferCount = 0 MSComm2.PortOpen = True 'MSComm3 is COM21-->COM22, and connects to 50 MHz SDR If (MSComm3.PortOpen = True) Then MSComm3.PortOpen = False End If MSComm3.CommPort = 21 MSComm3.InputMode = comInputModeText MSComm3.Settings = "4800,n,8,1" MSComm3.Handshaking = comRTS ' MSComm3.DTREnable = True MSComm3.RTSEnable = True MSComm3.InputLen = 1 MSComm3.RThreshold = 1 MSComm3.SThreshold = 1 MSComm3.InBufferCount = 0 MSComm3.PortOpen = True 'MSComm4 is COM23-->COM24, and connects to 144 MHz SDR If (MSComm4.PortOpen = True) Then MSComm4.PortOpen = False End If MSComm4.CommPort = 23 MSComm4.InputMode = comInputModeText MSComm4.Settings = "4800,n,8,1" MSComm4.Handshaking = comRTS ' MSComm4.DTREnable = True MSComm4.RTSEnable = True MSComm4.InputLen = 1 MSComm4.RThreshold = 1 MSComm4.SThreshold = 1 MSComm4.InBufferCount = 0 MSComm4.PortOpen = True 'MSComm5 is COM27-->COM28, and connects to 432 MHz SDR If (MSComm5.PortOpen = True) Then MSComm5.PortOpen = False End If MSComm5.CommPort = 27 MSComm5.InputMode = comInputModeText MSComm5.Settings = "4800,n,8,1" MSComm5.Handshaking = comRTS ' MSComm5.DTREnable = True MSComm5.RTSEnable = True MSComm5.InputLen = 1 MSComm5.RThreshold = 1 MSComm5.SThreshold = 1 MSComm5.InBufferCount = 0 MSComm5.PortOpen = True 'MSComm6 is COM29-->COM30, and connects to 1296 MHz SDR If (MSComm6.PortOpen = True) Then MSComm6.PortOpen = False End If MSComm6.CommPort = 29 MSComm6.InputMode = comInputModeText MSComm6.Settings = "4800,n,8,1" MSComm6.Handshaking = comRTS ' MSComm6.DTREnable = True MSComm6.RTSEnable = True MSComm6.InputLen = 1 MSComm6.RThreshold = 1 MSComm6.SThreshold = 1 MSComm6.InBufferCount = 0 MSComm6.PortOpen = True 'MSComm7 is COM31-->COM32, and connects to 222 MHz SDR If (MSComm7.PortOpen = True) Then MSComm7.PortOpen = False End If MSComm7.CommPort = 31 MSComm7.InputMode = comInputModeText MSComm7.Settings = "4800,n,8,1" MSComm7.Handshaking = comRTS ' MSComm7.DTREnable = True MSComm7.RTSEnable = True MSComm7.InputLen = 1 MSComm7.RThreshold = 1 MSComm7.SThreshold = 1 MSComm7.InBufferCount = 0 MSComm7.PortOpen = True End Sub Private Sub MSComm1_OnComm() Dim sinput As String Select Case MSComm1.CommEvent Case comEvReceive sinput = MSComm1.Input Call HandleInput1(sinput) Case comEventBreak MsgBox "Error", vbCritical + vbOKOnly, "comEventBreak" Case comEventFrame MsgBox "Error", vbCritical + vbOKOnly, "comEventFrame" Case comEventOverrun MsgBox "Error", vbCritical + vbOKOnly, "comEventOverrun" Case comEventRxOver MsgBox "Error", vbCritical + vbOKOnly, "comEventRxOver" Case comEventRxParity MsgBox "Error", vbCritical + vbOKOnly, "comEventRxParity" Case comEventTxFull MsgBox "Error", vbCritical + vbOKOnly, "comEventTxFull" Case comEventDCB MsgBox "Error", vbCritical + vbOKOnly, "comEventDCB" End Select End Sub Private Sub MSComm2_OnComm() Dim ginput As String Select Case MSComm2.CommEvent Case comEvReceive ginput = MSComm2.Input Call HandleInput2(ginput) Case comEventBreak MsgBox "Error", vbCritical + vbOKOnly, "comEventBreak" Case comEventFrame MsgBox "Error", vbCritical + vbOKOnly, "comEventFrame" Case comEventOverrun MsgBox "Error", vbCritical + vbOKOnly, "comEventOverrun" Case comEventRxOver MsgBox "Error", vbCritical + vbOKOnly, "comEventRxOver" Case comEventRxParity MsgBox "Error", vbCritical + vbOKOnly, "comEventRxParity" Case comEventTxFull MsgBox "Error", vbCritical + vbOKOnly, "comEventTxFull" Case comEventDCB MsgBox "Error", vbCritical + vbOKOnly, "comEventDCB" End Select End Sub Private Sub MSComm3_OnComm() Dim hinput As String Select Case MSComm3.CommEvent Case comEvReceive hinput = MSComm3.Input Call HandleInput3(hinput) Case comEventBreak MsgBox "Error", vbCritical + vbOKOnly, "comEventBreak" Case comEventFrame MsgBox "Error", vbCritical + vbOKOnly, "comEventFrame" Case comEventOverrun MsgBox "Error", vbCritical + vbOKOnly, "comEventOverrun" Case comEventRxOver MsgBox "Error", vbCritical + vbOKOnly, "comEventRxOver" Case comEventRxParity MsgBox "Error", vbCritical + vbOKOnly, "comEventRxParity" Case comEventTxFull MsgBox "Error", vbCritical + vbOKOnly, "comEventTxFull" Case comEventDCB MsgBox "Error", vbCritical + vbOKOnly, "comEventDCB" End Select End Sub Private Sub MSComm4_OnComm() Dim iinput As String Select Case MSComm4.CommEvent Case comEvReceive iinput = MSComm4.Input Call HandleInput4(iinput) Case comEventBreak MsgBox "Error", vbCritical + vbOKOnly, "comEventBreak" Case comEventFrame MsgBox "Error", vbCritical + vbOKOnly, "comEventFrame" Case comEventOverrun MsgBox "Error", vbCritical + vbOKOnly, "comEventOverrun" Case comEventRxOver MsgBox "Error", vbCritical + vbOKOnly, "comEventRxOver" Case comEventRxParity MsgBox "Error", vbCritical + vbOKOnly, "comEventRxParity" Case comEventTxFull MsgBox "Error", vbCritical + vbOKOnly, "comEventTxFull" Case comEventDCB MsgBox "Error", vbCritical + vbOKOnly, "comEventDCB" End Select End Sub Private Sub MSComm5_OnComm() Dim jinput As String Select Case MSComm5.CommEvent Case comEvReceive jinput = MSComm5.Input Call HandleInput5(jinput) Case comEventBreak MsgBox "Error", vbCritical + vbOKOnly, "comEventBreak" Case comEventFrame MsgBox "Error", vbCritical + vbOKOnly, "comEventFrame" Case comEventOverrun MsgBox "Error", vbCritical + vbOKOnly, "comEventOverrun" Case comEventRxOver MsgBox "Error", vbCritical + vbOKOnly, "comEventRxOver" Case comEventRxParity MsgBox "Error", vbCritical + vbOKOnly, "comEventRxParity" Case comEventTxFull MsgBox "Error", vbCritical + vbOKOnly, "comEventTxFull" Case comEventDCB MsgBox "Error", vbCritical + vbOKOnly, "comEventDCB" End Select End Sub Private Sub MSComm6_OnComm() Dim kinput As String Select Case MSComm6.CommEvent Case comEvReceive kinput = MSComm6.Input Call HandleInput6(kinput) Case comEventBreak MsgBox "Error", vbCritical + vbOKOnly, "comEventBreak" Case comEventFrame MsgBox "Error", vbCritical + vbOKOnly, "comEventFrame" Case comEventOverrun MsgBox "Error", vbCritical + vbOKOnly, "comEventOverrun" Case comEventRxOver MsgBox "Error", vbCritical + vbOKOnly, "comEventRxOver" Case comEventRxParity MsgBox "Error", vbCritical + vbOKOnly, "comEventRxParity" Case comEventTxFull MsgBox "Error", vbCritical + vbOKOnly, "comEventTxFull" Case comEventDCB MsgBox "Error", vbCritical + vbOKOnly, "comEventDCB" End Select End Sub Private Sub MSComm7_OnComm() Dim minput As String Select Case MSComm7.CommEvent Case comEvReceive minput = MSComm7.Input Call HandleInput7(minput) Case comEventBreak MsgBox "Error", vbCritical + vbOKOnly, "comEventBreak" Case comEventFrame MsgBox "Error", vbCritical + vbOKOnly, "comEventFrame" Case comEventOverrun MsgBox "Error", vbCritical + vbOKOnly, "comEventOverrun" Case comEventRxOver MsgBox "Error", vbCritical + vbOKOnly, "comEventRxOver" Case comEventRxParity MsgBox "Error", vbCritical + vbOKOnly, "comEventRxParity" Case comEventTxFull MsgBox "Error", vbCritical + vbOKOnly, "comEventTxFull" Case comEventDCB MsgBox "Error", vbCritical + vbOKOnly, "comEventDCB" End Select End Sub Sub HandleInput1(sinput As String) Text17.Text = tcpClient.State Text3 = Text3 & sinput ' Text16 = Text16 & sinput MSComm1.OutBufferCount = 0 DoEvents position = InStr(Text3, ";") If (position >= 3) Then If position > 13 Then positionb = position - 13 Text14 = Text14 & Text3 Else: positionb = 0 End If If Right$(Text3, position) = "IF;" Then 'Text4 = Bandz Text3 = "" MSComm1.Output = "IF" & newf & "0011+00000000000" & mdmode & "0000000;" MSComm1.OutBufferCount = 0 ElseIf Right$(Text3, position) = "FA;" Then 'Text4 = Bandz Text3 = "" MSComm1.Output = "FA" & newf & ";" MSComm1.OutBufferCount = 0 ElseIf Right$(Text3, position) = "FB;" Then 'Text4 = Bandz Text3 = "" MSComm1.Output = "FB" & newf & ";" MSComm1.OutBufferCount = 0 ElseIf Right$(Text3, position) = "MD2;" Then 'Text4 = Bandz Text3 = "" If ((Val(newf) > 49000000) And (Val(newf) < 55000000)) Then 'Bandz = "50000" MSComm3.OutBufferCount = 0 MSComm3.Output = "MD2;" MSComm3.OutBufferCount = 0 ElseIf ((Val(newf) > 143000000) And (Val(newf) < 149000000)) Then 'Bandz = "144000" MSComm4.OutBufferCount = 0 MSComm4.Output = "MD2;" MSComm4.OutBufferCount = 0 ElseIf ((Val(newf) > 221000000) And (Val(newf) < 225000000)) Then 'Bandz = "222000" MSComm7.OutBufferCount = 0 MSComm7.Output = "MD2;" MSComm7.OutBufferCount = 0 ElseIf ((Val(newf) > 420000000) And (Val(newf) < 450000000)) Then 'Bandz = "432000" MSComm5.OutBufferCount = 0 MSComm5.Output = "MD2;" MSComm5.OutBufferCount = 0 ElseIf ((Val(newf) > 1240000000#) And (Val(newf) < 1300000000#)) Then 'Bandz = "1296000" MSComm6.OutBufferCount = 0 MSComm6.Output = "MD2;" MSComm6.OutBufferCount = 0 ElseIf ((Val(newf) > 900000000) And (Val(newf) < 1000000000)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD2;" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 2300000000#) And (Val(newf) < 24500000000#)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD2;" MSComm2.OutBufferCount = 0 End If ElseIf Right$(Text3, position) = "MD7;" Then 'Text4 = Bandz Text3 = "" If ((Val(newf) > 49000000) And (Val(newf) < 55000000)) Then 'Bandz = "50000" MSComm3.OutBufferCount = 0 MSComm3.Output = "MD7;" MSComm3.OutBufferCount = 0 ElseIf ((Val(newf) > 143000000) And (Val(newf) < 149000000)) Then 'Bandz = "144000" MSComm4.OutBufferCount = 0 MSComm4.Output = "MD7;" MSComm4.OutBufferCount = 0 ElseIf ((Val(newf) > 221000000) And (Val(newf) < 225000000)) Then 'Bandz = "222000" MSComm7.OutBufferCount = 0 MSComm7.Output = "MD7;" MSComm7.OutBufferCount = 0 ElseIf ((Val(newf) > 420000000) And (Val(newf) < 450000000)) Then 'Bandz = "432000" MSComm5.OutBufferCount = 0 MSComm5.Output = "MD7;" MSComm5.OutBufferCount = 0 ElseIf ((Val(newf) > 1240000000#) And (Val(newf) < 1300000000#)) Then 'Bandz = "1296000" MSComm6.OutBufferCount = 0 MSComm6.Output = "MD7;" MSComm6.OutBufferCount = 0 ElseIf ((Val(newf) > 900000000) And (Val(newf) < 1000000000)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD7;" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 2300000000#) And (Val(newf) < 24500000000#)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD7;" MSComm2.OutBufferCount = 0 End If ElseIf Right$(Text3, position) = "MD3;" Then 'Text4 = Bandz Text3 = "" If ((Val(newf) > 49000000) And (Val(newf) < 55000000)) Then 'Bandz = "50000" MSComm3.OutBufferCount = 0 MSComm3.Output = "MD3;" MSComm3.OutBufferCount = 0 ElseIf ((Val(newf) > 143000000) And (Val(newf) < 149000000)) Then 'Bandz = "144000" MSComm4.OutBufferCount = 0 MSComm4.Output = "MD3;" MSComm4.OutBufferCount = 0 ElseIf ((Val(newf) > 221000000) And (Val(newf) < 225000000)) Then 'Bandz = "222000" MSComm7.OutBufferCount = 0 MSComm7.Output = "MD3;" MSComm7.OutBufferCount = 0 ElseIf ((Val(newf) > 420000000) And (Val(newf) < 450000000)) Then 'Bandz = "432000" MSComm5.OutBufferCount = 0 MSComm5.Output = "MD3;" MSComm5.OutBufferCount = 0 ElseIf ((Val(newf) > 1240000000#) And (Val(newf) < 1300000000#)) Then 'Bandz = "1296000" MSComm6.OutBufferCount = 0 MSComm6.Output = "MD3;" MSComm6.OutBufferCount = 0 ElseIf ((Val(newf) > 900000000) And (Val(newf) < 1000000000)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD3;" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 2300000000#) And (Val(newf) < 24500000000#)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD3;" MSComm2.OutBufferCount = 0 End If ElseIf Right$(Text3, position) = "MD1;" Then 'Text4 = Bandz Text3 = "" If ((Val(newf) > 49000000) And (Val(newf) < 55000000)) Then 'Bandz = "50000" MSComm3.OutBufferCount = 0 MSComm3.Output = "MD1;" MSComm3.OutBufferCount = 0 ElseIf ((Val(newf) > 143000000) And (Val(newf) < 149000000)) Then 'Bandz = "144000" MSComm4.OutBufferCount = 0 MSComm4.Output = "MD1;" MSComm4.OutBufferCount = 0 ElseIf ((Val(newf) > 221000000) And (Val(newf) < 225000000)) Then 'Bandz = "222000" MSComm7.OutBufferCount = 0 MSComm7.Output = "MD1;" MSComm7.OutBufferCount = 0 ElseIf ((Val(newf) > 420000000) And (Val(newf) < 450000000)) Then 'Bandz = "432000" MSComm5.OutBufferCount = 0 MSComm5.Output = "MD1;" MSComm5.OutBufferCount = 0 ElseIf ((Val(newf) > 1240000000#) And (Val(newf) < 1300000000#)) Then 'Bandz = "1296000" MSComm6.OutBufferCount = 0 MSComm6.Output = "MD1;" MSComm6.OutBufferCount = 0 ElseIf ((Val(newf) > 900000000) And (Val(newf) < 1000000000)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD1;" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 2300000000#) And (Val(newf) < 24500000000#)) Then 'Bandz = "1400000" MSComm2.OutBufferCount = 0 MSComm2.Output = "MD1;" MSComm2.OutBufferCount = 0 End If ElseIf positionb <> 0 Then If ((Mid$(Text3, positionb, 2) = "FA")) Then Text13.Text = Mid$(Text3, positionb + 2, 11) newf = Text13.Text Text3 = "" positionb = 0 MSComm1.Output = "FA" & Text13.Text & ";" MSComm1.OutBufferCount = 0 If ((Val(newf) > 49000000) And (Val(newf) < 55000000)) Then Bandz = "50000" If tcpClient.State = 7 Then tcpClient.SendData "0" & vbCrLf End If MSComm3.OutBufferCount = 0 MSComm3.Output = "FA" & newf & ";" MSComm3.OutBufferCount = 0 ElseIf ((Val(newf) > 143000000) And (Val(newf) < 149000000)) Then Bandz = "144000" If tcpClient.State = 7 Then tcpClient.SendData "1" & vbCrLf End If MSComm4.OutBufferCount = 0 MSComm4.Output = "FA" & newf & ";" MSComm4.OutBufferCount = 0 ElseIf ((Val(newf) > 221000000) And (Val(newf) < 225000000)) Then Bandz = "222000" If tcpClient.State = 7 Then tcpClient.SendData "2" & vbCrLf End If MSComm7.OutBufferCount = 0 MSComm7.Output = "FA" & newf & ";" MSComm7.OutBufferCount = 0 ElseIf ((Val(newf) > 420000000) And (Val(newf) < 450000000)) Then Bandz = "432000" If tcpClient.State = 7 Then tcpClient.SendData "3" & vbCrLf End If MSComm5.OutBufferCount = 0 MSComm5.Output = "FA" & newf & ";" MSComm5.OutBufferCount = 0 ElseIf ((Val(newf) > 1240000000#) And (Val(newf) < 1300000000#)) Then Bandz = "1296000" If tcpClient.State = 7 Then tcpClient.SendData "4" & vbCrLf End If MSComm6.OutBufferCount = 0 MSComm6.Output = "FA" & newf & ";" MSComm6.OutBufferCount = 0 ElseIf ((Val(newf) > 900000000) And (Val(newf) < 1000000000)) Then Out PortAddress, 64 Bandz = "1400000" If tcpClient.State = 7 Then tcpClient.SendData "5" & vbCrLf End If MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & newf & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 2300000000#) And (Val(newf) < 2500000000#)) Then Out PortAddress, 96 Bandz = "1400000" If tcpClient.State = 7 Then tcpClient.SendData "5" & vbCrLf End If MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & newf & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 3300000000#) And (Val(newf) < 3500000000#)) Then Out PortAddress, 97 Bandz = "1400000" If tcpClient.State = 7 Then tcpClient.SendData "5" & vbCrLf End If MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & newf & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 5650000000#) And (Val(newf) < 5925000000#)) Then Out PortAddress, 128 Bandz = "1400000" If tcpClient.State = 7 Then tcpClient.SendData "5" & vbCrLf End If MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & newf & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 10000000000#) And (Val(newf) < 10500000000#)) Then Out PortAddress, 129 Bandz = "1400000" If tcpClient.State = 7 Then tcpClient.SendData "5" & vbCrLf End If MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & newf & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(newf) > 24000000000#) And (Val(newf) < 24500000000#)) Then Out PortAddress, 160 Bandz = "1400000" If tcpClient.State = 7 Then tcpClient.SendData "5" & vbCrLf End If MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & newf & ";" MSComm2.OutBufferCount = 0 End If End If ElseIf Right$(Text3, position) = "FR0;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "FR1;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "AI0;" Then Text3 = "" MSComm1.Output = "?;" MSComm1.OutBufferCount = 0 ElseIf Right$(Text3, position) = "FT0;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "FT1;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "MD9;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "MD8;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "MD6;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "MD5;" Then 'Text4 = Bandz Text3 = "" ElseIf Right$(Text3, position) = "MD4;" Then 'Text4 = Bandz Text3 = "" End If Else Text3 = Text3 If Len(Text3) > 50 Then Text3 = "" End If End If End Sub Sub HandleInput2(ginput As String) strData2 = strData2 & ginput DoEvents position2 = InStr(strData2, "IF") position2b = Len(strData2) If ((position2 <> 0) And (position2b <> 0)) Then delta2 = position2b - position2 If (delta2 >= 36) Then newstring2 = Mid$(strData2, position2, (position2 + 36)) newf2 = Mid$(newstring2, 3, 11) Text15 = newf2 mdmode2 = Mid$(newstring2, 30, 1) If (Bandz = "1400000") Then 'Text1.Text = mdmode2 mdmode = mdmode2 newf = newf2 Text4.Text = newf End If strData2 = "" MSComm2.InBufferCount = 0 delta2 = 0 position2 = 0 position2b = 0 Text12.Text = Str$(Val(Text12) + 1) If Val(Text12) > 999 Then Text12 = "0" MSComm2.OutBufferCount = 0 MSComm2.Output = "IF" & newf & "0011+00000000000" & mdmode & "0000000;" MSComm2.OutBufferCount = 0 End If End If Text1.Text = "GIGA" If ((Val(newf) > 900000000) And (Val(newf) < 1000000000)) Then Out PortAddress, 64 ElseIf ((Val(newf) > 2300000000#) And (Val(newf) < 2500000000#)) Then Out PortAddress, 96 ElseIf ((Val(newf) > 3300000000#) And (Val(newf) < 3800000000#)) Then Out PortAddress, 97 ElseIf ((Val(newf) > 5650000000#) And (Val(newf) < 5925000000#)) Then Out PortAddress, 128 ElseIf ((Val(newf) > 10000000000#) And (Val(newf) < 10500000000#)) Then Out PortAddress, 129 ElseIf ((Val(newf) > 24000000000#) And (Val(newf) < 24500000000#)) Then Out PortAddress, 160 End If End Sub Sub HandleInput3(hinput As String) strData3 = strData3 & hinput DoEvents position3 = InStr(strData3, "IF") position3b = Len(strData3) If ((position3 <> 0) And (position3b <> 0)) Then delta3 = position3b - position3 If (delta3 >= 36) Then newstring3 = Mid$(strData3, position3, (position3 + 36)) newf3 = Mid$(newstring3, 3, 11) mdmode3 = Mid$(newstring3, 30, 1) If (Bandz = "50000") Then 'Text1.Text = mdmode3 mdmode = mdmode3 newf = newf3 Text4.Text = newf End If strData3 = "" MSComm3.InBufferCount = 0 delta3 = 0 position3 = 0 position3b = 0 Text6.Text = Str$(Val(Text6) + 1) If Val(Text6) > 999 Then Text6 = "0" End If End If Text1.Text = "50" End Sub Sub HandleInput4(iinput As String) 'Text4 = iInput strData4 = strData4 & iinput DoEvents position4 = InStr(strData4, "IF") position4b = Len(strData4) If ((position4 <> 0) And (position4b <> 0)) Then delta4 = position4b - position4 If (delta4 >= 36) Then newstring4 = Mid$(strData4, position4, (position4 + 36)) newf4 = Mid$(newstring4, 3, 11) mdmode4 = Mid$(newstring4, 30, 1) If (Bandz = "144000") Then 'Text1.Text = mdmode4 mdmode = mdmode4 newf = newf4 Text4.Text = newf End If strData4 = "" MSComm4.InBufferCount = 0 delta4 = 0 position4 = 0 position4b = 0 Text7.Text = Str$(Val(Text7) + 1) If Val(Text7) > 999 Then Text7 = "0" End If End If Text1.Text = "144" End Sub Sub HandleInput5(jinput As String) 'Text4 = jInput strData5 = strData5 & jinput DoEvents position5 = InStr(strData5, "IF") position5b = Len(strData5) If ((position5 <> 0) And (position5b <> 0)) Then delta5 = position5b - position5 If (delta5 >= 36) Then newstring5 = Mid$(strData5, position5, (position5 + 36)) newf5 = Mid$(newstring5, 3, 11) mdmode5 = Mid$(newstring5, 30, 1) If (Bandz = "432000") Then 'Text1.Text = mdmode5 mdmode = mdmode5 newf = newf5 Text4.Text = newf End If strData5 = "" MSComm5.InBufferCount = 0 delta5 = 0 position5 = 0 position5b = 0 Text8.Text = Str$(Val(Text8) + 1) If Val(Text8) > 999 Then Text8 = "0" End If End If Text1.Text = "432" End Sub Sub HandleInput6(kinput As String) 'Text4 = kInput strData6 = strData6 & kinput DoEvents position6 = InStr(strData6, "IF") position6b = Len(strData6) If ((position6 <> 0) And (position6b <> 0)) Then delta6 = position6b - position6 If (delta6 >= 36) Then newstring6 = Mid$(strData6, position6, (position6 + 36)) newf6 = Mid$(newstring6, 3, 11) mdmode6 = Mid$(newstring6, 30, 1) If (Bandz = "1296000") Then 'Text1.Text = mdmode6 mdmode = mdmode6 newf = newf6 Text4.Text = newf End If strData6 = "" MSComm6.InBufferCount = 0 delta6 = 0 position6 = 0 position6b = 0 Text10.Text = Str$(Val(Text10) + 1) If Val(Text10) > 999 Then Text10 = "0" End If End If Text1.Text = "1296" End Sub Sub HandleInput7(minput As String) 'Text4 = mInput strData7 = strData7 & minput DoEvents position7 = InStr(strData7, "IF") position7b = Len(strData7) If ((position7 <> 0) And (position7b <> 0)) Then delta7 = position7b - position7 If (delta7 >= 36) Then newstring7 = Mid$(strData7, position7, (position7 + 36)) newf7 = Mid$(newstring7, 3, 11) mdmode7 = Mid$(newstring7, 30, 1) If (Bandz = "222000") Then Text1.Text = mdmode7 mdmode = mdmode7 newf = newf7 Text4.Text = newf End If strData7 = "" MSComm7.InBufferCount = 0 delta7 = 0 position7 = 0 position7b = 0 Text11.Text = Str$(Val(Text11) + 1) If Val(Text11) > 999 Then Text11 = "0" End If End If Text1.Text = "222" End Sub Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long) ' Check if the control's State is closed. If not, ' close the connection before accepting the new ' connection. If tcpServer.State <> sckClosed Then tcpServer.Close ' Accept the request with the requestID ' parameter. tcpServer.Accept requestID End Sub Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long) Dim strData As String tcpServer.GetData strData If ((strData <> 50000) And (strData <> 144000) And (strData <> 222000) And (strData <> 432000) And (strData <> 903000) And (strData <> 1296000) And (strData <> 1400000)) Then Text5.Text = Mid(strData, 1, 9) shortdata = Mid(Text5, 1, 8) If ((Val(Text15) > 900000000) And (Val(Text15) < 1000000000)) Then gigafreq = 875000000 + Val(Text5) gigafreqstr = "00" & Mid$(Str$(gigafreq), 2) Text2 = gigafreqstr MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & gigafreqstr & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(Text15) > 2300000000#) And (Val(Text15) < 2500000000#)) Then gigafreq = 2276000000# + Val(Text5) gigafreqstr = "0" & Mid$(Str$(gigafreq), 2) Text2 = gigafreqstr MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & gigafreqstr & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(Text15) > 3300000000#) And (Val(Text15) < 3800000000#)) Then gigafreq = 3428000000# + Val(Text5) gigafreqstr = "0" & Mid$(Str$(gigafreq), 2) Text2 = gigafreqstr MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & gigafreqstr & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(Text15) > 5650000000#) And (Val(Text15) < 5900000000#)) Then gigafreq = 5732000000# + Val(Text5) gigafreqstr = "0" & Mid$(Str$(gigafreq), 2) Text2 = gigafreqstr MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & gigafreqstr & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(Text15) > 10000000000#) And (Val(Text15) < 10500000000#)) Then gigafreq = 10340000000# + Val(Text5) gigafreqstr = Mid$(Str$(gigafreq), 2) Text2 = gigafreqstr MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & gigafreqstr & ";" MSComm2.OutBufferCount = 0 ElseIf ((Val(Text15) > 24000000000#) And (Val(Text15) < 24500000000#)) Then gigafreq = 24164000000# + Val(Text5) gigafreqstr = Mid$(Str$(gigafreq), 2) Text2 = gigafreqstr MSComm2.OutBufferCount = 0 MSComm2.Output = "FA" & gigafreqstr & ";" MSComm2.OutBufferCount = 0 End If Else Bandz = strData If Bandz = "50000" Then newf = newf3 mdmode = mdmode3 ElseIf Bandz = "144000" Then newf = newf4 mdmode = mdmode4 ElseIf Bandz = "222000" Then newf = newf7 mdmode = mdmode7 ElseIf Bandz = "432000" Then newf = newf5 mdmode = mdmode5 ElseIf Bandz = "1296000" Then newf = newf6 mdmode = mdmode6 ElseIf Bandz = "1400000" Then newf = newf2 mdmode = mdmode2 If ((Val(newf2) > 900000000) And (Val(newf2) < 1000000000)) Then Out PortAddress, 64 ElseIf ((Val(newf2) > 2300000000#) And (Val(newf2) < 2500000000#)) Then Out PortAddress, 96 ElseIf ((Val(newf2) > 3300000000#) And (Val(newf2) < 3800000000#)) Then Out PortAddress, 97 ElseIf ((Val(newf2) > 5650000000#) And (Val(newf2) < 5900000000#)) Then Out PortAddress, 128 ElseIf ((Val(newf2) > 10000000000#) And (Val(newf2) < 10500000000#)) Then Out PortAddress, 129 ElseIf ((Val(newf2) > 24000000000#) And (Val(newf2) < 24500000000#)) Then Out PortAddress, 160 End If Else Bandz = Bandz newf = newf mdmode = mdmode End If 'Text1.Text = mdmode Text4.Text = newf End If tcpServer.Close Sleep 250 tcpServer.Listen End Sub Private Sub Timer1_Timer() MSComm2.OutBufferCount = 0 MSComm2.Output = "IF;" MSComm2.OutBufferCount = 0 MSComm3.OutBufferCount = 0 MSComm3.Output = "IF;" MSComm3.OutBufferCount = 0 MSComm4.OutBufferCount = 0 MSComm4.Output = "IF;" MSComm4.OutBufferCount = 0 MSComm5.OutBufferCount = 0 MSComm5.Output = "IF;" MSComm5.OutBufferCount = 0 MSComm6.OutBufferCount = 0 MSComm6.Output = "IF;" MSComm6.OutBufferCount = 0 MSComm7.OutBufferCount = 0 MSComm7.Output = "IF;" MSComm7.OutBufferCount = 0 End Sub