PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Bascom zeigt Errors nicht an



YaNnIk
09.01.2010, 16:07
Hi Leute..

Erstmal poste ich jetzt hier meinen Code :


$regfile = "m16def.dat"
$crystal = 4000000
$hwstack = 32

Config Porta = Output
Config Portc = Output
Config Portd.4 = Output
Config Portd.5 = Output
Config Portd.6 = Output
Config Portd.7 = Output
Config Portb.0 = Output
Config Portb.1 = Output
Config Portb.4 = Output
Config Portd.2 = Input
Config Portd.3 = Input
Config Portb.2 = Input

Ledr1 Alias Porta.0
Ledr2 Alias Porta.1
Ledr3 Alias Porta.2
Ledr4 Alias Porta.3
Ledr5 Alias Porta.4
Ledr6 Alias Porta.5
Ledr7 Alias Porta.6
Ledl1 Alias Portc.0
Ledl2 Alias Portc.1
Ledl3 Alias Portc.2
Ledl4 Alias Portc.3
Ledl5 Alias Portc.4
Ledl6 Alias Portc.5
Ledl7 Alias Portc.6
Ledrstrip Alias Porta.7
Ledlstrip Alias Portc.7
Striprot Alias Portb.0
Stripgruen Alias Portb.1
Striporange Alias Portb.4
Stripweiss1 Alias Portd.4
Stripweiss2 Alias Portd.5
Stripblau1 Alias Portd.6
Stripblau2 Alias Portd.7

Dim Lesen1 As Bit
Dim Lesen2 As Bit
Dim Lesen3 As Bit
Dim Empf_wert1 As Byte
Dim Empf_wert2 As Byte
Dim Empf_wert3 As Byte
Dim Test As Bit
Dim Test2 As Bit

Lesen1 = 0
Lesen2 = 0
Lesen3 = 0

Config Timer0 = Timer , Prescale = 64
Enable Timer0
Stop Timer0
On Timer0 Error
Config Timer1 = Timer , Prescale = 64
Enable Timer1
Stop Timer1
On Timer1 Error
Config Timer2 = Timer , Prescale = 64
Enable Timer2
Stop Timer2
On Timer2 Error



Config Int0 = Change
On Int0 Messen1
Config Int1 = Change
On Int1 Messen2
On Int2 Messen3
Enable Interrupts
Enable Int0
Enable Int1
Enable Int2


Do

Gosub Hauptprogramm

Loop

End


Hauptprogramm:

If Empf_wert3 > 104 Then
Gosub Flash_all2
End If

If Empf_wert3 > 83 Then
Gosub Flash_all1
End If

If Empf_wert2 > 94 Then
Striprot = 1
Stripgruen = 1
Striporange = 1
Stripweiss1 = 1
Stripweiss2 = 1
Stripblau1 = 1
Stripblau2 = 1
Else
Striprot = 0
Stripgruen = 0
Striporange = 0
Stripweiss1 = 0
Stripweiss2 = 0
Stripblau1 = 0
Stripblau2 = 0
End If

If Empf_wert1 > 104 Then
Gosub Blinken
End If

If Empf_wert1 > 94 Then
Gosub Lauflicht2
End If

If Empf_wert1 > 83 Then
Gosub Lauflicht1
End If

If Empf_wert1 > 73 Then
Gosub Led_an
Else
Gosub Led_aus
End If

Return


Messen1:

If Lesen1 = 0 Then
Start Timer0
Lesen1 = 1
Else
Stop Timer0
Empf_wert1 = Timer0
Timer0 = 0
Lesen1 = 0
End If

If Empf_wert1 >= Test And Empf_wert1 <= Test2 Then
Test = Empf_wert1 - 5
Test2 = Empf_wert1 + 5
Return
End If

If Empf_wert1 <= Test Or >= Test2 Then
Test = Empf_wert1 - 5
Test2 = Empf_wert1 + 5
Gosub Hauptprogramm
End If

Return


Messen2:

If Lesen2 = 0 Then
Start Timer1
Lesen2 = 1
Else
Stop Timer1
Empf_wert2 = Timer1
Lesen2 = 0
End If

Return


Messen3:

If Lesen3 = 0 Then
Start Timer2
Lesen3 = 1
Else
Stop Timer2
Empf_wert3 = Timer2
Lesen3 = 0
End If

Return



Error:

Stop Timer0
Ledr1 = 1
Ledr2 = 1
Ledr3 = 1
Ledr4 = 1
Ledr5 = 1
Ledr6 = 1
Ledr7 = 1
Ledl1 = 1
Ledl2 = 1
Ledl3 = 1
Ledl4 = 1
Ledl5 = 1
Ledl6 = 1
Ledl7 = 1
Ledrstrip = 1
Ledlstrip = 1
Striprot = 1
Stripgruen = 1
Striporange = 1
Stripweiss1 = 1
Stripweiss2 = 1
Stripblau1 = 1
Stripblau2 = 1
Return


