EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 570

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
- 554 -
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
PWMSET = 0x01; //Enable PWM module (The configuration is effective only after
the module is enabled.)
P_SW2 = 0x80;
PWMCKS = 0x00; //The clock of PWM is the system clock
PWMC = 0x0800; //Set the PWM cycle to 0800H PWM clocks
PWM0T1= 0x0100; //At the count value of 100H, PWM0 outputs low level.
PWM0T2= 0x0700; //At the count value of 700H, PWM0 outputs high level.
PWM1T2= 0x0080; //At the count value of 0080H, PWM1 outputs high level.
PWM1T1= 0x0780; //At the count value of 0780H, PWM1 outputs low level.
PWM0CR= 0x80; //enable PWM0 output
PWM1CR= 0x80; //enable PWM1 output
P_SW2 = 0x00;
PWMCFG = 0x01; //Start PWM module
while (1);
}
Assembly code
;Operating frequency for test is 11.0592MHz
P_SW2 DATA 0BAH
PWMSET DATA 0F1H
PWMCFG DATA 0F6H
PWMCH EQU 0FF00H
PWMCL EQU 0FF01H
PWMCKS EQU 0FF02H
PWMTADCH EQU 0FF03H
PWMTADCL EQU 0FF04H
PWMIF EQU 0FF05H
PWMFDCR EQU 0FF06H
PWM0T1H EQU 0FF10H
PWM0T1L EQU 0FF11H
PWM0T2H EQU 0FF12H
PWM0T2L EQU 0FF13H
PWM0CR EQU 0FF14H
PWM0HLD EQU 0FF15H
PWM1T1H EQU 0FF18H
PWM1T1L EQU 0FF19H
PWM1T2H EQU 0FF1AH

Table of Contents

Related product manuals