SDR Converterを以前ハムフェアーで入手したケースに収納した。ケース(外形寸 37x92x30)を先に決めたわけでないが、上手く収める事ができた。写真で判別不明だが、PCBの下にレギュレータ7805がある。SDRに使う場合、特にシールド特性の良い事が望まれるが、このケースはCATV?で使われていた物の様だ。PCB剥き出しで使われている方もみえるので参考になれば、と思う。
前面 背面
無線機の製作記録の全てを公開してます。 https://sites.google.com/view/ja2gqpから必要なファイルをダウンロードできます。 このBlogは、詳細な説明は一切行っておらず、ある程度のスキルが要求されます。 質問に応じますが、カスタマイズは対応しません。尚、コメントは誰でも出来る様に変更しました。
2013年12月6日金曜日
2013年12月1日日曜日
SDR Upverter(HF Converter)
R820TドングルでHF帯受信する為のUpverter(HF コンバータ)である。回路方式は色々なサイトで紹介されているが 、KF7LZE's Blogに整理されている。 http://blog.kf7lze.net/tag/rtl2832u/
今回、DBMと50MHzオシレターを使って製作した。また、オシレターからの輻射を低減すべく、受信範囲を0-25MHzとした。
回路図である。DBMはTUF-1を使ったが、秋月電子販売のTUF-2で問題ない。
PCBサイズ 31 x 53
参考
SDR受信ソフトのインストールは、多くのHPに紹介されているが、ここを参考にした。
http://www.icom.co.jp/beacon/talk/001518.html
今回、DBMと50MHzオシレターを使って製作した。また、オシレターからの輻射を低減すべく、受信範囲を0-25MHzとした。
LPFのシュミレーションをAADE Filter Design V4.5で行った。コイルはT37-6 12tでのインダクタンス値で、50MHzで-50dbm以上の減衰が得られる様、コンデンサーを決めた。結果、Fc=25MHz、減衰量 -57dbm(at 50MHz)である。
回路図である。DBMはTUF-1を使ったが、秋月電子販売のTUF-2で問題ない。
PCBサイズ 31 x 53
参考
SDR受信ソフトのインストールは、多くのHPに紹介されているが、ここを参考にした。
http://www.icom.co.jp/beacon/talk/001518.html
2013年11月8日金曜日
AD9850 DDS VFO Premixed Version 1.1b
AD9850 DDS VFO Premixed版にスプリット機能を追加した。これで一通りの機能が揃った事になる。本来ならば、全ての機能を織り込んで、Version 1.0とすべきだが、他との識別の為、Version 1.1bとした。スプリット操作は、split SWを押し、Xと表示が出たら、ロータリーエンコーダで値をセットするのみである。他のVFOをセットする必要もない。簡単にSPLIT運用ができる。
SPLIT機能は、RIT機能のサブルーチンを使ってメモリー消費をおさえた。SPLITとRITは排他的な関係で、直感的なオペレーションが出来るが、RIT制限範囲 = SPLIT制限範囲である。
最大STEP値が、100kと50kを選択出来るよう、条件付コンパイルプログラムとした。STEP 100kにする時Step_100k=1。また、STEP 50kにする時、Step_100k=0と書き換えれば良い。(下記プログラムは、STEP 50k)
'********************************************************
'AD9850 DDS VFO Premixed type program ver.1.1b
'
' Copyright (C)2013.JA2GQP.All rights reserved.
'
' 7.000Mhz to 7.200Mhz Limitted!
' (Target frequency = IF frequency + frequency)
' 2013/11/07
' JA2GQP
' BASCOM AVR 2.0.7.5(DEMO version) Compiled
'--------------------------------------------------------
' Function
'
' 1.Upper heterodyne
' 2.RIT operation(-50khz to +50khz)
' 3.STEP(100k,10k,1k,100,10)
' 4.Memory operation is push RIT
' (Frequency and Step)
' 5.Protection operation at the time of transmission
' 6.Channel memory main channel(ch0) + 2 chanenl(ch1,ch2)
' 7.Sprit operation(-50khz to +50khz)
'********************************************************
$regfile = "m88adef.dat"
$crystal = 800000 '0.8Mhz clock
'--- config port ---
Config Portb = &B11000000 '0=TX,1=none,2=STEP,3=RIT
'4=ENC A,5=ENC B,6-7=LCD
Config Portc = &B00000111 '0=DATA,1=FU_UD,2=W_CLK,3-5=ch_SW
'--- port pullup ---
Portb = &B00111111 'ENC B,ENC A,RIT,STEP,none,TX
Portc = &B00111000 'Bit 3-5 pull up
'--- debounce set ---
Config Debounce = 1
'---LCD port assign ---
Config Lcdpin = Pin , Db7 = Portd.6 , Db6 = Portd.5
Config Lcdpin = Pin , Db5 = Portb.7 , Db4 = Portb.6
Config Lcdpin = Pin , E = Portd.2 , Rs = Portd.0
Config Lcd = 16 * 2
'---Max STEP select ---
Const Step_100k = 0 'STEP 100k=1,50k=0
'--- constant data ---
Const If_frq = 9996500 'IF frequency
Const Lw_frq = 7000000 'Lower limit operation frequency
Const Hi_frq = 7200000 'Upper limit operation frequency
Const Def_frq = 7050000 'Operation frequency(initial)
Const Lw_vfo = If_frq + Lw_frq 'VFO lower limit
Const Hi_vfo = If_frq + Hi_frq 'VFO upper limit
Const Def_vfo = If_frq + Def_frq 'VFO operation frequency(initial)
Const Lw_rit = -50000 'RIT lower limit
Const Hi_rit = 50000 'RIT upper limit
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 Lcd_sub 'LCD
Declare Sub Stp_sub 'STEP
Declare Sub Rit_sub 'RIT
Declare Sub Rx_sub 'RX
Declare Sub Tx_sub 'TX
Declare Sub Chsw_sub 'Channel SW check
Declare Sub Eep_rd_sub 'EEP read
Declare Sub Spl_sub 'SPLIT
'--- define memory ---
Dim Vfo_dat As Long 'VFO freqency data
Dim Dds_dat As Long 'DDS frequency data
Dim Str_frq As String * 10 'String frequency
Dim Dsp_frq As String * 10 'Display frequency
Dim Sng_wrk As Single 'main channel
Dim Lng_wk1 As Long 'Long work1
Dim Lng_wk2 As Long 'Long work2
Dim Wrd_wk1 As Word 'Word work1
Dim Wrd_wk2 As Word 'Word work2
Dim Wrd_wk3 As Word 'Word work3
Dim Enc_stp As Long 'Encorder step
Dim Rit_dat As Long 'RIT data
Dim Rit_datb As Long 'RIT data old
Dim Int_wrk As Integer 'Integer work
Dim Flg_rit As Byte 'RIT flag
Dim Flg_ritb As Byte 'RIT flag old
Dim Flg_tx As Byte 'TX flag
Dim Flg_spl As Byte 'SPLIT flag
Dim Frq_eep0 As Eram Long 'EEP frequency ch0
Dim Frq_eep1 As Eram Long ' ch1
Dim Frq_eep2 As Eram Long ' ch2
Dim Stp_eep0 As Eram Long 'EEP STEP ch0
Dim Stp_eep1 As Eram Long ' ch1
Dim Stp_eep2 As Eram Long ' ch2
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
Flg_rit = 0 'RIT flag
Flg_spl = 0
Cursor Off
Cls
Call Chsw_sub 'Channel SW check
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP initial
Do
If Flg_tx = 0 Then
Debounce Pinb.4 , 0 , Enc_sub , Sub 'Encorder
Debounce Pinb.2 , 0 , Stp_sub , Sub 'Step
Debounce Pinb.3 , 0 , Rit_sub , Sub 'RIT
Debounce Pinb.1 , 0 , Spl_sub , Sub 'SPLIT
Call Chsw_sub 'Channel SW check
If Byt_wrk <> Byt_chn Then
If Byt_wrk = 0 Then
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
Flg_ritb = Flg_rit 'Save RIT flag
Rit_datb = Rit_dat 'Save RIT data
Flg_rit = 0
Flg_spl = 0
Rit_dat = 0
End If
If Byt_wrk <> 0 Then
Flg_rit = 0
Flg_spl = 0
If Byt_chn = 0 Then
If Flg_ritb = 1 Then
Flg_rit = 1
Rit_dat = Rit_datb
End If
End If
End If
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP load
End If
End If
Debounce Pinb.0 , 1 , Rx_sub , Sub 'RX
Debounce Pinb.0 , 0 , Tx_sub , Sub 'TX
If Flg_rit = 1 Then
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
If Flg_tx = 1 Then
If Flg_spl = 1 Then
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
End If
Call Dds_sub
Loop
End
'-----------------------------
'Encoder check,Create DDS data
'-----------------------------
Sub Enc_sub
If Pinb.5 = 1 Then
Flg_enc = 0 'Up
Else
Flg_enc = 1 'down
End If
If Flg_enc = 0 Then
Lng_wk1 = Vfo_dat + Enc_stp 'Up
Lng_wk2 = Rit_dat + Enc_stp
Else
Lng_wk1 = Vfo_dat - Enc_stp 'down
Lng_wk2 = Rit_dat - Enc_stp
End If
If Flg_rit = 1 Or Flg_spl = 1 Then
Rit_dat = Lng_wk2
Else
Vfo_dat = Lng_wk1
Rit_dat = 0
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
If Rit_dat < Lw_rit Then 'RIT lower limit check
Rit_dat = Lw_rit
End If
If Rit_dat > Hi_rit Then 'RIT upper limit check
Rit_dat = Hi_rit
End If
Call Lcd_sub
End Sub
'-----------------------------
'AD9850(DDS) Data write
'-----------------------------
Sub Dds_sub
Sng_wrk = Dds_dat * Scal
Lng_wk1 = Sng_wrk
Byt_cmd = Dds_cmd 'DDS command
Reset Portc.1
Shiftout Portc.0 , Portc.2 , Lng_wk1 , 3
Shiftout Portc.0 , Portc.2 , Byt_cmd , 3
Set Portc.1
End Sub
'-----------------------------
'LCD Data write
'-----------------------------
Sub Lcd_sub
Locate 1 , 1
Lng_wk1 = Vfo_dat - If_frq
Str_frq = Str(lng_wk1)
Str_frq = Format(str_frq , "00.000000")
Dsp_frq = Left(str_frq , 3) + Mid(str_frq , 4 , 3) + "." + Mid(str_frq , 7 , 3)
Lcd Byt_chn ; ":" ; Dsp_frq ; "Mhz"
Locate 2 , 1
Lcd "S: "
Locate 2 , 3
If Enc_stp < 1000 Then
Lcd Enc_stp
#if Step_100k = 1
Elseif Enc_stp = 100000 Then
Lcd "100k "
#else
Elseif Enc_stp = 50000 Then
Lcd "50k "
#endif
Elseif Enc_stp = 10000 Then
Lcd "10k "
Else
Lcd "1k "
End If
Locate 2 , 8
If Flg_rit = 1 Then
Lcd "R: "
End If
If Flg_spl = 1 Then
Lcd "X: "
End If
Str_frq = Str(rit_dat)
Str_frq = Format(str_frq , "00.000")
Locate 2 , 10
Lcd Str_frq
If Flg_rit = 0 And Flg_spl = 0 Then
Locate 2 , 8
Lcd " JA2GQP"
End If
End Sub
'-----------------------------
'Step
'-----------------------------
Sub Stp_sub
Select Case Enc_stp
#if Step_100k = 1
Case 100000:
Enc_stp = 10000 '10000
#else
Case 50000:
Enc_stp = 10000 '10000
#endif
Case 10000:
Enc_stp = 1000 '1000
Case 1000:
Enc_stp = 100 '100
Case 100:
Enc_stp = 10 '10
Case 10:
#if Step_100k = 1
Enc_stp = 100000 '100000
#else
Enc_stp = 50000 '50000
#endif
Case Else:
Enc_stp = 1000 '1000(initial)
End Select
Call Lcd_sub
End Sub
'-----------------------------
'RIT
'-----------------------------
Sub Rit_sub
If Flg_rit = 0 Then
Rit_dat = 0
Flg_rit = 1
Flg_spl = 0
Select Case Byt_chn
Case 1:
Frq_eep1 = Vfo_dat 'Save VFO1 data
Stp_eep1 = Enc_stp 'Save STEP1 data
Case 2:
Frq_eep2 = Vfo_dat 'Save VFO2 data
Stp_eep2 = Enc_stp 'Save STEP2 data
Case Else:
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
End Select
Else
Flg_rit = 0
End If
Call Lcd_sub
End Sub
'-----------------------------
'RX
'-----------------------------
Sub Rx_sub
If Flg_tx = 1 Then
Flg_tx = 0 'TX flag rest
Locate 1 , 1
Lcd Byt_chn
End If
End Sub
'-----------------------------
'TX
'-----------------------------
Sub Tx_sub
If Flg_tx = 0 Then
Flg_tx = 1 'TX flag set
Locate 1 , 1
Lcd "T"
End If
End Sub
'-----------------------------
'Channel SW check
'-----------------------------
Sub Chsw_sub
If Pinc.3 = 0 Then
Byt_chn = 1
Elseif Pinc.4 = 0 Then
Byt_chn = 2
Else
Byt_chn = 0
End If
Locate 1 , 1
Lcd Byt_chn
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 = Vfo_dat
Frq_eep1 = Vfo_dat
Frq_eep2 = Vfo_dat
Else 'Restore VFO data
Select Case Byt_chn
Case 1:
Vfo_dat = Frq_eep1
Case 2:
Vfo_dat = Frq_eep2
Case Else:
Vfo_dat = Frq_eep0
End Select
End If
If Stp_eep0 =< 0 Then 'EEP STEP data check
Enc_stp = 1000
Stp_eep0 = Enc_stp 'Initialize STEP data
Stp_eep1 = Enc_stp
Stp_eep2 = Enc_stp
Else 'Restore STEP data
Select Case Byt_chn
Case 1:
Enc_stp = Stp_eep1
Case 2:
Enc_stp = Stp_eep2
Case Else:
Enc_stp = Stp_eep0
End Select
End If
Call Lcd_sub
End Sub
'-----------------------------
'SPLIT
'-----------------------------
Sub Spl_sub
If Flg_spl = 0 Then
Flg_spl = 1
Flg_rit = 0
Rit_dat = 0
Else
Flg_spl = 0
End If
Call Lcd_sub
End Sub
Program
SPLIT機能は、RIT機能のサブルーチンを使ってメモリー消費をおさえた。SPLITとRITは排他的な関係で、直感的なオペレーションが出来るが、RIT制限範囲 = SPLIT制限範囲である。
最大STEP値が、100kと50kを選択出来るよう、条件付コンパイルプログラムとした。STEP 100kにする時Step_100k=1。また、STEP 50kにする時、Step_100k=0と書き換えれば良い。(下記プログラムは、STEP 50k)
'********************************************************
'AD9850 DDS VFO Premixed type program ver.1.1b
'
' Copyright (C)2013.JA2GQP.All rights reserved.
'
' 7.000Mhz to 7.200Mhz Limitted!
' (Target frequency = IF frequency + frequency)
' 2013/11/07
' JA2GQP
' BASCOM AVR 2.0.7.5(DEMO version) Compiled
'--------------------------------------------------------
' Function
'
' 1.Upper heterodyne
' 2.RIT operation(-50khz to +50khz)
' 3.STEP(100k,10k,1k,100,10)
' 4.Memory operation is push RIT
' (Frequency and Step)
' 5.Protection operation at the time of transmission
' 6.Channel memory main channel(ch0) + 2 chanenl(ch1,ch2)
' 7.Sprit operation(-50khz to +50khz)
'********************************************************
$regfile = "m88adef.dat"
$crystal = 800000 '0.8Mhz clock
'--- config port ---
Config Portb = &B11000000 '0=TX,1=none,2=STEP,3=RIT
'4=ENC A,5=ENC B,6-7=LCD
Config Portc = &B00000111 '0=DATA,1=FU_UD,2=W_CLK,3-5=ch_SW
'--- port pullup ---
Portb = &B00111111 'ENC B,ENC A,RIT,STEP,none,TX
Portc = &B00111000 'Bit 3-5 pull up
'--- debounce set ---
Config Debounce = 1
'---LCD port assign ---
Config Lcdpin = Pin , Db7 = Portd.6 , Db6 = Portd.5
Config Lcdpin = Pin , Db5 = Portb.7 , Db4 = Portb.6
Config Lcdpin = Pin , E = Portd.2 , Rs = Portd.0
Config Lcd = 16 * 2
'---Max STEP select ---
Const Step_100k = 0 'STEP 100k=1,50k=0
'--- constant data ---
Const If_frq = 9996500 'IF frequency
Const Lw_frq = 7000000 'Lower limit operation frequency
Const Hi_frq = 7200000 'Upper limit operation frequency
Const Def_frq = 7050000 'Operation frequency(initial)
Const Lw_vfo = If_frq + Lw_frq 'VFO lower limit
Const Hi_vfo = If_frq + Hi_frq 'VFO upper limit
Const Def_vfo = If_frq + Def_frq 'VFO operation frequency(initial)
Const Lw_rit = -50000 'RIT lower limit
Const Hi_rit = 50000 'RIT upper limit
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 Lcd_sub 'LCD
Declare Sub Stp_sub 'STEP
Declare Sub Rit_sub 'RIT
Declare Sub Rx_sub 'RX
Declare Sub Tx_sub 'TX
Declare Sub Chsw_sub 'Channel SW check
Declare Sub Eep_rd_sub 'EEP read
Declare Sub Spl_sub 'SPLIT
'--- define memory ---
Dim Vfo_dat As Long 'VFO freqency data
Dim Dds_dat As Long 'DDS frequency data
Dim Str_frq As String * 10 'String frequency
Dim Dsp_frq As String * 10 'Display frequency
Dim Sng_wrk As Single 'main channel
Dim Lng_wk1 As Long 'Long work1
Dim Lng_wk2 As Long 'Long work2
Dim Wrd_wk1 As Word 'Word work1
Dim Wrd_wk2 As Word 'Word work2
Dim Wrd_wk3 As Word 'Word work3
Dim Enc_stp As Long 'Encorder step
Dim Rit_dat As Long 'RIT data
Dim Rit_datb As Long 'RIT data old
Dim Int_wrk As Integer 'Integer work
Dim Flg_rit As Byte 'RIT flag
Dim Flg_ritb As Byte 'RIT flag old
Dim Flg_tx As Byte 'TX flag
Dim Flg_spl As Byte 'SPLIT flag
Dim Frq_eep0 As Eram Long 'EEP frequency ch0
Dim Frq_eep1 As Eram Long ' ch1
Dim Frq_eep2 As Eram Long ' ch2
Dim Stp_eep0 As Eram Long 'EEP STEP ch0
Dim Stp_eep1 As Eram Long ' ch1
Dim Stp_eep2 As Eram Long ' ch2
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
Flg_rit = 0 'RIT flag
Flg_spl = 0
Cursor Off
Cls
Call Chsw_sub 'Channel SW check
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP initial
Do
If Flg_tx = 0 Then
Debounce Pinb.4 , 0 , Enc_sub , Sub 'Encorder
Debounce Pinb.2 , 0 , Stp_sub , Sub 'Step
Debounce Pinb.3 , 0 , Rit_sub , Sub 'RIT
Debounce Pinb.1 , 0 , Spl_sub , Sub 'SPLIT
Call Chsw_sub 'Channel SW check
If Byt_wrk <> Byt_chn Then
If Byt_wrk = 0 Then
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
Flg_ritb = Flg_rit 'Save RIT flag
Rit_datb = Rit_dat 'Save RIT data
Flg_rit = 0
Flg_spl = 0
Rit_dat = 0
End If
If Byt_wrk <> 0 Then
Flg_rit = 0
Flg_spl = 0
If Byt_chn = 0 Then
If Flg_ritb = 1 Then
Flg_rit = 1
Rit_dat = Rit_datb
End If
End If
End If
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP load
End If
End If
Debounce Pinb.0 , 1 , Rx_sub , Sub 'RX
Debounce Pinb.0 , 0 , Tx_sub , Sub 'TX
If Flg_rit = 1 Then
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
If Flg_tx = 1 Then
If Flg_spl = 1 Then
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
End If
Call Dds_sub
Loop
End
'-----------------------------
'Encoder check,Create DDS data
'-----------------------------
Sub Enc_sub
If Pinb.5 = 1 Then
Flg_enc = 0 'Up
Else
Flg_enc = 1 'down
End If
If Flg_enc = 0 Then
Lng_wk1 = Vfo_dat + Enc_stp 'Up
Lng_wk2 = Rit_dat + Enc_stp
Else
Lng_wk1 = Vfo_dat - Enc_stp 'down
Lng_wk2 = Rit_dat - Enc_stp
End If
If Flg_rit = 1 Or Flg_spl = 1 Then
Rit_dat = Lng_wk2
Else
Vfo_dat = Lng_wk1
Rit_dat = 0
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
If Rit_dat < Lw_rit Then 'RIT lower limit check
Rit_dat = Lw_rit
End If
If Rit_dat > Hi_rit Then 'RIT upper limit check
Rit_dat = Hi_rit
End If
Call Lcd_sub
End Sub
'-----------------------------
'AD9850(DDS) Data write
'-----------------------------
Sub Dds_sub
Sng_wrk = Dds_dat * Scal
Lng_wk1 = Sng_wrk
Byt_cmd = Dds_cmd 'DDS command
Reset Portc.1
Shiftout Portc.0 , Portc.2 , Lng_wk1 , 3
Shiftout Portc.0 , Portc.2 , Byt_cmd , 3
Set Portc.1
End Sub
'-----------------------------
'LCD Data write
'-----------------------------
Sub Lcd_sub
Locate 1 , 1
Lng_wk1 = Vfo_dat - If_frq
Str_frq = Str(lng_wk1)
Str_frq = Format(str_frq , "00.000000")
Dsp_frq = Left(str_frq , 3) + Mid(str_frq , 4 , 3) + "." + Mid(str_frq , 7 , 3)
Lcd Byt_chn ; ":" ; Dsp_frq ; "Mhz"
Locate 2 , 1
Lcd "S: "
Locate 2 , 3
If Enc_stp < 1000 Then
Lcd Enc_stp
#if Step_100k = 1
Elseif Enc_stp = 100000 Then
Lcd "100k "
#else
Elseif Enc_stp = 50000 Then
Lcd "50k "
#endif
Elseif Enc_stp = 10000 Then
Lcd "10k "
Else
Lcd "1k "
End If
Locate 2 , 8
If Flg_rit = 1 Then
Lcd "R: "
End If
If Flg_spl = 1 Then
Lcd "X: "
End If
Str_frq = Str(rit_dat)
Str_frq = Format(str_frq , "00.000")
Locate 2 , 10
Lcd Str_frq
If Flg_rit = 0 And Flg_spl = 0 Then
Locate 2 , 8
Lcd " JA2GQP"
End If
End Sub
'-----------------------------
'Step
'-----------------------------
Sub Stp_sub
Select Case Enc_stp
#if Step_100k = 1
Case 100000:
Enc_stp = 10000 '10000
#else
Case 50000:
Enc_stp = 10000 '10000
#endif
Case 10000:
Enc_stp = 1000 '1000
Case 1000:
Enc_stp = 100 '100
Case 100:
Enc_stp = 10 '10
Case 10:
#if Step_100k = 1
Enc_stp = 100000 '100000
#else
Enc_stp = 50000 '50000
#endif
Case Else:
Enc_stp = 1000 '1000(initial)
End Select
Call Lcd_sub
End Sub
'-----------------------------
'RIT
'-----------------------------
Sub Rit_sub
If Flg_rit = 0 Then
Rit_dat = 0
Flg_rit = 1
Flg_spl = 0
Select Case Byt_chn
Case 1:
Frq_eep1 = Vfo_dat 'Save VFO1 data
Stp_eep1 = Enc_stp 'Save STEP1 data
Case 2:
Frq_eep2 = Vfo_dat 'Save VFO2 data
Stp_eep2 = Enc_stp 'Save STEP2 data
Case Else:
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
End Select
Else
Flg_rit = 0
End If
Call Lcd_sub
End Sub
'-----------------------------
'RX
'-----------------------------
Sub Rx_sub
If Flg_tx = 1 Then
Flg_tx = 0 'TX flag rest
Locate 1 , 1
Lcd Byt_chn
End If
End Sub
'-----------------------------
'TX
'-----------------------------
Sub Tx_sub
If Flg_tx = 0 Then
Flg_tx = 1 'TX flag set
Locate 1 , 1
Lcd "T"
End If
End Sub
'-----------------------------
'Channel SW check
'-----------------------------
Sub Chsw_sub
If Pinc.3 = 0 Then
Byt_chn = 1
Elseif Pinc.4 = 0 Then
Byt_chn = 2
Else
Byt_chn = 0
End If
Locate 1 , 1
Lcd Byt_chn
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 = Vfo_dat
Frq_eep1 = Vfo_dat
Frq_eep2 = Vfo_dat
Else 'Restore VFO data
Select Case Byt_chn
Case 1:
Vfo_dat = Frq_eep1
Case 2:
Vfo_dat = Frq_eep2
Case Else:
Vfo_dat = Frq_eep0
End Select
End If
If Stp_eep0 =< 0 Then 'EEP STEP data check
Enc_stp = 1000
Stp_eep0 = Enc_stp 'Initialize STEP data
Stp_eep1 = Enc_stp
Stp_eep2 = Enc_stp
Else 'Restore STEP data
Select Case Byt_chn
Case 1:
Enc_stp = Stp_eep1
Case 2:
Enc_stp = Stp_eep2
Case Else:
Enc_stp = Stp_eep0
End Select
End If
Call Lcd_sub
End Sub
'-----------------------------
'SPLIT
'-----------------------------
Sub Spl_sub
If Flg_spl = 0 Then
Flg_spl = 1
Flg_rit = 0
Rit_dat = 0
Else
Flg_spl = 0
End If
Call Lcd_sub
End Sub
2013年11月6日水曜日
AD9850 DDS VFO Premixed Version 1.1a
AD9850 DDS VFOのプリミックス用として9/6に公開したものの、Version UPである。10/27公開したProgramは、受信部にシングルスーパーを使うことを前提にしたものである。今回のVersionは、10/27版より機能が低い。変更内容は、STEP 100k追加とメモリーチャンネル2ch追加である。メモリーチャンネル多チャンネル追加を狙ったが、BASCOM DEMO版(4kb)の制限で、2chが限度であった。2chのメモリーでも、無いより使い勝手向上する筈だ。メインチャンネル(ch0)のみ、他のチャンネル(ch1,ch2)に移ってもRITを保持する事など、10/27版と同じ仕様。Software識別のため、Ver1.1a。
'-----------------------------
'Encoder check,Create DDS data
'-----------------------------
Program
'********************************************************
'AD9850 DDS VFO Premixed type program ver.1.1a
'
' Copyright (C)2013.JA2GQP.All rights reserved.
'
' 7.000Mhz to 7.200Mhz Limitted!
' (Target frequency = IF frequency + frequency)
' 2013/11/05
' JA2GQP
' BASCOM AVR 2.0.7.5(DEMO version) Compiled
'--------------------------------------------------------
' Function
'
' 1.Upper heterodyne
' 2.RIT operation(-10khz to +10khz)
' 3.STEP(100k,10k,1k,100,10)
' 4.Memory operation is push RIT
' (Frequency and Step)
' 5.Protection operation at the time of transmission
' 6.Channel memory main channel(ch0) + 2 chanenl(ch1,ch2)
'********************************************************
'AD9850 DDS VFO Premixed type program ver.1.1a
'
' Copyright (C)2013.JA2GQP.All rights reserved.
'
' 7.000Mhz to 7.200Mhz Limitted!
' (Target frequency = IF frequency + frequency)
' 2013/11/05
' JA2GQP
' BASCOM AVR 2.0.7.5(DEMO version) Compiled
'--------------------------------------------------------
' Function
'
' 1.Upper heterodyne
' 2.RIT operation(-10khz to +10khz)
' 3.STEP(100k,10k,1k,100,10)
' 4.Memory operation is push RIT
' (Frequency and Step)
' 5.Protection operation at the time of transmission
' 6.Channel memory main channel(ch0) + 2 chanenl(ch1,ch2)
'********************************************************
$regfile = "m88adef.dat"
$crystal = 800000 '0.8Mhz clock
$crystal = 800000 '0.8Mhz clock
'--- config port ---
Config Portb = &B11000000 '0=TX,1=none,2=STEP,3=RIT
'4=ENC A,5=ENC B,6-7=LCD
Config Portc = &B00000111 '0=DATA,1=FU_UD,2=W_CLK,3-5=ch_SW
Config Portb = &B11000000 '0=TX,1=none,2=STEP,3=RIT
'4=ENC A,5=ENC B,6-7=LCD
Config Portc = &B00000111 '0=DATA,1=FU_UD,2=W_CLK,3-5=ch_SW
'--- port pullup ---
Portb = &B00111111 'ENC B,ENC A,RIT,STEP,none,TX
Portc = &B00111000 'Bit 3-5 pull up
Portb = &B00111111 'ENC B,ENC A,RIT,STEP,none,TX
Portc = &B00111000 'Bit 3-5 pull up
'--- debounce set ---
Config Debounce = 1
Config Debounce = 1
'---LCD port assign ---
Config Lcdpin = Pin , Db7 = Portd.6 , Db6 = Portd.5
Config Lcdpin = Pin , Db5 = Portb.7 , Db4 = Portb.6
Config Lcdpin = Pin , E = Portd.2 , Rs = Portd.0
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db7 = Portd.6 , Db6 = Portd.5
Config Lcdpin = Pin , Db5 = Portb.7 , Db4 = Portb.6
Config Lcdpin = Pin , E = Portd.2 , Rs = Portd.0
Config Lcd = 16 * 2
'--- constant data ---
Const If_frq = 9996500 'IF frequency
Const Lw_frq = 7000000 'Lower limit operation frequency
Const Hi_frq = 7200000 'Upper limit operation frequency
Const Def_frq = 7050000 'Operation frequency(initial)
Const Lw_vfo = If_frq + Lw_frq 'VFO lower limit
Const Hi_vfo = If_frq + Hi_frq 'VFO upper limit
Const Def_vfo = If_frq + Def_frq 'VFO operation frequency(initial)
Const Lw_rit = -10000 'RIT lower limit(Min -99999)
Const Hi_rit = 10000 'RIT upper limit(Max 99999)
Const Scal = 34.35973837 '2^32/125.000Mhz
Const Dds_cmd = &B00000000 'DDS command
Const If_frq = 9996500 'IF frequency
Const Lw_frq = 7000000 'Lower limit operation frequency
Const Hi_frq = 7200000 'Upper limit operation frequency
Const Def_frq = 7050000 'Operation frequency(initial)
Const Lw_vfo = If_frq + Lw_frq 'VFO lower limit
Const Hi_vfo = If_frq + Hi_frq 'VFO upper limit
Const Def_vfo = If_frq + Def_frq 'VFO operation frequency(initial)
Const Lw_rit = -10000 'RIT lower limit(Min -99999)
Const Hi_rit = 10000 'RIT upper limit(Max 99999)
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 Lcd_sub 'LCD
Declare Sub Stp_sub 'STEP
Declare Sub Rit_sub 'RIT
Declare Sub Rx_sub 'RX
Declare Sub Tx_sub 'TX
Declare Sub Chsw_sub 'Channel SW check
Declare Sub Eep_rd_sub 'EEP read
Declare Sub Enc_sub 'Encorder
Declare Sub Dds_sub 'DDS
Declare Sub Lcd_sub 'LCD
Declare Sub Stp_sub 'STEP
Declare Sub Rit_sub 'RIT
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 Str_frq As String * 10 'String frequency
Dim Dsp_frq As String * 10 'Display frequency
Dim Sng_wrk As Single 'main channel
Dim Lng_wk1 As Long 'Long work1
Dim Lng_wk2 As Long 'Long work2
Dim Wrd_wk1 As Word 'Word work1
Dim Wrd_wk2 As Word 'Word work2
Dim Wrd_wk3 As Word 'Word work3
Dim Enc_stp As Long 'Encorder step
Dim Rit_dat As Long 'RIT data
Dim Rit_datb As Long 'RIT data old
Dim Int_wrk As Integer 'Integer work
Dim Flg_rit As Byte 'RIT flag
Dim Flg_ritb As Byte 'RIT flag old
Dim Flg_tx As Byte 'TX flag
Dim Frq_eep0 As Eram Long 'EEP frequency ch0
Dim Frq_eep1 As Eram Long ' ch1
Dim Frq_eep2 As Eram Long ' ch2
Dim Stp_eep0 As Eram Long 'EEP STEP ch0
Dim Stp_eep1 As Eram Long ' ch1
Dim Stp_eep2 As Eram Long ' ch2
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
Dim Vfo_dat As Long 'VFO freqency data
Dim Dds_dat As Long 'DDS frequency data
Dim Str_frq As String * 10 'String frequency
Dim Dsp_frq As String * 10 'Display frequency
Dim Sng_wrk As Single 'main channel
Dim Lng_wk1 As Long 'Long work1
Dim Lng_wk2 As Long 'Long work2
Dim Wrd_wk1 As Word 'Word work1
Dim Wrd_wk2 As Word 'Word work2
Dim Wrd_wk3 As Word 'Word work3
Dim Enc_stp As Long 'Encorder step
Dim Rit_dat As Long 'RIT data
Dim Rit_datb As Long 'RIT data old
Dim Int_wrk As Integer 'Integer work
Dim Flg_rit As Byte 'RIT flag
Dim Flg_ritb As Byte 'RIT flag old
Dim Flg_tx As Byte 'TX flag
Dim Frq_eep0 As Eram Long 'EEP frequency ch0
Dim Frq_eep1 As Eram Long ' ch1
Dim Frq_eep2 As Eram Long ' ch2
Dim Stp_eep0 As Eram Long 'EEP STEP ch0
Dim Stp_eep1 As Eram Long ' ch1
Dim Stp_eep2 As Eram Long ' ch2
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 roution
'--------------
Main:
Flg_tx = 0
Flg_rit = 0 'RIT flag
Flg_tx = 0
Flg_rit = 0 'RIT flag
Cursor Off
Cls
Cls
Call Chsw_sub 'Channel SW check
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP initial
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP initial
Do
If Flg_tx = 0 Then
Debounce Pinb.4 , 0 , Enc_sub , Sub 'Encorder
Debounce Pinb.2 , 0 , Stp_sub , Sub 'Step
Debounce Pinb.3 , 0 , Rit_sub , Sub 'RIT
Call Chsw_sub 'Channel SW check
If Flg_tx = 0 Then
Debounce Pinb.4 , 0 , Enc_sub , Sub 'Encorder
Debounce Pinb.2 , 0 , Stp_sub , Sub 'Step
Debounce Pinb.3 , 0 , Rit_sub , Sub 'RIT
Call Chsw_sub 'Channel SW check
If Byt_wrk <> Byt_chn Then
If Byt_wrk = 0 Then
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
Flg_ritb = Flg_rit 'Save RIT flag
Rit_datb = Rit_dat 'Save RIT data
Flg_rit = 0
Rit_dat = 0
End If
If Byt_wrk = 0 Then
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
Flg_ritb = Flg_rit 'Save RIT flag
Rit_datb = Rit_dat 'Save RIT data
Flg_rit = 0
Rit_dat = 0
End If
If Byt_wrk <> 0 Then
Flg_rit = 0
If Byt_chn = 0 Then
If Flg_ritb = 1 Then
Flg_rit = 1
Rit_dat = Rit_datb
End If
End If
End If
Flg_rit = 0
If Byt_chn = 0 Then
If Flg_ritb = 1 Then
Flg_rit = 1
Rit_dat = Rit_datb
End If
End If
End If
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP load
End If
End If
Call Eep_rd_sub 'EEP load
End If
End If
Debounce Pinb.0 , 1 , Rx_sub , Sub 'RX
Debounce Pinb.0 , 0 , Tx_sub , Sub 'TX
Debounce Pinb.0 , 0 , Tx_sub , Sub 'TX
If Flg_rit = 1 Then
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
If Flg_tx = 1 Then
Dds_dat = Vfo_dat
End If
Dds_dat = Vfo_dat
End If
Call Dds_sub
Loop
End
Loop
End
'-----------------------------
'Encoder check,Create DDS data
'-----------------------------
Sub Enc_sub
If Pinb.5 = 1 Then
Flg_enc = 0 'Up
Else
Flg_enc = 1 'down
End If
If Pinb.5 = 1 Then
Flg_enc = 0 'Up
Else
Flg_enc = 1 'down
End If
If Flg_enc = 0 Then
Lng_wk1 = Vfo_dat + Enc_stp 'Up
Lng_wk2 = Rit_dat + Enc_stp
Else
Lng_wk1 = Vfo_dat - Enc_stp 'down
Lng_wk2 = Rit_dat - Enc_stp
End If
Lng_wk1 = Vfo_dat + Enc_stp 'Up
Lng_wk2 = Rit_dat + Enc_stp
Else
Lng_wk1 = Vfo_dat - Enc_stp 'down
Lng_wk2 = Rit_dat - Enc_stp
End If
If Flg_rit = 1 Then
Rit_dat = Lng_wk2
Else
Vfo_dat = Lng_wk1
Rit_dat = 0
End If
Rit_dat = Lng_wk2
Else
Vfo_dat = Lng_wk1
Rit_dat = 0
End If
If Vfo_dat < Lw_vfo Then 'VFO lower limit check
Vfo_dat = Lw_vfo
End If
Vfo_dat = Lw_vfo
End If
If Vfo_dat > Hi_vfo Then 'VFO upper limit check
Vfo_dat = Hi_vfo
End If
Vfo_dat = Hi_vfo
End If
If Rit_dat < Lw_rit Then 'RIT lower limit check
Rit_dat = Lw_rit
End If
Rit_dat = Lw_rit
End If
If Rit_dat > Hi_rit Then 'RIT upper limit check
Rit_dat = Hi_rit
End If
Rit_dat = Hi_rit
End If
Call Lcd_sub
End Sub
End Sub
'-----------------------------
'AD9850(DDS) Data write
'-----------------------------
'AD9850(DDS) Data write
'-----------------------------
Sub Dds_sub
Sng_wrk = Dds_dat * Scal
Lng_wk1 = Sng_wrk
Byt_cmd = Dds_cmd 'DDS command
Sng_wrk = Dds_dat * Scal
Lng_wk1 = Sng_wrk
Byt_cmd = Dds_cmd 'DDS command
Reset Portc.1
Shiftout Portc.0 , Portc.2 , Lng_wk1 , 3
Shiftout Portc.0 , Portc.2 , Byt_cmd , 3
Set Portc.1
End Sub
Shiftout Portc.0 , Portc.2 , Lng_wk1 , 3
Shiftout Portc.0 , Portc.2 , Byt_cmd , 3
Set Portc.1
End Sub
'-----------------------------
'LCD Data write
'-----------------------------
'LCD Data write
'-----------------------------
Sub Lcd_sub
Locate 1 , 1
Lng_wk1 = Vfo_dat - If_frq
Str_frq = Str(lng_wk1)
Str_frq = Format(str_frq , "00.000000")
Dsp_frq = Left(str_frq , 3) + Mid(str_frq , 4 , 3) + "." + Mid(str_frq , 7 , 3)
Lcd Byt_chn ; ":" ; Dsp_frq ; "Mhz"
Locate 2 , 1
Lcd "S: "
Locate 2 , 3
Locate 1 , 1
Lng_wk1 = Vfo_dat - If_frq
Str_frq = Str(lng_wk1)
Str_frq = Format(str_frq , "00.000000")
Dsp_frq = Left(str_frq , 3) + Mid(str_frq , 4 , 3) + "." + Mid(str_frq , 7 , 3)
Lcd Byt_chn ; ":" ; Dsp_frq ; "Mhz"
Locate 2 , 1
Lcd "S: "
Locate 2 , 3
If Enc_stp =< 0 Then
Enc_stp = 1000
End If
Enc_stp = 1000
End If
If Enc_stp => 1000 Then 'Unit Conversion
Lng_wk2 = Enc_stp / 1000 'kilo
Lcd Lng_wk2 ; "k"
Else
Lcd Enc_stp
End If
Lng_wk2 = Enc_stp / 1000 'kilo
Lcd Lng_wk2 ; "k"
Else
Lcd Enc_stp
End If
If Flg_rit = 1 Then
Locate 2 , 8
Lcd "R: "
Str_frq = Str(rit_dat)
Str_frq = Format(str_frq , "00.000")
Locate 2 , 10
Lcd Str_frq
Else
Locate 2 , 8
Lcd " JA2GQP"
End If
Locate 2 , 8
Lcd "R: "
Str_frq = Str(rit_dat)
Str_frq = Format(str_frq , "00.000")
Locate 2 , 10
Lcd Str_frq
Else
Locate 2 , 8
Lcd " JA2GQP"
End If
End Sub
'-----------------------------
'Step
'-----------------------------
'Step
'-----------------------------
Sub Stp_sub
Select Case Enc_stp
Case 100000:
Enc_stp = 10000 '10000
Case 10000:
Enc_stp = 1000 '1000
Case 1000:
Enc_stp = 100 '100
Case 100:
Enc_stp = 10 '10
Case 10:
Enc_stp = 100000 '100000
Case Else:
Enc_stp = 1000 '1000(initial)
End Select
Select Case Enc_stp
Case 100000:
Enc_stp = 10000 '10000
Case 10000:
Enc_stp = 1000 '1000
Case 1000:
Enc_stp = 100 '100
Case 100:
Enc_stp = 10 '10
Case 10:
Enc_stp = 100000 '100000
Case Else:
Enc_stp = 1000 '1000(initial)
End Select
Call Lcd_sub
End Sub
End Sub
'-----------------------------
'RIT
'-----------------------------
'RIT
'-----------------------------
Sub Rit_sub
If Flg_rit = 0 Then
Rit_dat = 0
Flg_rit = 1
If Flg_rit = 0 Then
Rit_dat = 0
Flg_rit = 1
Select Case Byt_chn
Case 1:
Frq_eep1 = Vfo_dat 'Save VFO1 data
Stp_eep1 = Enc_stp 'Save STEP1 data
Case 2:
Frq_eep2 = Vfo_dat 'Save VFO2 data
Stp_eep2 = Enc_stp 'Save STEP2 data
Case Else:
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
End Select
Else
Flg_rit = 0
End If
Case 1:
Frq_eep1 = Vfo_dat 'Save VFO1 data
Stp_eep1 = Enc_stp 'Save STEP1 data
Case 2:
Frq_eep2 = Vfo_dat 'Save VFO2 data
Stp_eep2 = Enc_stp 'Save STEP2 data
Case Else:
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
End Select
Else
Flg_rit = 0
End If
Call Lcd_sub
End Sub
End Sub
'-----------------------------
'RX
'-----------------------------
'RX
'-----------------------------
Sub Rx_sub
If Flg_tx = 1 Then
Flg_tx = 0 'TX flag rest
Locate 1 , 1
Lcd Byt_chn
End If
End Sub
If Flg_tx = 1 Then
Flg_tx = 0 'TX flag rest
Locate 1 , 1
Lcd Byt_chn
End If
End Sub
'-----------------------------
'TX
'-----------------------------
'TX
'-----------------------------
Sub Tx_sub
If Flg_tx = 0 Then
Flg_tx = 1 'TX flag set
Locate 1 , 1
Lcd "T"
End If
End Sub
If Flg_tx = 0 Then
Flg_tx = 1 'TX flag set
Locate 1 , 1
Lcd "T"
End If
End Sub
'-----------------------------
'Channel SW check
'-----------------------------
'Channel SW check
'-----------------------------
Sub Chsw_sub
If Pinc.3 = 0 Then
Byt_chn = 1
Elseif Pinc.4 = 0 Then
Byt_chn = 2
Else
Byt_chn = 0
End If
Locate 1 , 1
Lcd Byt_chn
End Sub
If Pinc.3 = 0 Then
Byt_chn = 1
Elseif Pinc.4 = 0 Then
Byt_chn = 2
Else
Byt_chn = 0
End If
Locate 1 , 1
Lcd Byt_chn
End Sub
'-----------------------------
'EEP set
'-----------------------------
'EEP set
'-----------------------------
Sub Eep_rd_sub
If Frq_eep0 =< 0 Then 'EEP VFO data check
Vfo_dat = Def_vfo 'Initialize VFO data
Frq_eep0 = Vfo_dat
Frq_eep1 = Vfo_dat
Frq_eep2 = Vfo_dat
Else 'Restore VFO data
Select Case Byt_chn
Case 1:
Vfo_dat = Frq_eep1
Case 2:
Vfo_dat = Frq_eep2
Case Else:
Vfo_dat = Frq_eep0
End Select
End If
If Frq_eep0 =< 0 Then 'EEP VFO data check
Vfo_dat = Def_vfo 'Initialize VFO data
Frq_eep0 = Vfo_dat
Frq_eep1 = Vfo_dat
Frq_eep2 = Vfo_dat
Else 'Restore VFO data
Select Case Byt_chn
Case 1:
Vfo_dat = Frq_eep1
Case 2:
Vfo_dat = Frq_eep2
Case Else:
Vfo_dat = Frq_eep0
End Select
End If
If Stp_eep0 =< 0 Then 'EEP STEP data check
Enc_stp = 1000
Stp_eep0 = Enc_stp 'Initialize STEP data
Stp_eep1 = Enc_stp
Stp_eep2 = Enc_stp
Else 'Restore STEP data
Select Case Byt_chn
Case 1:
Enc_stp = Stp_eep1
Case 2:
Enc_stp = Stp_eep2
Case Else:
Enc_stp = Stp_eep0
End Select
End If
Call Lcd_sub
End Sub
Enc_stp = 1000
Stp_eep0 = Enc_stp 'Initialize STEP data
Stp_eep1 = Enc_stp
Stp_eep2 = Enc_stp
Else 'Restore STEP data
Select Case Byt_chn
Case 1:
Enc_stp = Stp_eep1
Case 2:
Enc_stp = Stp_eep2
Case Else:
Enc_stp = Stp_eep0
End Select
End If
Call Lcd_sub
End Sub
2013年10月27日日曜日
AD9850 DDS VFO version UP
AD9850 DDS VFO program Version UPを行い、チェンネル機能(メインチャンネル+3chメモリー)付きにした。メインメモリー(ch0)は、メモリーチャンネル(ch1-ch3)に切り替えると、RIT・STEP・frequencyを保持して復帰する事が可能。メモリー(ch0-ch3)は、RITスイッチ操作でSTEP・frequencyを保存できる。H/W変更は、公開済み回路図にchannerlスイッチのみ追加。今回のVersion UPで、LCD無しのシステムも容易に構築できると思う。(一例として、キャリアポイント用・50Mhzチェンネル切替式TRX etc)
program
他の周波数に容易に変更が出来る様、source programを書いた。例えば、7Mhz用にコンパイルする場合、Const Fr = 7。また、SG用にコンパイルする場合、Const Fr = 0。更に、50Mhz用(公開済みの50Mhz VFOの様な逓倍回路が必要)にコンパイルする場合、Const Fr = 50とすれば良い。
'********************************************************
'AD9850 DDS VFO program ver.1.1
' Copyright (C)2013.JA2GQP.All rights reserved.
' 2013/10/26
' JA2GQP
' BASCOM AVR 2.0.7.5(DEMO version) Compiled
'--------------------------------------------------------
' Function
' 1.Lower heterodyne
' 2.RIT operation(-10khz to +10khz)
' 3.STEP(10000,1000,100,10)
' 4.Memory operation is push RIT
' (Frequency and Step)
' 5. Protection operation at the time of transmission
' 6.Channel memory ch0(main channel),ch1,ch2,ch3
'********************************************************
'AD9850 DDS VFO program ver.1.1
' Copyright (C)2013.JA2GQP.All rights reserved.
' 2013/10/26
' JA2GQP
' BASCOM AVR 2.0.7.5(DEMO version) Compiled
'--------------------------------------------------------
' Function
' 1.Lower heterodyne
' 2.RIT operation(-10khz to +10khz)
' 3.STEP(10000,1000,100,10)
' 4.Memory operation is push RIT
' (Frequency and Step)
' 5. Protection operation at the time of transmission
' 6.Channel memory ch0(main channel),ch1,ch2,ch3
'********************************************************
$regfile = "m88adef.dat"
$crystal = 800000 '0.8Mhz clock
$crystal = 800000 '0.8Mhz clock
'--- config port ---
Config Portb = &B11000000 '0=TX,1=none,2=STEP,3=RIT
'4=ENC A,5=ENC B,6-7=LCD
Config Portc = &B00000111 '0=DATA,1=FU_UD,2=W_CLK,3-5=ch_SW
Config Portb = &B11000000 '0=TX,1=none,2=STEP,3=RIT
'4=ENC A,5=ENC B,6-7=LCD
Config Portc = &B00000111 '0=DATA,1=FU_UD,2=W_CLK,3-5=ch_SW
'--- port pullup ---
Portb = &B00111111 'ENC B,ENC A,RIT,STEP,none,TX
Portc = &B00111000 'Bit 3-5 pull up
Portb = &B00111111 'ENC B,ENC A,RIT,STEP,none,TX
Portc = &B00111000 'Bit 3-5 pull up
'--- debounce set ---
Config Debounce = 1
'---LCD port assign ---
Config Lcdpin = Pin , Db7 = Portd.6 , Db6 = Portd.5
Config Lcdpin = Pin , Db5 = Portb.7 , Db4 = Portb.6
Config Lcdpin = Pin , E = Portd.2 , Rs = Portd.0
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db7 = Portd.6 , Db6 = Portd.5
Config Lcdpin = Pin , Db5 = Portb.7 , Db4 = Portb.6
Config Lcdpin = Pin , E = Portd.2 , Rs = Portd.0
Config Lcd = 16 * 2
Const Fr = 50 'Frequency set(Mhz)
'7Mhz=7,50Mhz=50,SG mode=0 etc.
#if Fr = 50
' 50Mhz parameter(50.000Mhz to 51.000Mhz Limitted!)
Const If_frq = 455000 'IF frequency
Const Lw_frq = 50000000 'Lower limit operation frequency
Const Hi_frq = 51000000 'Upper limit operation frequency
Const Def_frq = 50600000 'Operation frequency(initial)
Const Multi = 2 'Multiplication
#endif
'7Mhz=7,50Mhz=50,SG mode=0 etc.
#if Fr = 50
' 50Mhz parameter(50.000Mhz to 51.000Mhz Limitted!)
Const If_frq = 455000 'IF frequency
Const Lw_frq = 50000000 'Lower limit operation frequency
Const Hi_frq = 51000000 'Upper limit operation frequency
Const Def_frq = 50600000 'Operation frequency(initial)
Const Multi = 2 'Multiplication
#endif
#if Fr = 7
' 7Mhz parameter(7.000Mhz to 7.200Mhz Limitted!)
Const If_frq = 455000 'IF frequency
Const Lw_frq = 7000000 'Lower limit operation frequency
Const Hi_frq = 7200000 'Upper limit operation frequency
Const Def_frq = 7195000 'Operation frequency(initial)
Const Multi = 1 'Multiplication
#endif
' 7Mhz parameter(7.000Mhz to 7.200Mhz Limitted!)
Const If_frq = 455000 'IF frequency
Const Lw_frq = 7000000 'Lower limit operation frequency
Const Hi_frq = 7200000 'Upper limit operation frequency
Const Def_frq = 7195000 'Operation frequency(initial)
Const Multi = 1 'Multiplication
#endif
#if Fr = 0
' Signal generator mode(0.000Mhz to 40.000Mhz Limitted!)
Const If_frq = 0 'IF frequency
Const Lw_frq = 0 'Lower limit operation frequency
Const Hi_frq = 40000000 'Upper limit operation frequency
Const Def_frq = 10000000 'Operation frequency(initial)
Const Multi = 1 'Multiplication
#endif
' Signal generator mode(0.000Mhz to 40.000Mhz Limitted!)
Const If_frq = 0 'IF frequency
Const Lw_frq = 0 'Lower limit operation frequency
Const Hi_frq = 40000000 'Upper limit operation frequency
Const Def_frq = 10000000 'Operation frequency(initial)
Const Multi = 1 'Multiplication
#endif
'--- 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 operation frequency(RX)
Const Lw_rit = -10000 'RIT lower limit
Const Hi_rit = 10000 'RIT upper limit
Const Scal = 34.35973837 '2^32/125.000Mhz
Const Dds_cmd = &B00000000 'DDS command
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 operation frequency(RX)
Const Lw_rit = -10000 'RIT lower limit
Const Hi_rit = 10000 'RIT upper limit
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 Lcd_sub 'LCD
Declare Sub Stp_sub 'STEP
Declare Sub Rit_sub 'RIT
Declare Sub Rx_sub 'RX
Declare Sub Tx_sub 'TX
Declare Sub Chsw_sub 'Channel SW check
Declare Sub Eep_rd_sub 'EEP read
Declare Sub Enc_sub 'Encorder
Declare Sub Dds_sub 'DDS
Declare Sub Lcd_sub 'LCD
Declare Sub Stp_sub 'STEP
Declare Sub Rit_sub 'RIT
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 Str_frq As String * 10 'String frequency
Dim Dsp_frq As String * 10 'Display frequency
Dim Sng_wrk As Single 'main channel
Dim Lng_wk1 As Long 'Long work1
Dim Lng_wk2 As Long 'Long work2
Dim Wrd_wk1 As Word 'Word work1
Dim Wrd_wk2 As Word 'Word work2
Dim Wrd_wk3 As Word 'Word work3
Dim Enc_stp As Integer 'Encorder step
Dim Rit_dat As Integer 'RIT data
Dim Rit_datb As Integer 'RIT data old
Dim Int_wrk As Integer 'Integer work
Dim Flg_rit As Byte 'RIT flag
Dim Flg_ritb As Byte 'RIT flag old
Dim Flg_tx As Byte 'TX flag
Dim Frq_eep0 As Eram Long 'EEP frequency ch0
Dim Frq_eep1 As Eram Long ' ch1
Dim Frq_eep2 As Eram Long ' ch2
Dim Frq_eep3 As Eram Long ' ch3
Dim Stp_eep0 As Eram Integer 'EEP STEP ch0
Dim Stp_eep1 As Eram Integer ' ch1
Dim Stp_eep2 As Eram Integer ' ch2
Dim Stp_eep3 As Eram Integer ' ch3
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
Dim Vfo_dat As Long 'VFO freqency data
Dim Dds_dat As Long 'DDS frequency data
Dim Str_frq As String * 10 'String frequency
Dim Dsp_frq As String * 10 'Display frequency
Dim Sng_wrk As Single 'main channel
Dim Lng_wk1 As Long 'Long work1
Dim Lng_wk2 As Long 'Long work2
Dim Wrd_wk1 As Word 'Word work1
Dim Wrd_wk2 As Word 'Word work2
Dim Wrd_wk3 As Word 'Word work3
Dim Enc_stp As Integer 'Encorder step
Dim Rit_dat As Integer 'RIT data
Dim Rit_datb As Integer 'RIT data old
Dim Int_wrk As Integer 'Integer work
Dim Flg_rit As Byte 'RIT flag
Dim Flg_ritb As Byte 'RIT flag old
Dim Flg_tx As Byte 'TX flag
Dim Frq_eep0 As Eram Long 'EEP frequency ch0
Dim Frq_eep1 As Eram Long ' ch1
Dim Frq_eep2 As Eram Long ' ch2
Dim Frq_eep3 As Eram Long ' ch3
Dim Stp_eep0 As Eram Integer 'EEP STEP ch0
Dim Stp_eep1 As Eram Integer ' ch1
Dim Stp_eep2 As Eram Integer ' ch2
Dim Stp_eep3 As Eram Integer ' ch3
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 roution
'--------------
Main:
Flg_tx = 0 'TX flag reset
Flg_rit = 0 'RIT flag reset
Flg_tx = 0 'TX flag reset
Flg_rit = 0 'RIT flag reset
Cursor Off
Cls
Cls
Call Chsw_sub 'Channel SW check
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP initial
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP initial
Call Lcd_sub
Do
If Flg_tx = 0 Then
Debounce Pinb.4 , 0 , Enc_sub , Sub 'Encorder
Debounce Pinb.2 , 0 , Stp_sub , Sub 'Step
Debounce Pinb.3 , 0 , Rit_sub , Sub 'RIT
Call Chsw_sub 'Channel SW check
If Flg_tx = 0 Then
Debounce Pinb.4 , 0 , Enc_sub , Sub 'Encorder
Debounce Pinb.2 , 0 , Stp_sub , Sub 'Step
Debounce Pinb.3 , 0 , Rit_sub , Sub 'RIT
Call Chsw_sub 'Channel SW check
If Byt_wrk <> Byt_chn Then
If Byt_wrk = 0 Then
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
Flg_ritb = Flg_rit 'Save RIT flag
Rit_datb = Rit_dat 'Save RIT data
Flg_rit = 0
Rit_dat = 0
End If
If Byt_wrk = 0 Then
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
Flg_ritb = Flg_rit 'Save RIT flag
Rit_datb = Rit_dat 'Save RIT data
Flg_rit = 0
Rit_dat = 0
End If
If Byt_wrk <> 0 Then
Flg_rit = 0
If Byt_chn = 0 Then
If Flg_ritb = 1 Then
Flg_rit = 1
Rit_dat = Rit_datb
End If
End If
End If
Flg_rit = 0
If Byt_chn = 0 Then
If Flg_ritb = 1 Then
Flg_rit = 1
Rit_dat = Rit_datb
End If
End If
End If
Byt_wrk = Byt_chn
Call Eep_rd_sub 'EEP load
End If
End If
Call Eep_rd_sub 'EEP load
End If
End If
Debounce Pinb.0 , 1 , Rx_sub , Sub 'RX
Debounce Pinb.0 , 0 , Tx_sub , Sub 'TX
Debounce Pinb.0 , 0 , Tx_sub , Sub 'TX
If Flg_rit = 1 Then
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
Dds_dat = Vfo_dat + Rit_dat
Else
Dds_dat = Vfo_dat
End If
If Flg_tx = 1 Then
Dds_dat = Vfo_dat + If_frq
End If
Dds_dat = Vfo_dat + If_frq
End If
Call Dds_sub
Loop
End
Loop
End
'-----------------------------
'Encoder check,Create DDS data
'-----------------------------
'Encoder check,Create DDS data
'-----------------------------
Sub Enc_sub
If Pinb.5 = 1 Then
Flg_enc = 0 'Up
Else
Flg_enc = 1 'down
End If
If Pinb.5 = 1 Then
Flg_enc = 0 'Up
Else
Flg_enc = 1 'down
End If
If Flg_enc = 0 Then
Lng_wk1 = Vfo_dat + Enc_stp 'Up
Lng_wk2 = Rit_dat + Enc_stp
Else
Lng_wk1 = Vfo_dat - Enc_stp 'down
Lng_wk2 = Rit_dat - Enc_stp
End If
Lng_wk1 = Vfo_dat + Enc_stp 'Up
Lng_wk2 = Rit_dat + Enc_stp
Else
Lng_wk1 = Vfo_dat - Enc_stp 'down
Lng_wk2 = Rit_dat - Enc_stp
End If
If Flg_rit = 1 Then
Rit_dat = Lng_wk2
Else
Vfo_dat = Lng_wk1
Rit_dat = 0
End If
Rit_dat = Lng_wk2
Else
Vfo_dat = Lng_wk1
Rit_dat = 0
End If
If Vfo_dat < Lw_vfo Then 'VFO lower limit check
Vfo_dat = Lw_vfo
End If
Vfo_dat = Lw_vfo
End If
If Vfo_dat > Hi_vfo Then 'VFO upper limit check
Vfo_dat = Hi_vfo
End If
Vfo_dat = Hi_vfo
End If
If Rit_dat < Lw_rit Then 'RIT lower limit check
Rit_dat = Lw_rit
End If
Rit_dat = Lw_rit
End If
If Rit_dat > Hi_rit Then 'RIT upper limit check
Rit_dat = Hi_rit
End If
Rit_dat = Hi_rit
End If
Call Lcd_sub
End Sub
End Sub
'-----------------------------
'AD9850(DDS) Data write
'-----------------------------
'AD9850(DDS) Data write
'-----------------------------
Sub Dds_sub
Sng_wrk = Dds_dat / Multi
Lng_wk1 = Sng_wrk * Scal
Byt_cmd = Dds_cmd 'DDS command
Sng_wrk = Dds_dat / Multi
Lng_wk1 = Sng_wrk * Scal
Byt_cmd = Dds_cmd 'DDS command
Reset Portc.1
Shiftout Portc.0 , Portc.2 , Lng_wk1 , 3
Shiftout Portc.0 , Portc.2 , Byt_cmd , 3
Set Portc.1
End Sub
Shiftout Portc.0 , Portc.2 , Lng_wk1 , 3
Shiftout Portc.0 , Portc.2 , Byt_cmd , 3
Set Portc.1
End Sub
'-----------------------------
'LCD Data write
'-----------------------------
'LCD Data write
'-----------------------------
Sub Lcd_sub
Locate 1 , 1
Lng_wk1 = Vfo_dat + If_frq
Str_frq = Str(lng_wk1)
Str_frq = Format(str_frq , "00.000000")
Dsp_frq = Left(str_frq , 3) + Mid(str_frq , 4 , 3) + "." + Mid(str_frq , 7 , 3)
Lcd Byt_chn ; ":" ; Dsp_frq ; "Mhz"
Locate 2 , 1
Lcd "S: "
Locate 2 , 3
Lcd Enc_stp
Locate 1 , 1
Lng_wk1 = Vfo_dat + If_frq
Str_frq = Str(lng_wk1)
Str_frq = Format(str_frq , "00.000000")
Dsp_frq = Left(str_frq , 3) + Mid(str_frq , 4 , 3) + "." + Mid(str_frq , 7 , 3)
Lcd Byt_chn ; ":" ; Dsp_frq ; "Mhz"
Locate 2 , 1
Lcd "S: "
Locate 2 , 3
Lcd Enc_stp
If Flg_rit = 1 Then
Locate 2 , 8
Lcd "R: "
Str_frq = Str(rit_dat)
Str_frq = Format(str_frq , "00.000")
Locate 2 , 10
Lcd Str_frq
Else
Locate 2 , 8
Lcd " JA2GQP"
End If
End Sub
Locate 2 , 8
Lcd "R: "
Str_frq = Str(rit_dat)
Str_frq = Format(str_frq , "00.000")
Locate 2 , 10
Lcd Str_frq
Else
Locate 2 , 8
Lcd " JA2GQP"
End If
End Sub
'-----------------------------
'Step
'-----------------------------
'Step
'-----------------------------
Sub Stp_sub
Select Case Enc_stp
Case 10000:
Enc_stp = 1000 '1000
Case 1000:
Enc_stp = 100 '100
Case 100:
Enc_stp = 10 '10
Case 10:
Enc_stp = 10000 '10000
Case Else:
Enc_stp = 1000 '1000(initial)
End Select
Select Case Enc_stp
Case 10000:
Enc_stp = 1000 '1000
Case 1000:
Enc_stp = 100 '100
Case 100:
Enc_stp = 10 '10
Case 10:
Enc_stp = 10000 '10000
Case Else:
Enc_stp = 1000 '1000(initial)
End Select
Call Lcd_sub
End Sub
End Sub
'-----------------------------
'RIT
'-----------------------------
'RIT
'-----------------------------
Sub Rit_sub
If Flg_rit = 0 Then
Rit_dat = 0
Flg_rit = 1
If Flg_rit = 0 Then
Rit_dat = 0
Flg_rit = 1
Select Case Byt_chn
Case 1:
Frq_eep1 = Vfo_dat 'Save VFO1 data
Stp_eep1 = Enc_stp 'Save STEP1 data
Case 2:
Frq_eep2 = Vfo_dat 'Save VFO2 data
Stp_eep2 = Enc_stp 'Save STEP2 data
Case 3:
Frq_eep3 = Vfo_dat 'Save VFO3 data
Stp_eep3 = Enc_stp 'Save STEP3 data
Case Else:
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
End Select
Else
Flg_rit = 0
End If
Case 1:
Frq_eep1 = Vfo_dat 'Save VFO1 data
Stp_eep1 = Enc_stp 'Save STEP1 data
Case 2:
Frq_eep2 = Vfo_dat 'Save VFO2 data
Stp_eep2 = Enc_stp 'Save STEP2 data
Case 3:
Frq_eep3 = Vfo_dat 'Save VFO3 data
Stp_eep3 = Enc_stp 'Save STEP3 data
Case Else:
Frq_eep0 = Vfo_dat 'Save VFO0 data
Stp_eep0 = Enc_stp 'Save STEP0 data
End Select
Else
Flg_rit = 0
End If
Call Lcd_sub
End Sub
End Sub
'-----------------------------
'RX
'-----------------------------
'RX
'-----------------------------
Sub Rx_sub
If Flg_tx = 1 Then
Flg_tx = 0 'TX flag rest
Locate 1 , 1
Lcd Byt_chn
End If
End Sub
If Flg_tx = 1 Then
Flg_tx = 0 'TX flag rest
Locate 1 , 1
Lcd Byt_chn
End If
End Sub
'-----------------------------
'TX
'-----------------------------
'TX
'-----------------------------
Sub Tx_sub
If Flg_tx = 0 Then
Flg_tx = 1 'TX flag set
Locate 1 , 1
Lcd "T"
End If
End Sub
If Flg_tx = 0 Then
Flg_tx = 1 'TX flag set
Locate 1 , 1
Lcd "T"
End If
End Sub
'-----------------------------
'Channel SW check
'-----------------------------
'Channel SW check
'-----------------------------
Sub Chsw_sub
If Pinc.3 = 0 Then
Byt_chn = 1
Elseif Pinc.4 = 0 Then
Byt_chn = 2
Elseif Pinc.5 = 0 Then
Byt_chn = 3
Else
Byt_chn = 0
End If
Locate 1 , 1
Lcd Byt_chn
End Sub
If Pinc.3 = 0 Then
Byt_chn = 1
Elseif Pinc.4 = 0 Then
Byt_chn = 2
Elseif Pinc.5 = 0 Then
Byt_chn = 3
Else
Byt_chn = 0
End If
Locate 1 , 1
Lcd Byt_chn
End Sub
'-----------------------------
'EEP set
'-----------------------------
'EEP set
'-----------------------------
Sub Eep_rd_sub
If Frq_eep0 =< 0 Then 'EEP VFO data check
Vfo_dat = Def_vfo 'Initialize VFO data
Frq_eep0 = Vfo_dat
Frq_eep1 = Vfo_dat
Frq_eep2 = Vfo_dat
Frq_eep3 = Vfo_dat
Else 'Restore VFO data
Select Case Byt_chn
Case 1:
Vfo_dat = Frq_eep1
Case 2:
Vfo_dat = Frq_eep2
Case 3:
Vfo_dat = Frq_eep3
Case Else:
Vfo_dat = Frq_eep0
End Select
End If
If Frq_eep0 =< 0 Then 'EEP VFO data check
Vfo_dat = Def_vfo 'Initialize VFO data
Frq_eep0 = Vfo_dat
Frq_eep1 = Vfo_dat
Frq_eep2 = Vfo_dat
Frq_eep3 = Vfo_dat
Else 'Restore VFO data
Select Case Byt_chn
Case 1:
Vfo_dat = Frq_eep1
Case 2:
Vfo_dat = Frq_eep2
Case 3:
Vfo_dat = Frq_eep3
Case Else:
Vfo_dat = Frq_eep0
End Select
End If
If Stp_eep0 =< 0 Then 'EEP STEP data check
Enc_stp = 1000
Stp_eep0 = Enc_stp 'Initialize STEP data
Stp_eep1 = Enc_stp
Stp_eep2 = Enc_stp
Stp_eep3 = Enc_stp
Else 'Restore STEP data
Select Case Byt_chn
Case 1:
Enc_stp = Stp_eep1
Case 2:
Enc_stp = Stp_eep2
Case 3:
Enc_stp = Stp_eep3
Case Else:
Enc_stp = Stp_eep0
End Select
End If
Call Lcd_sub
End Sub
Enc_stp = 1000
Stp_eep0 = Enc_stp 'Initialize STEP data
Stp_eep1 = Enc_stp
Stp_eep2 = Enc_stp
Stp_eep3 = Enc_stp
Else 'Restore STEP data
Select Case Byt_chn
Case 1:
Enc_stp = Stp_eep1
Case 2:
Enc_stp = Stp_eep2
Case 3:
Enc_stp = Stp_eep3
Case Else:
Enc_stp = Stp_eep0
End Select
End If
Call Lcd_sub
End Sub
登録:
投稿 (Atom)