Forum: Mikrocontroller und Digitale Elektronik Attiny25 Deadtime


von roby (Gast)


Lesenswert?

Hallo,
ich versuche eine Totzeit beim Attiny25
am Port OCR1B zu programmieren.
Die PWM funktioniert, aber die Totzeit ist nicht da?
Was ist falsch?
anbei Ausschnitt Quellcode

      ldi temp, (1<<PLLE)  ; Enable PLL
      out PLLCSR, temp
waitPLL:

      in temp, PLLCSR  ; Wait for PLL 100ms)
      sbrs temp,PLOCK
      rjmp waitPLL

      in temp, PLLCSR  ; Set PLL as PWM clock source 64Mhz
      ldi temp1,(1<<PCKE)
      or temp,temp1
      out PLLCSR,temp


      ldi temp,(1<<CS12)|(1<<CS10); 30 kHz Takt
        out TCCR1,temp


        ldi temp,(1<<PWM1B)|(1<<COM1B0)  ;Port B3 Comparator
       out GTCCR,temp


      ldi temp1,3  ;Deadtime Teiler 8x
      out DTPS1,temp

      ldi temp1,255  ;Deadtime B Comparator  Max
       out DT1B,temp

von Forist (Gast)


Lesenswert?

Guck mal in Zeile 42 ;-)
Wie, keine Zeilennummern? Das würde die Diskussion über deinen Code 
erheblich vereinfachen.

Hat es einen besonderen Grund, dass du keine code-Tags verwendest, wie 
unter "Formatierung" angegeben?

von S. Landolt (Gast)


Lesenswert?

In den letzten 4 Zeilen: temp <-> temp1

von S. Landolt (Gast)


Lesenswert?

Noch eine Anmerkung: 'out DTPS1,temp' geht schief, das Datenblatt ist an 
dieser Stelle (14.1.1) falsch, siehe tn25def.inc:
1
.equ  DTPS  = 0x23
2
; DTPS - Dead time prescaler register
3
.equ  DTPS0  = 0  ; 
4
.equ  DTPS1  = 1  ;

von Roby (Gast)


Lesenswert?

Hallo  S. Landolt,

Danke für den Tipp.

VG Roby

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.