Gast
#344902
Hallo Zusammen
So wie ich das Forum beurteile, kann mir bestimmt jemand helfen.
Möchte in einem Projekt eine PWM Rampe durch subtahieren eines Betrages
eine Rampe erzeugen, leider geht es von X >125 nur bis 125, danach
springt mir der Befehl cpi ; brge als wäre ich schon am Ziel.
Hat bitte jemand ein Tip, irgend wo ist da der Wurm drin.
Drive_up: ;up= PortA,0=1 + PortB,1=0
sbi PortB, 3 ;"Down-LOW" Kurzschluss Fet abschalten
cbi PortA, 1 ;Down High Fet 50V abschalten
ldi Rampe, 240
rcall Umschaltzeit
Drive_up2:
ldi temp, (1<<COM1A1)|(0<<COM1A0)|(1<<PWM1A) ;PWM Ausgang)
out TCCR1A, temp
ldi temp, (0<<CS13)|(0<<CS12)|(0<<CS11)|(1<<CS10) ;PWM
out TCCR1B, temp
cpi Rampe, 30 ;PWM_Wert_UP !!!Problempunkt
brge voll !!!Problempunkt
subi Rampe, 5
mov temp, Rampe
rjmp OCR1A_
voll:
ldi temp, PWM_up
OCR1A_:
out OCR1A, temp
ldi temp, 125
out OCR1C, temp
sbi PortA, 0 ;UP High Fet 50V einschalten
sbic PinA, 6 ;"Up" Input nicht mehr aktiv?
rjmp Bremsen
sbis PinA, 7 ;"down" Input aktiv?
rjmp Bremsen
sbis PinA, 4 ;"Stop up" Input aktiv?
rjmp Bremsen
rcall Umschaltzeit
;Vergleiche Analog Werte
cp MWC_L, XL ;Compare low Byte
cpc MWC_H, XH ;Compare high Byte
brsh OFF_up
rjmp Drive_up2
Vielen Dank
Philfly