Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20606

BASCOM-AVR : beg on my base correction : NEWTOPIC

$
0
0
hello all, please have a base in the correction I was there fault,, where lies the fault, and the like where to fix it. thank you [code:1:2dc74ffcf9]' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' 80M VCO '‘ PLL LM7001 '‘ ATMega8 ' 16×2 LCD '‘ 10mhz If Freq '‘******************************************************************************* $regfile = "m8def.dat" $crystal = 8000000 $swstack = 32 $hwstack = 32 $framesize = 32 Declare Sub Send_command(byval Pmode As Word , Byval Value As Word ) Declare Sub Init_pll Declare Sub Incr_pll Declare Sub Decr_pll Declare Sub Store_pll Declare Sub Dsp_freq '‘******************************************************************************* '‘ config pin '‘******************************************************************************* Config Lcdmode = Port 'Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , E = Portc.4 , Rs = Portc.5 'Config Lcd = 16 * 2 Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2 Config Lcd = 16 * 2 Cursor Off Noblink Cls Config Portd = Output Config Portd.5 = Output Config Portd.6 = Output Config Portd.7 = Output Config Pinb.0 = Input Config Pinb.1 = Input Config Pinb.2 = Input Cen Alias Portd.7 Clk Alias Portd.6 Dat Alias Portd.5 '******************************************************************************* '‘ Variable '‘******************************************************************************* Dim I As Word Dim J As Byte Dim Pmode As Word Dim Button As Byte Dim Freq As Word Dim Efreq As Eram Word At &H10 Dim Sfreq As Word Dim Dfreq As Word Dim Sdfreq As String * 5 '‘******************************************************************************* '‘ main program '‘******************************************************************************* Initialization: Waitms 100 Reset Cen Reset Clk Reset Dat Set Portb.0 Set Portb.1 Set Portb.2 Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 31 , 32 Deflcdchar 0 , 31 , 31 , 32 , 17 , 27 , 27 , 31 , 31 ‘ Antenna Symb Deflcdchar 1 , 31 , 31 , 31 , 30 , 29 , 11 , 23 , 31 ‘ Memory Deflcdchar 2 , 14 , 16 , 12 , 2 , 30 , 9 , 9 , 9 ‘ S / N Deflcdchar 4 , 32 , 32 , 32 , 32 , 32 , 32 , 31 , 32 ‘ S1 Deflcdchar 5 , 32 , 32 , 32 , 32 , 1 , 31 , 31 , 32 ‘ S2 Deflcdchar 6 , 32 , 32 , 32 , 7 , 31 , 31 , 31 , 32 ‘ S3 Deflcdchar 7 , 1 , 7 , 31 , 31 , 31 , 31 , 31 , 32 ‘ S4 Cls : Cursor Off Locate 1 , 1 : Lcd "80m RX SSB V1.0 " Locate 2 , 1 : Lcd "experimental2010" Waitms 10 Main: Pmode = 704 Pmode = 896 Cls Locate 1 , 1 : Lcd " KHz" Locate 2 , 1 : Lcd " experimental " Call Init_pll Call Dsp_freq Do Button = Pinb And &H07 Select Case Button Case 3 : Call Store_pll Case 5 : Call Decr_pll Case 6 : Call Incr_pll End Select Loop Goto Main End '******************************************************************************* ' Init PLL '******************************************************************************* Sub Init_pll Freq = Efreq If Freq = 65535 Then Freq = 10000 End If Call Send_command(704 , Freq) Call Dsp_freq Locate 1 , 1 : Lcd Chr(1) Locate 1 , 2 : Lcd Chr(0) End Sub '******************************************************************************* ' Incr_PLL '******************************************************************************* Sub Incr_pll Incr Freq If Freq > 14500 Then Freq = 14500 End If Call Send_command(704 , Freq) Call Dsp_freq Locate 1 , 1 : Lcd " " End Sub '******************************************************************************* ' Decr_PLL '******************************************************************************* Sub Decr_pll Decr Freq If Freq < 10000 Then Freq = 10000 End If Call Send_command(704 , Freq) Call Dsp_freq Locate 1 , 1 : Lcd " " End Sub '******************************************************************************* ' Store PLL '******************************************************************************* Sub Store_pll If Sfreq <> Freq Then Efreq = Freq Sfreq = Efreq End If Locate 1 , 1 : Lcd Chr(1) Waitms 50 End Sub '******************************************************************************* ' Display PLL '******************************************************************************* Sub Dsp_freq Dfreq = Freq - 8000 Sdfreq = Str(dfreq) Sdfreq = Format(sdfreq , "0.000") Locate 1 , 8 : Lcd Sdfreq Waitms 50 End Sub '******************************************************************************* ' Send Command '******************************************************************************* Sub Send_command(byval Pmode As Word , Byval Value As Word) Set Cen Waitus 20 Shiftout Dat , Clk , Cmode , 3 , 24 , 10 Bit 0 To 13(n Value) For I = 0 To 13 If Value.i = 1 Then Set Dat Else Reset Dat End If Waitus 10 Set Clk Waitus 10 Reset Clk Waitus 10 Next I Bit 14 - 23(mode) For I = 0 To 9 If Pmode.i = 1 Then Set Dat Else Reset Dat End If Waitus 10 Set Clk Waitus 10 Reset Clk Waitus 10 Next I Waitus 20 Reset Cen End Sub[/code:1:2dc74ffcf9] [b:2dc74ffcf9][color=red:2dc74ffcf9](BASCOM-AVR version : 2.0.7.6 , Latest : 2.0.7.6 )[/b:2dc74ffcf9][/color:2dc74ffcf9]

Viewing all articles
Browse latest Browse all 20606

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>