FRQ+10.7MHzの50MHz帯AM用VFO。、公開済みAD9850 50MHz AM VFOのPCBを小型化した物で、製作中 1ボードTRXのVFO部分。LCDレスでも、プロトタイプのテスト、試験用LOとして十分かと思う。
AD9850 DDSモジュールを外した状態。
レギュレータ 7805は、裏側に取り付け、ケースに放熱。
回路図。IOポートは、PCBパターン引き回し都合で、変更。
PCB 42 x 67
program
AD9850 50MHz AM VFOのプログラムをLCD関連、RIT関連を削除した。これにより、メモリー機能がない。周波数データは、EEP ROMに保存しているので、メモリー機能の追加は、簡単。'********************************************************
'AD9850 DDS VFO program ver.1.0
' 50.500Mhz to 50.700Mhz Limitted!
' Copyright (C)2014.JA2GQP.All rights reserved.
' 2014/7/7
' JA2GQP
' BASCOM AVR 2.0.7.5(DEMO version) Compiled
'--------------------------------------------------------
' Function
' 1.Lower heterodyne
' 2.FRQ + 10.7MHz
' 3. Protection operation at the time of transmission
' 4.Channel ch0(50.60MHz),ch1(50.55MHz)
'********************************************************
$regfile = "m88adef.dat"
$crystal = 1000000 '1Mhz clock
'--- config port ---
Config Portb.0 = Output 'STEP LED 1k
Config Portb.1 = Input 'ENC B
Config Portb.2 = Input 'ENC A
Config Portb.3 = Input 'ch1
Config Portb.4 = Input 'STEP
Config Portb.5 = Input 'TX
Config Portd.0 = Output 'W_CLK .
Config Portd.1 = Output 'FQ_UD
Config Portd.2 = Output 'DATA
Config Portd.5 = Output 'Frq LED Mid .
Config Portd.6 = Output 'Frq LED Low
Config Portd.7 = Output 'Frq LED Hi
'--- port pullup ---
Portb = &B00111110 'Bit 1-5 pull up
'--- debounce set ---
Config Debounce = 1
'---Frequency Parameter(50.500Mhz to 50.700Mhz Limitted!)
Const If_frq = 10700000 'IF frequency
Const Lw_frq = 50500000 'Lower limit operation frequency
Const Hi_frq = 50700000 'Upper limit operation frequency
Const Def_frq =(lw_frq + Hi_frq) / 2 'Operation center frequency
Const Def_frq1 = 50550000 'ch1=50.55MHz
Const Def_frq2 = 50600000 'ch0=50.60MHz
'--- constant data ---
Const Lw_vfo = Lw_frq - If_frq 'VFO lower limit(RX)
Const Hi_vfo = Hi_frq - If_frq 'VFO upper limit(RX)
Const Def_vfo = Def_frq - If_frq 'VFO ch0
Const Def_vfo1 = Def_frq1 - If_frq 'VFO ch1
Const Scal = 34.35973837 '2^32/125.000Mhz
Const Dds_cmd = &B00000000 'DDS command
'--- define subrutine ---
Declare Sub Enc_sub 'Encorder
Declare Sub Dds_sub 'DDS
Declare Sub Stp_sub 'STEP
Declare Sub Rx_sub 'RX
Declare Sub Tx_sub 'TX
Declare Sub Chsw_sub 'Channel SW check
Declare Sub Eep_rd_sub 'EEP read
'--- define memory ---
Dim Vfo_dat As Long 'VFO freqency data
Dim Dds_dat As Long 'DDS frequency data
Dim Sng_wrk As Single 'main channel
Dim Lng_wrk As Long 'Long work1
Dim Enc_stp As Integer 'Encorder step
Dim Flg_tx As Byte 'TX flag
Dim Frq_eep0 As Eram Long 'EEP frequency ch0
Dim Frq_eep1 As Eram Long ' ch1
Dim Stp_eep0 As Eram Integer 'EEP STEP ch0
Dim Stp_eep1 As Eram Integer ' ch1
Dim Flg_enc As Byte 'Encorder dir flag
Dim Byt_cmd As Byte 'DDS command
Dim Byt_wrk As Byte 'Byte work
Dim Byt_chn As Byte 'Channel
'--------------
'Main roution
'--------------
Main:
Flg_tx = 0 'TX flag reset
Call Chsw_sub 'Channel SW check
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP initial
Do
If Flg_tx = 0 Then
Debounce Pinb.2 , 0 , Enc_sub , Sub 'Encorder
Debounce Pinb.4 , 0 , Stp_sub , Sub 'Step
Call Chsw_sub 'Channel SW check
If Byt_wrk <> Byt_chn Then
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP load
End If
If Vfo_dat =< Lw_vfo Then 'VFO lower limit check
Vfo_dat = Lw_vfo
Portd.6 = 1 'Frq LED Low on
Else
Portd.6 = 0
End If
If Vfo_dat = Def_vfo Then 'VFO Def Frq check
Portd.5 = 1 'Frq LED Mid on
Else
Portd.5 = 0
End If
If Vfo_dat >= Hi_vfo Then 'VFO upper limit check
Vfo_dat = Hi_vfo
Portd.7 = 1 'Frq LED Hi on
Else
Portd.7 = 0
End If
If Enc_stp = 1000 Then 'STEP LED 1k check
Portb.0 = 1 'LED on
Else
Portb.0 = 0
End If
End If
Debounce Pinb.5 , 1 , Rx_sub , Sub 'RX
Debounce Pinb.5 , 0 , Tx_sub , Sub 'TX
Dds_dat = Vfo_dat
Call Dds_sub
Loop
End
'-----------------------------
'Encoder check,Create DDS data
'-----------------------------
Sub Enc_sub
If Pinb.1 = 1 Then
Vfo_dat = Vfo_dat + Enc_stp
Else
Vfo_dat = Vfo_dat - Enc_stp
End If
If Vfo_dat =< Lw_vfo Then 'VFO lower limit check
Vfo_dat = Lw_vfo
End If
If Vfo_dat >= Hi_vfo Then 'VFO upper limit check
Vfo_dat = Hi_vfo
End If
End Sub
'-----------------------------
'AD9850(DDS) Data write
'-----------------------------
Sub Dds_sub
Sng_wrk = Dds_dat
Lng_wrk = Sng_wrk * Scal
Byt_cmd = Dds_cmd 'DDS command
Reset Portd.1
Shiftout Portd.2 , Portd.0 , Lng_wrk , 3
Shiftout Portd.2 , Portd.0 , Byt_cmd , 3
Set Portd.1
End Sub
'-----------------------------
'Step
'-----------------------------
Sub Stp_sub
Select Case Enc_stp
Case 10000:
Enc_stp = 1000 '1k
Case 1000:
Enc_stp = 10000 '10k
Vfo_dat = Vfo_dat + 5000 'round 10k
Vfo_dat = Vfo_dat \ 10000
Vfo_dat = Vfo_dat * 10000
Case Else:
Enc_stp = 10000 '10k(initial)
End Select
End Sub
'-----------------------------
'RX
'-----------------------------
Sub Rx_sub
If Flg_tx = 1 Then
Flg_tx = 0 'TX flag rest
End If
End Sub
'-----------------------------
'TX
'-----------------------------
Sub Tx_sub
If Flg_tx = 0 Then
Flg_tx = 1 'TX flag set
End If
End Sub
'-----------------------------
'Channel SW check
'-----------------------------
Sub Chsw_sub
If Pinb.3 = 0 Then
Byt_chn = 1
Else
Byt_chn = 0
End If
End Sub
'-----------------------------
'EEP set
'-----------------------------
Sub Eep_rd_sub
If Frq_eep0 =< 0 Then 'EEP VFO data check
Vfo_dat = Def_vfo 'Initialize VFO data
Frq_eep0 = Def_vfo
Frq_eep1 = Def_vfo1
Else 'Restore VFO data
Select Case Byt_chn
Case 1:
Vfo_dat = Frq_eep1
Case Else:
Vfo_dat = Frq_eep0
End Select
End If
If Stp_eep0 =< 0 Then 'EEP STEP data check
Enc_stp = 10000
Stp_eep0 = Enc_stp 'Initialize STEP data
Stp_eep1 = Enc_stp
Else 'Restore STEP data
Select Case Byt_chn
Case 1:
Enc_stp = Stp_eep1
Case Else:
Enc_stp = Stp_eep0
End Select
End If
End Sub
0 件のコメント:
コメントを投稿