W78E365/W78E365A
PWM0
PWM0
ENPWM 0/1/2/3/4/5
Register
Counter
X
+
PWM0
(P1.3)
>
PWMP
Counter
Y
1/2
8-bits Counter
PWM0OE
-
-
Fosc
X
Y
PWM1
Register
PWM1
Counter
+
-
PWM1
(P1.4)
>
>
>
>
PWM1OE
PWM2OE
X
Y
PWM2
Register
PWM2
Counter
+
-
PWM2
(P1.5)
X
Y
PWM3
Register
PWM3
Counter
+
-
PWM3
(P1.6)
PWM3OE
PWM4OE
X
Y
PWM4
Register
PWM4
Counter
+
-
PWM4
(P1.7)
FIGURE 1 PWM DIAGRAM
Please refer as below code.
mov pwmcon1, #00110011b ; enable pwm3, 2, 1, 0
mov pwmcon2, #00000101b ; enable pwm4
mov pwmp, #40h
jb p1.3, $
mov pwm0, #14h
jb p1.4, $
mov pwm1, #18h
jb p1.5, $
mov pwm2, #20h
jb p1.6, $
mov pwm3, #b0h
jb p1.7,$
mov pwm4, #40h
; Fpwm = XT/(2*(1+pwmp)*255)
; duty cycle high/low = pwm0/(255-pmw0)
mov pwmcon1, #11111111b ; output enable pwm3, 2, 1, 0
- 16 -