PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : sleep modus oder ähnliches



xxrider
29.08.2007, 22:38
hi,

für einen garagentorantrieb habe ich eine code-Schaltung mittels 2 Tastern
an atmega32 gemacht.

das programm stoppt mit "wait until pind.0=0" bis die richtige
Eingabe(folge) an den Tastern getätigt wird. Es funktioniert auch soweit.

Doch nach längerer wait-Zeit (denke so >10 stunden) funktioniert es bei
Eingabe der richtigen Kombination nicht mehr!

Nach reset (kurz spannungszufuhr unterbrechen) geht's wieder.

Gibt es bei dem Controller vielleicht so eine Art (automatischen)
Sleepmodus, oder woran könnte das liegen?

for_ro
29.08.2007, 23:12
Was ist denn "Wait Until ..."?
Ich kenne höchstens "Loop Until ..", oder ist das etwas Neues?

Gruß Rolf

xxrider
30.08.2007, 08:38
na klar, hast vollkommen recht ich meinte auch "loop until..."

Gruß
Holger

MeckPommER
30.08.2007, 10:13
Poste einfach mal den Code, dann kann man mal schauen.

Ist da irgendwo eine Variable, die überlaufen kann? Geht dem µC nach 10 Stunden der Saft aus? Für Fehler gibts halt immer mehr Möglichkeiten, als einem lieb ist ;-)

Gruß MeckPommER

xxrider
30.08.2007, 20:18
Config Timer0 = Timer , Prescale = 256 'Konfiguriere Timer0
'beim Testboard Prescale=1024
On Timer0 Interr 'verzweige Bei Timer0 überlauf Abbruch2
Enable Interrupts
Enable Timer0
Stop Timer0

A = 30
B = 1


Program:

Cls
Locate 1 , 1
Lcd "Reset"
Waitms 200
Cls

Do
Loop Until Pina.0 = 0 Or Pina.2 = 0
If Pina.2 = 0 Then Goto Abbruch

Waitms 30

Do
Loop Until Pina.0 = 1

B = 1

Start Timer0
'anschalten
Do
Loop Until Pina.2 = 0 Or Pina.0 = 0
If Pina.0 = 0 Then
Goto Abbruch
Else
Waitms 30

Do
Loop Until Pina.2 = 1
Waitms 30

Do
Loop Until Pina.2 = 0 Or Pina.0 = 0
If Pina.0 = 0 Then
Goto Abbruch
Else
Waitms 30
Do
Loop Until Pina.2 = 1
Waitms 30
Do
Loop Until Pina.2 = 0 Or Pina.0 = 0
If Pina.2 = 0 Then
Goto Abbruch
Else
Waitms 30
Do
Loop Until Pina.0 = 1
Waitms 30
Do
Loop Until Pina.2 = 0 Or Pina.0 = 0
If Pina.0 = 0 Then
Goto Abbruch
Else
Waitms 30
Do
Loop Until Pina.2 = 1
If B > 180 Then
Goto Abbruch
Else
Waitms 30
End If
A = 60
Portd.4 = 1
Portb.0 = 1

Waitms 800
Portd.4 = 0
Portb.0 = 0

A = 30

End If
End If
End If
End If

Goto Program


Abbruch:

Stop Timer0
B = 1
Portd.3 = 0

Locate 1 , 1
Lcd "Fehler:"
Waitms 500
Locate 2 , 1
Lcd "Wartezeit"
Wait A
A = A + 30
If A >= 70 Then
Cls
Locate 1 , 1
Lcd "Code falsch"
Portb.1 = 1
Stop
Else
Goto Program

End If


Interr:
B = B + 1
Return

End

das is er