2012年12月31日月曜日

28Mhz AM TA7358 PLL control TRX

28Mhz AM TRXで、PLL TC9256でコントロールした物です。既に公開の50Mhz AM TA7358 PLL control TRXの28Mhz版です。AM変調時のキャリア出力 150mW(無変調時の最大キャリア 600mW)で、特に違いは有りません。
 
 
 
 
回路図
 T型フィルタ(LPF)のコンデンサ容量 設計値52pF












TC9256 PLL control program
 50Mhz control programと異なる点は、周波数制限、PLLへのコントロールコマンド、Debounceの値である。Debounce変更理由は、誤表示した為である。コンパイラー自体のバグと思われるが、現在の環境(BASCOM 2.0.7.5.003 DEMO Version)では、OKとした。

'********************************************************
'28Mhz AM Tranceiver TC9256 PLL program
' Single super version(IF 455khz)         5khz step
'     Frequency 28.215Mhz to 28.355Mhz Limitted!
'                                       2012/12/25
' BASCOM AVR                              JA2GQP
'********************************************************
'
$regfile = "attiny2313.dat"
$crystal = 800000
Declare Sub Enc_sub                     'define subrutine
Declare Sub Pll_sub
Declare Sub Lcd_sub
Declare Sub Vfo_sub
Declare Sub Tx_sub
Declare Sub Mem_sub
'define memory
Dim Pll_adr As Byte                     'PLL command adress
Dim Pll_dat As Word                     '    freqency data
Dim Pll_cmd As Byte                     '    command
Dim Frq_wrk As Word                     'freqency
Dim Dsp_frq As String * 6               'Display frequency
Dim Frq_man As Word                     'main channel
Dim Flg As Byte                         'flag
Dim Flg_tx As Byte                      'TX flag
Dim Frqa_eep As Eram Word               'power off frequency A
Dim Frqb_eep As Eram Word               'power off frequency B
Dim Flg_eep As Eram Byte
'--------------
'Main roution
'--------------
Main:
   Disable Interrupts
   Config Lcdpin = Pin , Db7 = Portb.0 , Db6 = Portb.1
   Config Lcdpin = Pin , Db5 = Portb.2 , Db4 = Portb.3
   Config Lcdpin = Pin , E = Portb.4 , Rs = Portb.5
   Config Lcd = 16 * 2
   Config Porta.1 = Output              'Period
   'None,D6=TX,D5=VFO,D4=ENC B,D3=ENC A,D2=Main ch,D1=Clock,D0=Data
   Config Portd = &B00000011
   'None,Input=D6,D5,D4,D3,D2,Output=D0,D1
   Portd = &B01111100                   'pull up input pin
   Config Debounce = 2

   'PLL initial data set
   Pll_adr = &B11010000                 'pll CMD address
   Pll_cmd = &B01100110                 'Xtal 4.5Mhz,5khz step,HF
   Frq_man = 5572                       '(28.315Mhz-455khz)/5khz
   Flg_tx = 0                           'initial TX flag
   Flg = Flg_eep                        'Restore memory
   If Flg = 0 Then
      Pll_dat = Frqa_eep
      Else
         Pll_dat = Frqb_eep
         End If
   Cursor Off
   Cls
   Call Pll_sub                         'Dummy write
   Call Pll_sub                         'PLL write
   Call Lcd_sub                         'LCD write
   Enable Interrupts
   Do
      If Flg_tx = 0 Then                'TX?
         Debounce Pind.2 , 0 , Mem_sub , Sub       '  no,recive!
         Debounce Pind.3 , 0 , Enc_sub , Sub
         Debounce Pind.5 , 0 , Vfo_sub , Sub
         Debounce Pind.6 , 0 , Tx_sub , Sub
         Else
            If Pind.6 = 1 Then          'Send SW off?
               Flg_tx = 0
               Call Pll_sub
               Locate 2 , 7
               Lcd "  "
               End If
         End If
      Loop
End
'-----------------------------
'Memory channel set
'-----------------------------
Sub Mem_sub
   Pll_dat = Frq_man
   Call Pll_sub
   Call Lcd_sub
   If Flg = 0then
      Frqa_eep = Pll_dat
      Else
         Frqb_eep = Pll_dat
         End If
    While Pind.2 = 0
      Wend
