Problem mit Bascom Simulator
Hallo alle zusammen!
Ich probiere meine erste Schritte mit Bascom Avr zu machen (habe bis jetzt nur in ASM programmiert) und treffe bis jetzt nur auf Probleme!!
Ich habe folgenden Code aus dem Buch von Claus Kühnel 2.Auflage eingetippt (timer3.bas). Das ganze kompeliert und am simulator getestet
(Bascom AVR 1.11.7.9). Leider fuktionier das ganze nicht (timer1 wird in der Simulation nicht gestartet). Der Counter bleibt auf $00. Anschliessend habe ich das Ganze auch mit dem AVR-Studio 4 getestet. Dabei habe ich das von Bascom AVR generierte .hex File verwendet. Die Simulation fuktioniete 1A.
Frage:
Liegt der Fehler bei mir (was ich nicht glaube), oder ist evtl. die Software nicht ausgereift? (was ich nicht hoffe).
Vielen Dank!
[/fade][/b][/code]
Problem mit Bascom Simulator
Sorry Leute,
der Quellcode wurde nicht mit übertragen.
Das ganze also noch einmal.
$regfile = "m8def.dat"
$crystal = 4000000
$baud = 19200
Dim New_time As Bit
Dim Seconds As Byte
Dim Minutes As Byte
Dim Hours As Byte
Dim S As String * 2
Const True = 1
Const False = 0
Const Reload = 62500
Config Pind.3 = Input
Portd.3 = 1
Config Pinb.5 = Output
Key Alias Pind.3
Led Alias Portb.5
Led = 1
Config Timer1 = Timer , Prescale = 64
Ocr1ah = High(reload)
Ocr1al = Low(reload)
Tccr1a = 0
Set Tccr1b.3
On Compare1a Timer1_isr
Enable Compare1a
Enable Interrupts
Do
If Key = 0 Then
New_time = False
Seconds = 0
Minutes = 0
Hours = 0
End If
While New_time = True
If Seconds = 60 Then
Seconds = 0 : Incr Minutes
End If
If Minutes = 60 Then
Minutes = 0 : Incr Hours
End If
If Hours = 24 Then Hours = 0
S = Str(hours) : S = Format(s , "00") : Print S ; ":";
S = Str(minutes) : S = Format(s , "00") : Print S ; ":";
S = Str(seconds) : S = Format(s , "00") : Print S
New_time = False
Wend
Loop
End
Timer1_isr:
New_time = True
Incr Seconds
Led = 0 : Waitms 10 : Led = 1
Return
Problem mit Bascom Simulator
Hallo pebisoft,
ich habe es auch mit der älteren 1.11.7.4 Demo Version ausprobiert. Damit klappt es auch nicht. Die neue 1.11.7.9 auch Demo habe ich nur ausprobiert um einen evtl. Fehler der älteren Versionen auszuschliessen.
Hast Du dieses Listing vieleicht selber mal ausprobiert ob es bei dir läuft?
mfg Kosta