EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 568

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 552 -
LJMP MAIN
ORG 0100H
MAIN:
MOV SP, #5FH
MOV P0M0, #00H
MOV P0M1, #00H
MOV P1M0, #00H
MOV P1M1, #00H
MOV P2M0, #00H
MOV P2M1, #00H
MOV P3M0, #00H
MOV P3M1, #00H
MOV P4M0, #00H
MOV P4M1, #00H
MOV P5M0, #00H
MOV P5M1, #00H
MOV PWMSET,#01H ;Enable PWM module (The configuration is effective only after the module is
enabled.)
MOV P_SW2,#80H
CLR A
MOV DPTR,#PWMCKS
MOVX @DPTR,A ;The clock of PWM is the system clock
MOV A,#10H
MOV DPTR,#PWMCH ;Set the PWM cycle to 1000H PWM clocks
MOVX @DPTR,A
MOV A,#00H
MOV DPTR,#PWMCL
MOVX @DPTR,A
MOV A,#01H
MOV DPTR,#PWM0T1H ;At the count value of 100H, the PWM0 channel outputs low level.
MOVX @DPTR,A
MOV A,#00H
MOV DPTR,#PWM0T1L
MOVX @DPTR,A
MOV A,#05H
MOV DPTR,#PWM0T2H ;At the count value of 500H, the PWM0 channel outputs high level.
MOVX @DPTR,A
MOV A,#00H
MOV DPTR,#PWM0T2L
MOVX @DPTR,A
MOV A,#80H
MOV DPTR,#PWM0CR ;enable PWM0 output
MOVX @DPTR,A
MOV P_SW2,#00H
MOV PWMCFG,#01H ;Start PWM module
JMP $
END

Table of Contents

Related product manuals