Public Class Form1

    ' TCVR Icom používá protokol tvaru FE FE A4 E0 Cn Sc Data FD
    ' Cn je příkaz (Command) Sc Subcommand
    ' Data pro nastavování/čtení frekvencí jsou složena z 5 bajtů, níže pořadí 5-4-3-2-1, data se použijí pro Cn: 00, 03, 05 a 1C 03
    Dim jmenoportu As String = "COM3"
    Dim br1 As Integer = 9600
    Dim Prikaz As String

    Dim b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, colapse As Byte       ' deklarace bajtů - hodnoty 0 až 9
    Dim bajts(0 To 11) As Byte
    Dim vfo_a(0 To 11) As Byte
    Dim vfo_b(0 To 11) As Byte
    Dim povel_2b(0 To 11) As Byte

    Private Sub SaveSettings()      'Uloží cosi do registrů
        Dim key = "HKEY_CURRENT_USER\Software\IcomPC"

        My.Computer.Registry.SetValue(key, "WindowLeft", Me.Left)
        My.Computer.Registry.SetValue(key, "WindowTop", Me.Top)

        My.Computer.Registry.SetValue(key, "jmeno_portu", jmenoportu)
        My.Computer.Registry.SetValue(key, "Baud_Rate", br1)

    End Sub

    Private Sub LoadSettings()
        Dim key = "HKEY_CURRENT_USER\Software\IcomPC"

        Me.Left = CInt(My.Computer.Registry.GetValue(key, "WindowLeft", Me.Left))
        Me.Top = CInt(My.Computer.Registry.GetValue(key, "WindowTop", Me.Top))

        jmenoportu = CStr(My.Computer.Registry.GetValue(key, "jmeno_portu", ""))
        br1 = CStr(My.Computer.Registry.GetValue(key, "Baud_Rate", ""))

    End Sub

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing
        SaveSettings()
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        LoadSettings()
        Try
            SerialPort1.PortName = jmenoportu
            SerialPort1.BaudRate = br1
        Catch
            jmenoportu = "COM3"
            br1 = 9600
        End Try

        Nastav_com()

        Text = "IC-706: " + jmenoportu + "/Baud: " + CStr(br1) + ", napsal: ok1ufc"

        'přiřazení konstant protokolu Icom

        bajts(1) = 254
        vfo_a(1) = 254
        vfo_b(1) = 254
        povel_2b(1) = 254                      ' preambule FE
        bajts(2) = 254
        vfo_a(2) = 254
        vfo_b(2) = 254
        povel_2b(2) = 254                      ' preambule FE
        bajts(3) = NumericUpDown11.Value
        vfo_a(3) = NumericUpDown11.Value
        vfo_b(3) = NumericUpDown11.Value
        povel_2b(3) = NumericUpDown11.Value    ' adresa Icom 706, hexadecimálně 58
        bajts(4) = 224
        vfo_a(4) = 224
        vfo_b(4) = 224
        povel_2b(4) = 224                      ' adresa kontroleru, hex E0
        bajts(5) = 5                                                            ' příkaz set freq, příkaz hexadecimálně 00 nebo 05
        vfo_a(5) = 7
        vfo_a(6) = 0
        vfo_b(5) = 7
        vfo_b(6) = 1
        povel_2b(5) = 15
        povel_2b(6) = 1
        bajts(11) = 253
        vfo_a(7) = 253
        vfo_b(7) = 253
        povel_2b(7) = 253                     ' konec - znak FD
        povel_2b(8) = 253

    End Sub

    Private Sub Vyssi_rad()         'pro bajty b2, b4, b6 a b8 se přepočítává základ, pomocná proměnná je b0

        b0 = b2
        Zaklad()
        b2 = b0

        b0 = b4
        Zaklad()
        b4 = b0

        b0 = b6
        Zaklad()
        b6 = b0

        b0 = b8
        Zaklad()
        b8 = b0

    End Sub
    Private Sub Zaklad()            'pomocná proměnná je b0, přepočtení řádu (základu)

        If b0 = 0 Then
            b0 = 0
        End If
        If b0 = 1 Then
            b0 = 16
        End If
        If b0 = 2 Then
            b0 = 32
        End If
        If b0 = 3 Then
            b0 = 48
        End If
        If b0 = 4 Then
            b0 = 64
        End If
        If b0 = 5 Then
            b0 = 80
        End If
        If b0 = 6 Then
            b0 = 96
        End If
        If b0 = 7 Then
            b0 = 112
        End If
        If b0 = 8 Then
            b0 = 128
        End If
        If b0 = 9 Then
            b0 = 144
        End If

    End Sub
    Private Sub Nastav_com()    'nastavování sériových portů
        SerialPort1.Close()     'na otevřeném portu nelze měnit parametry
        SerialPort1.PortName = jmenoportu
        SerialPort1.BaudRate = br1
    End Sub

    Private Sub Posli_bajty()   'posílání bajtů
        SerialPort1.Close()     'když se dvakrát za sebou otevře, tak se to zesere, tak ho zavírám
        SerialPort1.Open()      'otevření serial portu
        SerialPort1.Write(bajts, 1, 11) ' toto skutečně pošle bajty do Icom 7200
    End Sub
    Private Sub Pasma()
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 2
        NumericUpDown3.Value = 6
        NumericUpDown4.Value = 9
        NumericUpDown5.Value = 8
        NumericUpDown6.Value = 5
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub
    Private Sub Nastavuj()

        bajts(3) = NumericUpDown11.Value        'nastavení adresy TCVRu

        'přiřazení hodnot bajtům z NumericUpdown objektů pro zadávání

        b1 = NumericUpDown1.Value
        b2 = NumericUpDown2.Value
        b3 = NumericUpDown3.Value
        b4 = NumericUpDown4.Value
        b5 = NumericUpDown5.Value
        b6 = NumericUpDown6.Value
        b7 = NumericUpDown7.Value
        b8 = NumericUpDown8.Value
        b9 = 0

        Vyssi_rad()  ' procedura kvůli Icomu

        'přiřazení dvojice dvou bajtů, které tvoří jeden bajt dat v protokolu Icom

        bajts(6) = b8 + b9
        bajts(7) = b6 + b7
        bajts(8) = b4 + b5
        bajts(9) = b2 + b3
        bajts(10) = b1

        Prikaz = "Set F (MHz): " + Str(bajts(10)) + ", " + Str(bajts(9)) + ", " + Str(bajts(8)) + ", " + Str(bajts(7)) + ", " + Str(bajts(6))

        Posli_bajty()              'posílání bajtů protokolem Icom
    End Sub
 
    Private Sub Cti_serial()
        For i As Integer = 1 To 11
            If SerialPort1.BytesToRead > 0 Then
                bajts(i) = SerialPort1.ReadByte()       ' toto přijme byte a dosadí jako číslo!
            End If
        Next i

        Prikaz = "SYNC Dusimplex TX: " + Str(bajts(10)) + ", " + Str(bajts(9)) + ", " + Str(bajts(8)) + ", " + Str(bajts(7)) + ", " + Str(bajts(6))
    End Sub

    Private Sub Split_ON()
        povel_2b(5) = 15
        povel_2b(6) = 1

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "SPLIT ON: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub
    Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Nastavuj()
    End Sub

    Private Sub VFO_Asub()

        vfo_a(5) = 7
        vfo_a(6) = 0
        vfo_b(5) = 7
        vfo_b(6) = 1
        SerialPort1.Close()
        SerialPort1.Open()

        Prikaz = "VFO A: " + Str(vfo_a(2)) + ", " + Str(vfo_a(3)) + ", " + Str(vfo_a(4)) + ", " + Str(vfo_a(5)) + ", " + Str(vfo_a(6))
        SerialPort1.Write(vfo_a, 1, 7)          ' nastavi VFO A
        SerialPort1.Close()

    End Sub

    Private Sub VFO_Bsub()

        vfo_a(5) = 7
        vfo_a(6) = 0
        vfo_b(5) = 7
        vfo_b(6) = 1
        SerialPort1.Close()
        SerialPort1.Open()

        Prikaz = "VFO B: " + Str(vfo_b(2)) + ", " + Str(vfo_b(3)) + ", " + Str(vfo_b(4)) + ", " + Str(vfo_b(5)) + ", " + Str(vfo_b(6))
        SerialPort1.Write(vfo_b, 1, 7)          ' nastavi VFO A
        SerialPort1.Close()

    End Sub

    Private Sub Split_ONsub()
        povel_2b(5) = 15
        povel_2b(6) = 1

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "SPLIT ON: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub A_Bsub()
        vfo_a(5) = 7
        vfo_a(6) = 160
        SerialPort1.Close()
        SerialPort1.Open()

        Prikaz = "A=B: " + Str(vfo_a(2)) + ", " + Str(vfo_a(3)) + ", " + Str(vfo_a(4)) + ", " + Str(vfo_a(5)) + ", " + Str(vfo_a(6))
        SerialPort1.Write(vfo_a, 1, 7)          ' nastavi VFO A
        SerialPort1.Close()

    End Sub

    Private Sub Split_OFFsub()
        povel_2b(5) = 15
        povel_2b(6) = 0

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "SPLIT OFF: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub USBsub()
        povel_2b(5) = 6
        povel_2b(6) = 1

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "USB: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub LSBsub()
        povel_2b(5) = 6
        povel_2b(6) = 0

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "LSB: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub ATTONsub()
        povel_2b(5) = 17
        povel_2b(6) = 32

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "ATT ON: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub ATTOFFsub()
        povel_2b(5) = 17
        povel_2b(6) = 0

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "ATT OFF: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub PREONsub()
        povel_2b(5) = 22
        povel_2b(6) = 2
        povel_2b(7) = 1
        povel_2b(8) = 253

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "PRE ON: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6)) + ", " + Str(povel_2b(7))
        SerialPort1.Close()
        povel_2b(7) = 253
    End Sub

    Private Sub PREOFFsub()
        povel_2b(5) = 22
        povel_2b(6) = 2
        povel_2b(7) = 0
        povel_2b(8) = 253

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "PRE OFF: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6)) + ", " + Str(povel_2b(7))
        SerialPort1.Close()
        povel_2b(7) = 253
    End Sub

    Private Sub Tone_sub()
        povel_2b(5) = 22
        povel_2b(6) = 66
        povel_2b(7) = 1
        povel_2b(8) = 253

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "TONE: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6)) + ", " + Str(povel_2b(7))
        SerialPort1.Close()
        povel_2b(7) = 253
    End Sub

    Private Sub ToneOFF_sub()
        povel_2b(5) = 22
        povel_2b(6) = 66
        povel_2b(7) = 0
        povel_2b(8) = 253

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "TONE OFF: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6)) + ", " + Str(povel_2b(7))
        SerialPort1.Close()
        povel_2b(7) = 253
    End Sub



    Private Sub FMsub()

        povel_2b(5) = 6
        povel_2b(6) = 5

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "FM: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub AMsub()

        povel_2b(5) = 6
        povel_2b(6) = 2

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "AM: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub WFMsub()

        povel_2b(5) = 6
        povel_2b(6) = 6

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "WFM: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub RTTYsub()

        povel_2b(5) = 6
        povel_2b(6) = 4

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "RTTY: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step1ksub()

        povel_2b(5) = 16
        povel_2b(6) = 2

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "1kHz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step9ksub()

        povel_2b(5) = 16
        povel_2b(6) = 4

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "9kHz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step12k5sub()

        povel_2b(5) = 16
        povel_2b(6) = 6

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "12.5kHz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step25ksub()

        povel_2b(5) = 16
        povel_2b(6) = 8

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "25kHz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step100ksub()

        povel_2b(5) = 16
        povel_2b(6) = 9

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "100kHz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step100Hsub()

        povel_2b(5) = 16
        povel_2b(6) = 1

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "100Hz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step10Hsub()

        povel_2b(5) = 16
        povel_2b(6) = 0

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "10Hz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub DUP_plus_sub()

        povel_2b(5) = 15
        povel_2b(6) = 18

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "Duplex + : " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Dup_minus_sub()

        povel_2b(5) = 15
        povel_2b(6) = 17

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "Duplex - : " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub SIMPsub()


        povel_2b(5) = 15
        povel_2b(6) = 16

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "Duplex Off: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub CompON_sub()
        povel_2b(5) = 22
        povel_2b(6) = 68
        povel_2b(7) = 1
        povel_2b(8) = 253

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "COMP: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6)) + ", " + Str(povel_2b(7))
        SerialPort1.Close()
        povel_2b(7) = 253
    End Sub

    Private Sub CompOFF_sub()
        povel_2b(5) = 22
        povel_2b(6) = 68
        povel_2b(7) = 0
        povel_2b(8) = 253

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom
        Prikaz = "Comp OFF: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6)) + ", " + Str(povel_2b(7))
        SerialPort1.Close()
        povel_2b(7) = 253
    End Sub

    Private Sub Step5ksub()

        povel_2b(5) = 16
        povel_2b(6) = 3

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "5kHz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub Step10ksub()

        povel_2b(5) = 16
        povel_2b(6) = 5

        SerialPort1.Close()
        SerialPort1.Open()
        SerialPort1.Write(povel_2b, 1, 11)       ' toto pošle bajty do Icom 
        Prikaz = "10kHz: " + Str(povel_2b(2)) + ", " + Str(povel_2b(3)) + ", " + Str(povel_2b(4)) + ", " + Str(povel_2b(5)) + ", " + Str(povel_2b(6))
        SerialPort1.Close()
    End Sub

    Private Sub F145M500()
        NumericUpDown1.Value = 1
        NumericUpDown2.Value = 4
        NumericUpDown3.Value = 5
        NumericUpDown4.Value = 5
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0

        Nastavuj()

    End Sub
    Private Sub F145M575()
        NumericUpDown1.Value = 1
        NumericUpDown2.Value = 4
        NumericUpDown3.Value = 5
        NumericUpDown4.Value = 5
        NumericUpDown5.Value = 7
        NumericUpDown6.Value = 5
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0

        Nastavuj()

    End Sub
    Private Sub F106M4()
        NumericUpDown1.Value = 1
        NumericUpDown2.Value = 0
        NumericUpDown3.Value = 6
        NumericUpDown4.Value = 4
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0

        Nastavuj()
    End Sub
    Private Sub F18M1()

        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 1
        NumericUpDown3.Value = 8
        NumericUpDown4.Value = 1
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0

        Nastavuj()
    End Sub
    Private Sub F954()
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 0
        NumericUpDown3.Value = 0
        NumericUpDown4.Value = 9
        NumericUpDown5.Value = 5
        NumericUpDown6.Value = 4
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0

        Nastavuj()
    End Sub
    Private Sub F27M()

        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 2
        NumericUpDown3.Value = 6
        NumericUpDown4.Value = 9
        NumericUpDown5.Value = 8
        NumericUpDown6.Value = 5
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0

        Nastavuj()

    End Sub

    Private Sub Sroluj()
        Text = jmenoportu + ", Baud:" + CStr(br1)
    End Sub

    Private Sub VFOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VFOToolStripMenuItem.Click

    End Sub

    Private Sub VFOAToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VFOAToolStripMenuItem.Click
        VFO_Asub()
    End Sub

    Private Sub VFOBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VFOBToolStripMenuItem.Click
        VFO_Bsub()
    End Sub

    Private Sub ABToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ABToolStripMenuItem.Click
        A_Bsub()
    End Sub

    Private Sub SplitONToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SplitONToolStripMenuItem.Click
        Split_ON()
    End Sub

    Private Sub SplitOFFToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SplitOFFToolStripMenuItem.Click
        Split_OFFsub()
    End Sub

    Private Sub USBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles USBToolStripMenuItem.Click
        USBsub()
    End Sub

    Private Sub LSBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LSBToolStripMenuItem.Click
        LSBsub()
    End Sub

    Private Sub FMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FMToolStripMenuItem.Click
        FMsub()
    End Sub

    Private Sub WFMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WFMToolStripMenuItem.Click
        WFMsub()
    End Sub

    Private Sub AMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AMToolStripMenuItem.Click
        AMsub()
    End Sub

    Private Sub RTTYToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RTTYToolStripMenuItem.Click
        RTTYsub()
    End Sub

    Private Sub HzToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HzToolStripMenuItem.Click
        Step10Hsub()
    End Sub

    Private Sub HzToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HzToolStripMenuItem1.Click
        Step100Hsub()
    End Sub

    Private Sub KHzToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem.Click
        Step1ksub()
    End Sub

    Private Sub KHzToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem1.Click
        Step5ksub()
    End Sub

    Private Sub KHzToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem2.Click
        Step9ksub()
    End Sub

    Private Sub KHzToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem3.Click
        Step10ksub()
    End Sub

    Private Sub KHzToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem4.Click
        Step12k5sub()
    End Sub

    Private Sub KHzToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem5.Click
        Step25ksub()
    End Sub

    Private Sub KHzToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem6.Click
        Step100ksub()
    End Sub

    Private Sub ONToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ONToolStripMenuItem.Click
        PREONsub()
    End Sub

    Private Sub OFFToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OFFToolStripMenuItem.Click
        PREOFFsub()
    End Sub

    Private Sub ATTONToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ATTONToolStripMenuItem.Click
        ATTONsub()
    End Sub

    Private Sub ATTOFFToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ATTOFFToolStripMenuItem.Click
        ATTOFFsub()
    End Sub

    Private Sub CTCSSONToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CTCSSONToolStripMenuItem.Click
        Tone_sub()
    End Sub

    Private Sub TOFFToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOFFToolStripMenuItem.Click
        ToneOFF_sub()
    End Sub

    Private Sub DUPToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DUPToolStripMenuItem1.Click
        Dup_minus_sub()
    End Sub

    Private Sub DUPToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DUPToolStripMenuItem2.Click
        DUP_plus_sub()
    End Sub

    Private Sub DUPOFFToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DUPOFFToolStripMenuItem.Click
        SIMPsub()
    End Sub

    Private Sub CompOFFToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompOFFToolStripMenuItem.Click
        CompOFF_sub()
    End Sub

    Private Sub CompONNToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompONNToolStripMenuItem.Click
        CompON_sub()
    End Sub

    Private Sub NumericUpDown11_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown11.ValueChanged

    End Sub

    Private Sub COMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COMToolStripMenuItem.Click
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM3ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM3ToolStripMenuItem.Click
        jmenoportu = "COM3"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM4ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM4ToolStripMenuItem.Click
        jmenoportu = "COM4"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM5ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM5ToolStripMenuItem.Click
        jmenoportu = "COM5"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM6ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM6ToolStripMenuItem.Click
        jmenoportu = "COM6"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM7ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM7ToolStripMenuItem.Click
        jmenoportu = "COM7"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM8ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM8ToolStripMenuItem.Click
        jmenoportu = "COM8"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM9ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM9ToolStripMenuItem.Click
        jmenoportu = "COM9"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM10ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM10ToolStripMenuItem.Click
        jmenoportu = "COM10"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM11ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM11ToolStripMenuItem.Click
        jmenoportu = "COM11"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub COM12ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COM12ToolStripMenuItem.Click
        jmenoportu = "COM12"
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub Baud9600ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Baud9600ToolStripMenuItem.Click
        br1 = 9600
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub Baud19200ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Baud19200ToolStripMenuItem.Click
        br1 = 19200
        Nastav_com()
        Text = jmenoportu + ", Baud: " + CStr(br1)
    End Sub

    Private Sub AMMWToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AMMWToolStripMenuItem.Click
        VFO_Asub()    'nastaví VFO A
        AMsub()     'nastaví AM
        Step9ksub()   'nastaví Step 9 kHz
        PREOFFsub()     'nastaví PRE amp OFF
        ToneOFF_sub()     'nastaví CTCSS off
        SIMPsub()     'nastaví DUP off"

        F954()
    End Sub

    Private Sub CB27ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CB27ToolStripMenuItem.Click
        VFO_Asub()     'nastaví VFO A
        FMsub()     'nastaví FM
        Step5ksub()     'nastaví Step 10 kHz
        PREONsub()     'nastaví PRE amp
        ToneOFF_sub()     'nastaví CTCSS off
        SIMPsub()     'nastaví DUP off"

        F27M()
    End Sub

    Private Sub FMDirectToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FMDirectToolStripMenuItem.Click
        VFO_Asub()     'nastaví VFO A
        FMsub()     'nastaví FM
        Step12k5sub()    'nastaví Step 12.5 kHz
        PREONsub()     'nastaví PRE amp
        ToneOFF_sub()    'nastaví CTCSS off
        SIMPsub()     'nastaví DUP off"

        F145M500()
    End Sub

    Private Sub FMRepeaterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FMRepeaterToolStripMenuItem.Click
        VFO_Asub()     'nastaví VFO A
        FMsub()     'nastaví FM
        Step12k5sub()     'nastaví Step 12.5 kHz
        PREONsub()     'nastaví PRE amp
        Tone_sub()     'nastaví CTCSS jako FM-T
        Dup_minus_sub()     'nastaví DUP --"

        F145M575()
    End Sub

    Private Sub WFMToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WFMToolStripMenuItem1.Click
        VFO_Asub()          'nastaví VFO A
        WFMsub()            'nastaví WFM
        Step100ksub()         'nastaví Step 100 kHz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"

        F106M4()
    End Sub

    Private Sub KHzToolStripMenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem7.Click
        VFO_Asub()    'nastaví VFO A
        AMsub()     'nastaví AM
        Step9ksub()   'nastaví Step 9 kHz
        PREOFFsub()     'nastaví PRE amp OFF
        ToneOFF_sub()     'nastaví CTCSS off
        SIMPsub()     'nastaví DUP off"

        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 0
        NumericUpDown3.Value = 0
        NumericUpDown4.Value = 9
        NumericUpDown5.Value = 5
        NumericUpDown6.Value = 4
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub KHzToolStripMenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem8.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"

        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 0
        NumericUpDown3.Value = 1
        NumericUpDown4.Value = 8
        NumericUpDown5.Value = 4
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub KHzToolStripMenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KHzToolStripMenuItem9.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 0
        NumericUpDown3.Value = 3
        NumericUpDown4.Value = 5
        NumericUpDown5.Value = 7
        NumericUpDown6.Value = 3
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 0
        NumericUpDown3.Value = 7
        NumericUpDown4.Value = 0
        NumericUpDown5.Value = 7
        NumericUpDown6.Value = 4
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem1.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 1
        NumericUpDown3.Value = 0
        NumericUpDown4.Value = 1
        NumericUpDown5.Value = 3
        NumericUpDown6.Value = 6
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem2.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 1
        NumericUpDown3.Value = 4
        NumericUpDown4.Value = 0
        NumericUpDown5.Value = 7
        NumericUpDown6.Value = 4
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem3.Click
        VFO_Asub()          'nastaví VFO A
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 1
        NumericUpDown3.Value = 8
        NumericUpDown4.Value = 1
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem4.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 2
        NumericUpDown3.Value = 1
        NumericUpDown4.Value = 0
        NumericUpDown5.Value = 7
        NumericUpDown6.Value = 4
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem5.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 2
        NumericUpDown3.Value = 4
        NumericUpDown4.Value = 9
        NumericUpDown5.Value = 1
        NumericUpDown6.Value = 5
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem6.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 2
        NumericUpDown3.Value = 8
        NumericUpDown4.Value = 0
        NumericUpDown5.Value = 7
        NumericUpDown6.Value = 4
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem7.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 5
        NumericUpDown3.Value = 0
        NumericUpDown4.Value = 3
        NumericUpDown5.Value = 1
        NumericUpDown6.Value = 3
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem8.Click
        VFO_Asub()          'nastaví VFO A
        USBsub()            'nastaví WFM
        Step10Hsub()         'nastaví Step 10 Hz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"
        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 7
        NumericUpDown3.Value = 0
        NumericUpDown4.Value = 1
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem9.Click
        VFO_Asub()          'nastaví VFO A
        WFMsub()            'nastaví WFM
        Step100ksub()         'nastaví Step 100 kHz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"

        NumericUpDown1.Value = 0
        NumericUpDown2.Value = 9
        NumericUpDown3.Value = 4
        NumericUpDown4.Value = 1
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem10.Click
        VFO_Asub()          'nastaví VFO A
        WFMsub()            'nastaví WFM
        Step100ksub()         'nastaví Step 100 kHz
        PREONsub()            'nastaví PRE amp
        ToneOFF_sub()         'nastaví CTCSS off
        SIMPsub()             'nastaví DUP off"

        NumericUpDown1.Value = 1
        NumericUpDown2.Value = 0
        NumericUpDown3.Value = 6
        NumericUpDown4.Value = 4
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem11.Click
        NumericUpDown1.Value = 1
        NumericUpDown2.Value = 4
        NumericUpDown3.Value = 5
        NumericUpDown4.Value = 5
        NumericUpDown5.Value = 0
        NumericUpDown6.Value = 0
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem12.Click
        NumericUpDown1.Value = 1
        NumericUpDown2.Value = 4
        NumericUpDown3.Value = 5
        NumericUpDown4.Value = 5
        NumericUpDown5.Value = 7
        NumericUpDown6.Value = 5
        NumericUpDown7.Value = 0
        NumericUpDown8.Value = 0
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub MHzToolStripMenuItem13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MHzToolStripMenuItem13.Click
        NumericUpDown1.Value = 1
        NumericUpDown2.Value = 4
        NumericUpDown3.Value = 5
        NumericUpDown4.Value = 5
        NumericUpDown5.Value = 8
        NumericUpDown6.Value = 7
        NumericUpDown7.Value = 2
        NumericUpDown8.Value = 5
        b9 = 0
        Nastavuj()
    End Sub

    Private Sub CB3ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CB3ToolStripMenuItem.Click
        VFO_Asub()     'nastaví VFO A
        FMsub()     'nastaví FM
        Step5ksub()     'nastaví Step 10 kHz
        PREONsub()     'nastaví PRE amp
        ToneOFF_sub()     'nastaví CTCSS off
        SIMPsub()     'nastaví DUP off"

        F27M()
    End Sub
End Class
