VERSION 5.00 Begin VB.Form DSWTUN95 AutoRedraw = -1 'True Caption = "DSWTUN95 rel. 4.02 by n4qa" ClientHeight = 3810 ClientLeft = 60 ClientTop = 405 ClientWidth = 4455 LinkTopic = "Form1" ScaleHeight = 3810 ScaleWidth = 4455 StartUpPosition = 3 'Windows Default Begin VB.ListBox speed Height = 450 ItemData = "next.frx":0000 Left = 1200 List = "next.frx":000A TabIndex = 44 Top = 1680 Width = 495 End Begin VB.CommandButton Command31 Caption = "W1AW" Height = 855 Left = 3000 TabIndex = 43 Top = 1560 Width = 255 End Begin VB.CommandButton Command30 Caption = "QRP" Height = 255 Left = 2280 TabIndex = 42 Top = 2520 Width = 615 End Begin VB.CommandButton Command29 Caption = "WWV" Height = 255 Left = 2280 TabIndex = 41 Top = 2160 Width = 615 End Begin VB.CommandButton Command28 Caption = "CHU" Height = 255 Left = 2280 TabIndex = 40 Top = 1800 Width = 615 End Begin VB.TextBox Text5 Height = 255 Left = 3480 TabIndex = 38 Top = 720 Width = 855 End Begin VB.CommandButton Command27 Caption = "C" Height = 255 Left = 3000 TabIndex = 37 Top = 2520 Width = 255 End Begin VB.CommandButton Command26 Caption = "E" Height = 255 Left = 4080 TabIndex = 36 Top = 2520 Width = 255 End Begin VB.CommandButton Command25 Caption = "." Height = 255 Left = 3720 TabIndex = 35 Top = 2520 Width = 255 End Begin VB.CommandButton Command24 Caption = "0" Height = 255 Left = 3360 TabIndex = 34 Top = 2520 Width = 255 End Begin VB.CommandButton Command23 Caption = "3" Height = 255 Left = 4080 TabIndex = 33 Top = 2160 Width = 255 End Begin VB.CommandButton Command22 Caption = "2" Height = 255 Left = 3720 TabIndex = 32 Top = 2160 Width = 255 End Begin VB.CommandButton Command21 Caption = "1" Height = 255 Left = 3360 TabIndex = 31 Top = 2160 Width = 255 End Begin VB.CommandButton Command20 Caption = "6" Height = 255 Left = 4080 TabIndex = 30 Top = 1800 Width = 255 End Begin VB.CommandButton Command19 Caption = "5" Height = 255 Left = 3720 TabIndex = 29 Top = 1800 Width = 255 End Begin VB.CommandButton Command18 Caption = "4" Height = 255 Left = 3360 TabIndex = 28 Top = 1800 Width = 255 End Begin VB.CommandButton Command17 Caption = "9" Height = 255 Left = 4080 TabIndex = 27 Top = 1440 Width = 255 End Begin VB.CommandButton Command16 Caption = "8" Height = 255 Left = 3720 TabIndex = 26 Top = 1440 Width = 255 End Begin VB.CommandButton Command15 Caption = "7" Height = 255 Left = 3360 TabIndex = 25 Top = 1440 Width = 255 End Begin VB.TextBox Text4 Height = 285 Left = 1800 TabIndex = 24 Top = 3480 Width = 375 End Begin VB.ListBox DSW Height = 840 ItemData = "next.frx":0019 Left = 120 List = "next.frx":0029 TabIndex = 23 Top = 1320 Width = 735 End Begin VB.OptionButton RIT_OFF Caption = "RIT OFF" Height = 255 Left = 2040 TabIndex = 22 Top = 1560 Width = 975 End Begin VB.OptionButton RIT_ON Caption = "RIT ON" Height = 255 Left = 2040 TabIndex = 21 Top = 1320 Width = 975 End Begin VB.TextBox Text3 Height = 285 Left = 2160 TabIndex = 18 Top = 720 Width = 855 End Begin VB.TextBox Text2 Height = 285 Left = 120 TabIndex = 17 Top = 3480 Width = 1455 End Begin VB.CommandButton Command1 Caption = "annun-ciate" Height = 495 Left = 120 TabIndex = 16 Top = 720 Width = 615 End Begin VB.CommandButton Command2 Caption = "Step size" Height = 495 Left = 120 TabIndex = 15 Top = 2280 Width = 615 End Begin VB.CommandButton Command3 Caption = "up 1 step" Height = 495 Left = 120 TabIndex = 14 Top = 120 Width = 615 End Begin VB.CommandButton Command4 Caption = "dn 1 step" Height = 495 Left = 120 TabIndex = 13 Top = 2880 Width = 615 End Begin VB.CommandButton Command5 Caption = "up 5 steps" Height = 495 Left = 840 TabIndex = 12 Top = 120 Width = 615 End Begin VB.CommandButton Command6 Caption = "dn 5 steps" Height = 495 Left = 840 TabIndex = 11 Top = 2880 Width = 615 End Begin VB.CommandButton Command7 Caption = "up 25 steps" Height = 495 Left = 1560 TabIndex = 10 Top = 120 Width = 615 End Begin VB.CommandButton Command8 Caption = "dn 25 steps" Height = 495 Left = 1560 TabIndex = 9 Top = 2880 Width = 615 End Begin VB.CommandButton Command9 Caption = "up 125 steps" Height = 495 Left = 2280 TabIndex = 8 Top = 120 Width = 615 End Begin VB.CommandButton Command10 Caption = "dn 125 steps" Height = 495 Left = 2280 TabIndex = 7 Top = 2880 Width = 615 End Begin VB.CommandButton Command11 Caption = "up 500 steps" Height = 495 Left = 3000 TabIndex = 6 Top = 120 Width = 615 End Begin VB.CommandButton Command12 Caption = "dn 500 steps " Height = 495 Left = 3000 TabIndex = 5 Top = 2880 Width = 615 End Begin VB.CommandButton Command13 Caption = "up 5k steps" Height = 495 Left = 3720 TabIndex = 4 Top = 120 Width = 615 End Begin VB.CommandButton Command14 Caption = "dn 5k steps" Height = 495 Left = 3720 TabIndex = 3 Top = 2880 Width = 615 End Begin VB.TextBox Text1 Height = 285 Left = 1080 TabIndex = 2 Top = 720 Width = 855 End Begin VB.ComboBox Port Height = 315 ItemData = "next.frx":004D Left = 3600 List = "next.frx":0060 TabIndex = 1 Top = 3480 Width = 735 End Begin VB.ComboBox Encoder Height = 315 ItemData = "next.frx":007E Left = 2520 List = "next.frx":0088 TabIndex = 0 Top = 3480 Width = 735 End Begin VB.Label Label4 Caption = "Step speed" Height = 495 Left = 1200 TabIndex = 45 Top = 2280 Width = 495 End Begin VB.Label Label3 Caption = "Freq entry" Height = 255 Left = 3480 TabIndex = 39 Top = 1080 Width = 735 End Begin VB.Label Label2 Caption = "Rcv freq" Height = 255 Left = 2280 TabIndex = 20 Top = 1080 Width = 735 End Begin VB.Label Label1 Caption = "Xmit freq" Height = 255 Left = 1200 TabIndex = 19 Top = 1080 Width = 735 End End Attribute VB_Name = "DSWTUN95" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False 'DSWTUN95, release 4.02 by William K. Mabry, N4QA, 15 March 2003 Private Declare Function hrt_delay_alloc Lib "winhrt32" Alias "#17" (ByVal howlong As Long, ByVal rez As Integer) As Integer Private Declare Sub hrt_delay_free Lib "winhrt32" Alias "#20" (ByVal whichone As Integer) Private Declare Sub hrt_delay_do Lib "winhrt32" Alias "#19" (ByVal whichone As Integer) Private Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer) Private Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer Dim step_speed Dim baby_steps Dim big_steps Dim w1aw Dim step Dim wwv Dim chu Dim qrp Dim lower_limit Dim upper_limit Dim lasttext2$ Dim change Dim laststep Dim lastchange Dim number_of_steps Dim a Sub step_tog() If RIT_ON = True Then GoTo bypass Select Case Port Case Is = 632, 888, 956 before = Inp(Port + 2) Out Port + 2, before Or 1 hrt_delay_do 2 Out Port + 2, before And 254 hrt_delay_do 2 Case Else Out Port + 1, 254 hrt_delay_do 2 Out Port + 1, 255 hrt_delay_do 2 End Select If step = 200 Then step = 50: Text2 = " 50 Hz steps T/R" Else step = 200: Text2 = "200 Hz steps T/R": If step = 200 Then change = 0.2: laststep = 200: lastchange = 0.2: lasttext2$ = "200 Hz steps T/R" Else change = 0.05: laststep = 50: lastchange = 0.05: lasttext2$ = " 50 Hz steps T/R" bypass: End Sub Private Sub Command15_Click() Text5 = Text5 + "7" End Sub Private Sub Command16_Click() Text5 = Text5 + "8" End Sub Private Sub Command17_Click() Text5 = Text5 + "9" End Sub Private Sub Command18_Click() Text5 = Text5 + "4" End Sub Private Sub Command19_Click() Text5 = Text5 + "5" End Sub Private Sub Command20_Click() Text5 = Text5 + "6" End Sub Private Sub Command21_Click() Text5 = Text5 + "1" End Sub Private Sub Command22_Click() Text5 = Text5 + "2" End Sub Private Sub Command23_Click() Text5 = Text5 + "3" End Sub Private Sub Command24_Click() Text5 = Text5 + "0" End Sub Private Sub Command25_Click() Text5 = Text5 + "." End Sub Sub Command26_Click() If Val(Text5) < 540 Or Val(Text5) > 25000 Then GoTo bypass newfreq = CDbl(Text5) If newfreq < lower_limit Or newfreq > upper_limit Then GoTo bypass If (newfreq * 100) Mod 5 <> 0 Then GoTo bypass If RIT_ON = True Then oldfreq = CDbl(Text3) Else oldfreq = CDbl(Text1) diff = oldfreq - newfreq baby_steps = CInt(((diff * 100) Mod 20) * 0.2) big_steps = CLng((diff - (baby_steps * 0.05)) / 0.2) rit_steps = (big_steps * 4) + baby_steps If RIT_ON = True Then number_of_steps = rit_steps dosteps hrt_delay_do 1 GoTo bypass Else Select Case baby_steps Case Is = 0 Case Else Select Case step Case Is = 200 step_tog While (step = 200) Wend number_of_steps = baby_steps dosteps hrt_delay_do 1 step_tog While (step = 50) Wend Case Else number_of_steps = baby_steps dosteps hrt_delay_do 1 End Select End Select Select Case big_steps Case Is = 0 Case Else Select Case step Case Is = 50 step_tog While (step = 50) Wend number_of_steps = big_steps dosteps hrt_delay_do 1 step_tog While (step = 200) Wend Case Else If step = 50 Then step_tog Else number_of_steps = big_steps dosteps hrt_delay_do 1 End Select End Select End If bypass: Text5 = "" End Sub Private Sub Command27_Click() Text5 = "" End Sub Private Sub Command28_Click() Text5 = Str(chu) End Sub Private Sub Command29_Click() Text5 = Str(wwv) End Sub Private Sub Command30_Click() Text5 = Str(qrp) End Sub Private Sub Command31_Click() Text5 = Str(w1aw) End Sub Sub DSW_Click() Select Case DSW Case Is = "DSW-80" Text1 = 3560: Text3 = 3560 upper_limit = 25000 lower_limit = 540 w1aw = 3581.5 chu = 3330.8 wwv = 5000.8 qrp = 3560 Case Is = "DSW-40" Text1 = 7040: Text3 = 7040 upper_limit = 25000 lower_limit = 540 w1aw = 7047.5 chu = 7335.8 wwv = 10000.8 qrp = 7040 Case Is = "DSW-30" Text1 = 10110: Text3 = 10110 upper_limit = 25000 lower_limit = 540 w1aw = 7047.5 chu = 7334.2 wwv = 9999.2 qrp = 10110 Case Is = "DSW-20" Text1 = 14060: Text3 = 14060 upper_limit = 25000 lower_limit = 540 w1aw = 14047.5 chu = 14669.2 wwv = 14999.2 qrp = 14060 Case Else Text1 = 0: Text3 = 0 End Select End Sub Sub form_load() Port = 888 Encoder = 1 RIT_OFF = True RIT_ON = False step = 200 laststep = 200 change = 0.2 lastchange = 0.2 lasttext2$ = "200 Hz steps T/R" Text2 = "200 Hz steps T/R" Text1 = 0 Text3 = 0 Out 632, 255 Out 634, 244 Out 888, 255 Out 890, 244 Out 956, 255 Out 958, 244 static_code = Inp(Port) Select Case static_code Case Is = 255 Text4 = "11B" Case Is = 243 Text4 = "00B" Case Else Text4 = "**" End Select Text5 = "" freq_annun_delay = hrt_delay_alloc(55, HRT_MILLISECOND) 'returns '1' freq_step_toggle_delay = hrt_delay_alloc(650, HRT_MILLISECOND) 'returns '2' freq_tune_pulses_low = hrt_delay_alloc(2600, HRT_MICROSECOND) 'returns '3' freq_tune_pulses_hi = hrt_delay_alloc(26, HRT_MICROSECOND) 'returns '4' a = True speed = "Low" End Sub Sub Command1_Click() Select Case Port Case Is = 632, 888, 956 before = Inp(Port + 2) Out Port + 2, before Or 1 hrt_delay_do 1 Out Port + 2, before And 254 Case Else Out Port + 1, 254 hrt_delay_do 1 Out Port + 1, 255 End Select End Sub Sub Command2_Click() step_tog End Sub Sub Command3_Click() number_of_steps = -1 dosteps End Sub Sub Command4_Click() number_of_steps = 1 dosteps End Sub Private Sub Command5_Click() number_of_steps = -5 dosteps End Sub Private Sub Command6_Click() number_of_steps = 5 dosteps End Sub Private Sub Command7_Click() number_of_steps = -25 dosteps End Sub Private Sub Command8_Click() number_of_steps = 25 dosteps End Sub Private Sub Command9_Click() number_of_steps = -125 dosteps End Sub Private Sub Command10_Click() number_of_steps = 125 dosteps End Sub Private Sub Command11_Click() number_of_steps = -500 dosteps End Sub Private Sub Command12_Click() number_of_steps = 500 dosteps End Sub Private Sub Command13_Click() number_of_steps = -5000 dosteps End Sub Private Sub Command14_Click() number_of_steps = 5000 dosteps End Sub Sub dosteps() If number_of_steps < 0 Then up Else dn End Sub Sub up() Select Case Encoder Case Is = 1 Do While number_of_steps < 0 Select Case a Case Is = True up1a Case Else up1b End Select number_of_steps = number_of_steps + 1 Text3 = Text3 + change If RIT_ON = False Then Text1 = Text3 Loop Case Is = 2 Do While number_of_steps < 0 up2 number_of_steps = number_of_steps + 1 Text3 = Text3 + change If RIT_ON = False Then Text1 = Text3 Loop End Select static_code = Inp(Port) Select Case static_code Case Is = 255 Text4 = "11B" Case Is = 243 Text4 = "00B" Case Else Text4 = "**" End Select End Sub Sub dn() Select Case Encoder Case Is = 1 Do While number_of_steps > 0 Select Case a Case Is = True dn1a Case Else dn1b End Select number_of_steps = number_of_steps - 1 Text3 = Text3 - change If RIT_ON = False Then Text1 = Text3 Loop Case Is = 2 Do While number_of_steps > 0 dn2 number_of_steps = number_of_steps - 1 Text3 = Text3 - change If RIT_ON = False Then Text1 = Text3 Loop End Select static_code = Inp(Port) Select Case static_code Case Is = 255 Text4 = "11B" Case Is = 243 Text4 = "00B" Case Else Text4 = "**" End Select End Sub Sub up1a() Out Port, 251 hrt_delay_do step_speed Out Port, 243 a = False hrt_delay_do step_speed End Sub Sub up1b() Out Port, 247 hrt_delay_do step_speed Out Port, 255 a = True hrt_delay_do step_speed End Sub Sub dn1a() Out Port, 247 hrt_delay_do step_speed Out Port, 243 a = False hrt_delay_do step_speed End Sub Sub dn1b() Out Port, 251 hrt_delay_do step_speed Out Port, 255 a = True hrt_delay_do step_speed End Sub Sub up2() Out Port, 251 hrt_delay_do step_speed Out Port, 243 hrt_delay_do step_speed Out Port, 247 hrt_delay_do step_speed Out Port, 255 hrt_delay_do step_speed End Sub Sub dn2() Out Port, 247 hrt_delay_do step_speed Out Port, 243 hrt_delay_do step_speed Out Port, 251 hrt_delay_do step_speed Out Port, 255 hrt_delay_do step_speed End Sub Private Sub speed_Click() Select Case speed Case Is = "Low" step_speed = 3 Case Is = "High" step_speed = 4 End Select End Sub Sub RIT_OFF_Click() step = laststep change = lastchange Select Case Port Case Is = 632, 888, 956 before = Inp(Port + 2) Out Port + 2, before And 253 Case Else Out Port + 2, 255 End Select Text2 = lasttext2$ Text3 = Text1 End Sub Sub RIT_ON_Click() step = 50 change = 0.05 Text2 = " 50 Hz steps R" Select Case Port Case Is = 632, 888, 956 before = Inp(Port + 2) Out Port + 2, before Or 2 Case Else Out Port + 2, 254 End Select End Sub