Led_an:

Ledr1 = 1
Ledr2 = 1
Ledr3 = 1
Ledr4 = 1
Ledr5 = 1
Ledr6 = 1
Ledr7 = 1
Ledl1 = 1
Ledl2 = 1
Ledl3 = 1
Ledl4 = 1
Ledl5 = 1
Ledl6 = 1
Ledl7 = 1
Ledrstrip = 1
Ledlstrip = 1

Gosub Hauptprogramm

Return


Led_aus:

Ledr1 = 0
Ledr2 = 0
Ledr3 = 0
Ledr4 = 0
Ledr5 = 0
Ledr6 = 0
Ledr7 = 0
Ledl1 = 0
Ledl2 = 0
Ledl3 = 0
Ledl4 = 0
Ledl5 = 0
Ledl6 = 0
Ledl7 = 0
Ledrstrip = 0
Ledlstrip = 0

Gosub Hauptprogramm

Return


Lauflicht1:

Ledr1 = 1
Ledr2 = 1
Ledr3 = 1
Ledr4 = 1
Ledr5 = 1
Ledr6 = 1
Ledr7 = 0
Ledl1 = 1
Ledl2 = 1
Ledl3 = 1
Ledl4 = 1
Ledl5 = 1
Ledl6 = 1
Ledl7 = 1
Ledrstrip = 1
Ledlstrip = 1
Waitms 65
Ledr7 = 1
Ledr6 = 0
Waitms 65
Ledr6 = 1
Ledr5 = 0
Waitms 65
Ledr5 = 1
Ledr4 = 0
Waitms 65
Ledr4 = 1
Ledr3 = 0
Waitms 65
Ledr3 = 1
Ledr2 = 0
Waitms 65
Ledr2 = 1
Ledr1 = 0
Waitms 65
Ledr1 = 1
Waitms 65
Ledl1 = 0
Waitms 65
Ledl1 = 1
Ledl2 = 0
Waitms 65
Ledl2 = 1
Ledl3 = 0
Waitms 65
Ledl3 = 1
Ledl4 = 0
Waitms 65
Ledl4 = 1
Ledl5 = 0
Waitms 65
Ledl5 = 1
Ledl6 = 0
Waitms 65
Ledl6 = 1
Ledl7 = 0
Waitms 65
Ledl7 = 1
Waitms 65
Ledl7 = 0
Waitms 65
Ledl7 = 1
Ledl6 = 0
Waitms 65
Ledl6 = 1
Ledl5 = 0
Waitms 65
Ledl5 = 1
Ledl4 = 0
Waitms 65
Ledl4 = 1
Ledl3 = 0
Waitms 65
Ledl3 = 1
Ledl2 = 0
Waitms 65
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= 0
Ledl7 = 0
Waitms 65
Ledr7 = 1
Ledl7 = 1

Gosub Hauptprogramm

Return


Blinken:

Ledr1 = 1
Ledr2 = 0
Ledr3 = 1
Ledr4 = 0
Ledr5 = 1
Ledr6 = 0
Ledr7 = 1
Ledl1 = 0
Ledl2 = 1
Ledl3 = 0
Ledl4 = 1
Ledl5 = 0
Ledl6 = 1
Ledl7 = 0
Ledrstrip = 1
Ledlstrip = 1
Waitms 100
Ledr1 = 0
Ledr2 = 1
Ledr3 = 0
Ledr4 = 1
Ledr5 = 0
Ledr6 = 1
Ledr7 = 0
Ledl1 = 1
Ledl2 = 0
Ledl3 = 1
Ledl4 = 0
Ledl5 = 1
Ledl6 = 0
Ledl7 = 1
Waitms 100

Gosub Hauptprogramm

Return


Flash_all1:

Ledr1 = 1
Ledr2 = 1
Ledr3 = 1
Ledr4 = 1
Ledr5 = 1
Ledr6 = 1
Ledr7 = 1
Ledl1 = 1
Ledl2 = 1
Ledl3 = 1
Ledl4 = 1
Ledl5 = 1
Ledl6 = 1
Ledl7 = 1
Ledrstrip = 1
Ledlstrip = 1
Striprot = 1
Stripgruen = 1
Striporange = 1
Stripweiss1 = 1
Stripweiss2 = 1
Stripblau1 = 1
Stripblau2 = 1
Waitms 125
Ledr1 = 0
Ledr2 = 0
Ledr3 = 0
Ledr4 = 0
Ledr5 = 0
Ledr6 = 0
Ledr7 = 0
Ledl1 = 0
Ledl2 = 0
Ledl3 = 0
Ledl4 = 0
Ledl5 = 0
Ledl6 = 0
Ledl7 = 0
Ledrstrip = 0
Ledlstrip = 0
Striprot = 0
Stripgruen = 0
Striporange = 0
Stripweiss1 = 0
Stripweiss2 = 0
Stripblau1 = 0
Stripblau2 = 0
Waitms 125

