Timer Programmieren

Gast #557451
Lesenswert?

Hallo! habe folgenden Code in einen C8051FX20-TB reingeladen. hatte 
keine Fehlermeldung und er hat das Programm vom EDE Tasking auch 
übertragen.
Habe aber keine Ausgabe am Pin 3.0 könnte mir da jemand Weiterhelfen.

PWM_OFFVALUE    EQU   10
PWM_ONVALUE     EQU   11
PWM_COUNT       EQU   12
PWM_OUT         EQU P3.0


 ORG 0h
        jmp start

; Interruptbehandlungsroutine Timer 0
; Jeder Durchlauf braucht 9 Zyklen
 ORG 0Bh
        djnz PWM_COUNT, pwm_exit
        jb PWM_OUT, pwm_on
pwm_off:
        mov PWM_COUNT, PWM_ONVALUE
        setb PWM_OUT
        reti
pwm_on:
        mov PWM_COUNT, PWM_OFFVALUE
        clr PWM_OUT
pwm_exit:
        reti

; Initialisierung
start:
        mov TL0, #235
        mov TH0, #235
        mov SP,  #20h
        mov TMOD,#2
        mov TCON,#16
        mov IE,  #130

; Hauptprogramm
main:

        mov a,#200
        subb a,#20
        mov PWM_ONVALUE, a
        subb a,#255
        mov PWM_OFFVALUE, a
        jmp main
END


Vielen dAnk im voraus.
Gruss Sven

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren