poniedziałek, 1 sierpnia 2016

Nadajnik Pulson TA105E

Adaptacja TA105E Pulson


Krótki programik protezy na ATTINY2313 do sterowania nadajnikiem.

' Nadajnik Pulson TA105E PCB v.0510
' Sterowanie LMX1501A
' Mikrokontroler ATTINY2313 jako proteza zamiast układu OTP ST62T65C6
'
$regfile = "ATtiny2313.dat"
$crystal = 8000000                                          ' Zegar 8 MHz

Dim A1 As Word
Dim A3 As Word
Dim N2 As Word
Dim N3 As Word
Dim Mb_ref As Word                                         
    Mb_sw_ref Alias Mb_ref.15                              
    Mb_c_ref Alias Mb_ref.0                                
Dim Mb_swallow As Byte                                     
    Mb_c_prog Alias Mb_swallow.0                           
Dim Mb_prog As Word                                        
Dim Mb_n As Word                                           
Dim Mb_n_h As Byte
Dim Mb_n_l As Byte
Dim Tmp As Bit                                              ' zmienna odcinania nadawania po jednej rundzie

Declare Sub Lmx_tx
Declare Sub Le_pulse

Config Porta.0 = Output                                     ' Zalaczanie drivera i PA
Config Porta.1 = Output                                     ' CLK LMX1501A
Config Pinb.3 = Input                                       ' SW-PTT
Config Pinb.4 = Input                                       ' Lock Detect PLL 0=lock , 1=unlock
Config Portd.0 = Output                                     ' LE   LMX1501A
Config Portd.1 = Output                                     ' DATA LMX1501A
Config Portd.2 = Output                                     ' Zasilanie VCO i PLL 0=ON , 1=OFF


Tx_drv Alias Porta.0                                        ' Zalaczanie drivera i PA (5  pin ST62T65)
Lmx_clk Alias Porta.1                                       ' CLK LMX1501A            (4  pin ST62T65)
Ptt Alias Pinb.3                                            ' SW-PTT                  (24 pin ST62T65)
Lmx_lock Alias Pinb.4                                       ' Lock Detect PLL         (25 pin ST62T65)
Lmx_le Alias Portd.0                                        ' LE LMX1501A             (1  pin ST62T65)
Lmx_data Alias Portd.1                                      ' DATA LMX1501A           (2  pin ST62T65)
Tx_vco Alias Portd.2                                        ' Zasilanie VCO i PLL     (6  pin ST62T65)

Lmx_le = 0
Lmx_clk = 0
Lmx_data = 0
Tx_drv = 1
Tx_vco = 1
Lmx_lock = 1

Mb_ref = 128000 / 125
Mb_ref = Mb_ref * 2                                         ' podzial dzielnika R LMX1501A (12.8 MHz , krok 12.5kHz)

Mb_prog = 1448000 / 125                                     ' podzial calkowity dzielnikow N/A/SW LMX1501A (144.800 MHz , 12.5)

Mb_c_ref = 1                                                ' bit kontrolny rejestru R
Mb_c_prog = 0                                               ' bit kontrolny rejestru N/A



'-------------------------------------------------------------  glowna petla

Do

If Tmp = 0 Then
 If Ptt = 0 Then                                            ' jesli PTT wlaczone idz dalej
  Tx_vco = 0                                                ' wlacz zasilanie VCO
  Gosub Lmx_tx
  Waitms 20                                                 ' odczekaj 20ms na synchronizacje PLL
   If Lmx_lock = 0 Then                                     ' jeœli PLL "lock" zalacz driver i PA
    Tx_drv = 0                                              ' wlacz zasilanie drivera TX
    Tmp = 1
   Else
     Tx_vco = 1
     Tmp = 1
    End If
 End If
End If

If Tmp = 1 Then
 If Ptt = 1 Then
  Tx_drv = 1                                                ' wylacz zasilanie VCO i PLL
  Tx_vco = 1                                                ' wylacz zasilanie wzmaniaczy w.cz
  Tmp = 0
 End If
End If


Loop
End

'-------------------------------------------------------------  koniec glownej petli programu


Lmx_tx:
'
N2 = Mb_prog / 64
A1 = Mb_prog Mod 64
N3 = Mb_prog / 128
A3 = Mb_prog Mod 128
  If A3 < N3 Then
 Mb_n = N3
 Mb_swallow = A3 * 2
 Mb_sw_ref = 0
  Else
 Mb_n = N2
 Mb_swallow = A1 * 2
 Mb_sw_ref = 1
  End If

Shiftout Lmx_data , Lmx_clk , Mb_ref , 0                    ' wyslanie danych do rejestru R (16 bitow)

Gosub Le_pulse

Mb_n_h = High(mb_n)
Mb_n_l = Low(mb_n)
Shiftout Lmx_data , Lmx_clk , Mb_n_h , 0 , 3                ' wyslanie danych do rejestru N/A (3 bity)
Shiftout Lmx_data , Lmx_clk , Mb_n_l , 0                    ' wyslanie danych do rejestru N/A (8 bitow)
Shiftout Lmx_data , Lmx_clk , Mb_swallow , 0                ' wyslanie danych do rejestru N/A (8 bitow - ctrl + A)

Gosub Le_pulse

Return

Le_pulse:
 nop
 Set Lmx_le
 nop
 Reset Lmx_le
Return



Poniżej schemat poglądowy Nadajnika Pulson TA105E