• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

can anyone help

rushi53

Member
how to generate pwm signal using 8051.plz explain
Hi there,
Last year I have written the routine for PWM generation.
I am copying that code here for you

Code:
for_rise_on1        clr mot1for       ;on period of pwm
                    mov r2,30H
                    djnz r2,$        
                    setb mot1for        ;off period of pwm
                    mov r2,31H
                    djnz r2,$
                    djnz r3,for_rise_on1   ;repeat the loop 10 times     
                    mov r3,#10
                    mov a,30H
                    add a,# 5          ;increment on period by 10 microsec
                    mov 30H,a
                    mov a,31H
                    subb a,# 5         ;decrement off period by 10 microsec
                    mov 31H,a
                    djnz r4,for_rise_on1   ;repeat the loop 20 times     
                    mov r4,#20
                    clr mot1for
Let me know if you need any more help
 

Latest threads

EE World Online Articles

Loading

 
Top