End Sub
'-----------------------------
'Encoder counts and PLL set
'-----------------------------
Sub Enc_sub
   If Pind.4 = 1 Then                   'Up
      Pll_dat = Pll_dat + 1
      Else                              'down
         Pll_dat = Pll_dat - 1
         End If
   If Pll_dat <= 5551 Then              'pll_data <= (28.210Mhz-455khz)/5khz ?
      Pll_dat = 5552
      End If
   If Pll_dat >= 5581 Then              'pll_data >= (28.360Mhz-455khz)/5khz ?
      Pll_dat = 5580
      End If
   Call Pll_sub
   Call Lcd_sub
   If Flg = 0then
      Frqa_eep = Pll_dat
      Else
         Frqb_eep = Pll_dat
         End If
End Sub
'-----------------------------
'TC9256 Data write
'-----------------------------
Sub Pll_sub
   Set Portd.0                          'Data is High
   Set Portd.1                          'Clock is High
   Set Porta.1                          'period is High
   Reset Porta.1                        'period is Low
   Shiftout Portd.0 , Portd.1 , Pll_adr , 2 , 8 , 1       'ADDRESS set
   Set Porta.1
   Shiftout Portd.0 , Portd.1 , Pll_dat , 2 , 16 , 1       'PLL data set
   Shiftout Portd.0 , Portd.1 , Pll_cmd , 2 , 8 , 1
   Reset Porta.1
End Sub
'-----------------------------
'LCD Data write
'-----------------------------
Sub Lcd_sub
   Cls
   Locate 1 , 1
   Frq_wrk = Pll_dat * 5
   Frq_wrk = Frq_wrk + 455              'pll_dat+455khz
   Dsp_frq = Str(frq_wrk)
   Dsp_frq = Format(dsp_frq , "00.000")
   Lcd "FREQ:" ; Dsp_frq ; "Mhz"
   Locate 2 , 1
   Lcd "VFO:" ; Flg
   Locate 2 , 7
   Lcd "  "
   Locate 2 , 10
   Lcd "JA2GQP"
End Sub
'-----------------------------
'VFO
'-----------------------------
Sub Vfo_sub
   If Flg = 0then
      Flg = 1
      Pll_dat = Frqb_eep
      Else
         Flg = 0
         Pll_dat = Frqa_eep
         End If
   Flg_eep = Flg
   Call Pll_sub
   Call Lcd_sub
   While Pind.5 = 0
      Wend
End Sub

'-----------------------------
'TX
'-----------------------------
Sub Tx_sub
   If Flg_tx = 0 Then
      Flg_tx = 1
      Frq_wrk = Pll_dat
      Pll_dat = Pll_dat + 91            'pll_dat+455khz
      Call Pll_sub                      'PLL data write
      Pll_dat = Frq_wrk
      Locate 2 , 7
      Lcd "TX"
      End If
End Sub

4 件のコメント:

AG さんのコメント...

Arigato gazaimasu mr. akio mizuno san.
can you help me, for 88 mhz-108mhz PLL?

JA2GQP さんのコメント...

Dear elektronika-kit.

By rewriting the program and exchange coil, 88Mhz-108MhzPLL is possible.
TC9256 operate up to 150Mhz.
However, you may need to consider a review of circuit, step setting, operation mode.

AG さんのコメント...

for the program (Freq input-455khz) / 5kz
example:
Frq man = (28.315mhz-455khz) / 5khz = 5572

sub lcd_sub

frq_wrk = 5572 * 5 = 27860
frk_wrk = 27860 +455 = 28315

----> 28135 is a reading of the LCD. (28.135Mhz)

now I find it difficult to program 88MHZ-108MHZ
man freq = (freq input-10.7MHz) /?
frq_wrk = pll_dat *?
frq_wrk = frq_wrk + 10.7 ?
if mr. akio mizuno san can help me for the source program. I thank you in advance.

JA2GQP さんのコメント...

Dear elektronika-kit.

Specification is not only seen in the frequency, I can not answer anything.
Conditions other than I do not know the frequency, 10.7Mhz frequency IF?
If, IF if the 10.7Mhz, TC9256 PLL source program will be helpful.
I think because of its application to other frequency TC9256 will be useful, but I want to be perused.