Forum: Mikrocontroller und Digitale Elektronik Mit Timer 0 Zeitverzögerung über 300 Takte


von R--- S. (rene66)


Lesenswert?

hallo,

 habe das jetzt so versucht:
1
              lds  tempH,vorzeitH
2
Ltime1:       lds  tempL,vorzeitL
3
vzeit2:        out  OCR0,templ        ;Timer mit Match L Wert laden
4
           clr  templ
5
               out  TCNT0,templ
6
               ldi  tempL, (0<<CS02)|(0<<CS01)|(1<<CS00)
7
         out  TCCR0, tempL            ; Timer Start nach Match wieder von vorn
8
vzeit:       in   templ,TIFR
9
               andi templ,0b00000010
10
               sbrs templ,OCF0             ;OCF0
11
               rjmp vzeit
12
         ori  templ,(1<<OCF0)     
13
               out  TIFR,templ
14
               cpi  temph,0
15
         breq out_tim0
16
         ldi  templ,0xff
17
         dec  temph
18
               rjmp vzeit2
19
out_tim0:      ldi  tempL, (0<<CS02)|(0<<CS01)|(0<<CS00) ; Timer Stop
20
               out  TCCR0, templ

aber irgend wo ist ein Fehler sobald vorzeitH >0 stimmen die Zeiten 
nicht mehr

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.