Gosub Hauptprogramm

Return

Flash_all2:

Ledr1 = 1
Ledr2 = 0
Ledr3 = 1
Ledr4 = 0
Ledr5 = 1
Ledr6 = 0
Ledr7 = 1
Ledl1 = 0
Ledl2 = 1
Ledl3 = 0
Ledl4 = 1
Ledl5 = 0
Ledl6 = 1
Ledl7 = 0
Ledrstrip = 0
Ledlstrip = 1
Striprot = 1
Stripgruen = 0
Striporange = 1
Stripweiss1 = 0
Stripweiss2 = 1
Stripblau1 = 0
Stripblau2 = 1
Waitms 100
Ledr1 = 0
Ledr2 = 1
Ledr3 = 0
Ledr4 = 1
Ledr5 = 0
Ledr6 = 1
Ledr7 = 0
Ledl1 = 1
Ledl2 = 0
Ledl3 = 1
Ledl4 = 0
Ledl5 = 1
Ledl6 = 0
Ledl7 = 1
Ledrstrip = 1
Ledlstrip = 0
Striprot = 0
Stripgruen = 1
Striporange = 0
Stripweiss1 = 1
Stripweiss2 = 0
Stripblau1 = 1
Stripblau2 = 0

Gosub Hauptprogramm

Return

Wenn ich den versuche zu compilieren steht unten in der Leiste :

"Errors : 5 found"
Es steht nicht da um welche Errors es sich handelt und sobald ich die Maus bewege verschwindet die Textzeile auch.. Aber die Hex wurde nicht compiliert..

Also, die Errors müssen sich im folgenden Abschnitt befinden :


Messen1:

If Lesen1 = 0 Then
Start Timer0
Lesen1 = 1
Else
Stop Timer0
Empf_wert1 = Timer0
Timer0 = 0
Lesen1 = 0
End If

If Empf_wert1 >= Test And Empf_wert1 <= Test2 Then
Test = Empf_wert1 - 5
Test2 = Empf_wert1 + 5
Return
End If

If Empf_wert1 <= Test Or >= Test2 Then
Test = Empf_wert1 - 5
Test2 = Empf_wert1 + 5
Gosub Hauptprogramm
End If

Return

Und in dieser ISR können die Fehler auch nur in dem unteren Teil sein, also :


If Empf_wert1 >= Test And Empf_wert1 <= Test2 Then
Test = Empf_wert1 - 5
Test2 = Empf_wert1 + 5
Return
End If

If Empf_wert1 <= Test Or >= Test2 Then
Test = Empf_wert1 - 5
Test2 = Empf_wert1 + 5
Gosub Hauptprogramm
End If

Return

Ddenn wenn ich diesen Teil weglasse, gehts ohne Errors...

Um mal kurz zu erklären, was dieser Teil machen soll :

Also in der ISR wird das PWM Signal eines RC-Empfängers gemessen um im Wert "Empf_wert1" gespeichert..

Das Hauptprogramm fragt verschiedene Empf_werte ab und startet je nachdem eine andere Subroutine.. In diesem Subroutinen wird teilweise mit Wait befehlen gearbeitet, also können diese auch mal ein paar sekunden dauern.. wenn sich nun der Empf_wert1 geänder hätte, würde trotzdem noch die "alte" Subroutine zu Ende laufen, was ich aber nciht wollte..

was ich erreichen wollte war : wenn sich der Empf_wert1 (bis auf geringe Schwankungen) nicht geändert hatte soll mit Return wieder dahin gesprungen werden, wo vorher aufgehört wurde.. Wenn sich der Wert aber ändert, soll wieder das Hauptprogramm ausgewählt werden um die zu dem neuen Wert passende Subroutine zu starten..


Ich finde in diesem Codeabschnitt keine Fehler und da Bascom sie nciht anzeigt weiß ich auch nicht wie ichs beheben soll...

Weiß einer woran das liegt, dass Bascom nciht die genauen Fehler anzeigt???

Und/Oder weiß jemand, was in dem Abschnitt falsch ist???

Danke im Vorraus ;-)


Mfg Yannik

radbruch
09.01.2010, 16:27
Zeile 151: If Empf_wert1 >= Test And Empf_wert1 <= Test2 Then

Aha, so funktioniert das Übersetzen:

Dim Test As Byte
Dim Test2 As Byte

empf_wert1 und test/test2 sind nicht der selbe Datentyp

Und das ist wohl noch ein Bug:
If Empf_wert1 <= Test Or >= Test2 Then
____________________^____________

YaNnIk
09.01.2010, 18:59
Merci ;-) Jetzt geht es \:D/