I am a newbie in this forum, and i am interested to joint to this forum.
I found below code on this website and i trying to do compiling, some pin of connection, lcd and processor has been changes, once compile i got an error, so please anyone here can help me to solved i happen that error from.
Here are the code :
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- $regfile = "m8def.dat"
- $crystal = 8000000
- $hwstack = 64
- $swstack = 64
- $framesize = 64
- Config Submode = New
- Config Lcd = 16x2
- Config Lcdpin = Pin , Db4 = Portc . 2 , Db5 = Portc . 3 , Db6 = Portc . 4 , Db7 = Portc . 5 , E = Portc . 1 , Rs = Portc . 0
- Deflcdchar 1 , 32 , 32 , 32 , 32 , 32 , 4 , 4 , 21
- Deflcdchar 2 , 16 , 16 , 16 , 16 , 16 , 20 , 20 , 21
- Deflcdchar 3 , 8 , 8 , 8 , 8 , 8 , 12 , 12 , 29
- Deflcdchar 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 21
- Deflcdchar 5 , 2 , 2 , 2 , 2 , 2 , 6 , 6 , 23
- Deflcdchar 6 , 1 , 1 , 1 , 1 , 1 , 5 , 5 , 21
- Cursor Off Noblink Cls
- '16 boxes x 5 positions = 80 // The scale can be divided ' 87.5MHz - 108MHz 1080-875 = 205 205/80 = 2.5625 <<<< 256 (Shift 8)
- Dim Value As Word
- Dim Scale As String * 16
- Dim Relay As Word
- Scale = String(16 , 1 )
- '--------- [FOR ENCODER ONNLY] ---------------------------------
- Config Portd . 2 = Input : Set Portd . 2 : Encoder_a Alias Pind . 2
- Config Portd . 3 = Input : Set Portd . 3 : Encoder_b Alias Pind . 3
- Config Portd . 7 = Input : Set Portd . 7 : Encoder_sw Alias Pind . 7
- Config Porta . 0 = Output : Relay Alias Porta . 0 : Reset Relay
- Config Int0 = Falling : Enable Int0 : On Int0 Encoder_isr Nosave Dim Encoder_turn_left As Byte , Encoder_turn_right As Byte
- Enable Interrupts ' ----------------------------------------------- --------------
- Sub Draw_scale(byval Value As Word )
- Local Help_w As Word Local Help_b As Byte Local X_pos As Byte Local Char As Byte
- Local Freq As String * 5
- Freq = Str(value )
- Freq = Format(freq , "00.0" )
- Locate 1 , 4
- If Value < 1000 Then Lcd Chr(32 ) Lcd Freq ; "MHz"
- Lowerline : Lcd Scale
- Help_w = Value - 875
- Help_w = Help_w * 100
- Shift Help_w , Right , 8
- Help_b = Help_w
- X_pos = Help_b / 5
- X_pos = X_pos + 1
- Char = Help_b Mod 5
- Char = Char + 2
- Locate 2 , 1 : Lcd Scale
- Locate 2 , X_pos : Lcd Chr(char )
- End Sub
- Value = 892
- Call Draw_scale(value )
- To If Encoder_turn_right > 0 Then Decr Encoder_turn_right
- If Value < 1079 Then '79 zero based = 80 Incr Value
- Call Draw_scale(value ) End If
- End If
- If Encoder_turn_left > 0 Then Decr Encoder_turn_left
- If Value > 875 Then Decr Value
- Call Draw_scale(value ) End If
- End If
- Loop End
- Encoder_isr :
- $ Asm
- PUSH R24
- ! in R24 , sreg
- PUSH R24
- $ End Asm
- If Encoder_b = 1 Then
- Encoder_turn_right = 1
- Else
- Encoder_turn_left = 1
- End If 'Tuned with NoSave Tool
- $ Asm
- POP R24
- ! out sreg , r24
- POP R24
- $ End Asm
- Return
Wea