EasyManua.ls Logo

STC micro STC8A8K64D4 Series - PWM Implements Gradient Light (Breathing Light)

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
- 556 -
MOV A,#00H
MOV DPTR,#PWM0T2L
MOVX @DPTR,A
MOV A,#00H
MOV DPTR,#PWM1T2H ;At the count value of 0080H, PWM1 outputs high level.
MOVX @DPTR,A
MOV A,#80H
MOV DPTR,#PWM1T2L
MOVX @DPTR,A
MOV A,#07H
MOV DPTR,#PWM1T1H ;At the count value of 0780H, PWM1 outputs low level.
MOVX @DPTR,A
MOV A,#80H
MOV DPTR,#PWM1T1L
MOVX @DPTR,A
MOV A,#080H
MOV DPTR,#PWM0CR ;enable PWM0 output
MOVX @DPTR,A
MOV A,#80H
MOV DPTR,#PWM1CR ;enable PWM1 output
MOVX @DPTR,A
MOV P_SW2,#00H
MOV PWMCFG,#01H ;Start PWM module
JMP $
END
19.3.3 PWM Implements Gradient Light (Breathing Light)
C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
#define CYCLE 0x1000
sfr P_SW2 = 0xba;
sfr PWMSET = 0xF1;
sfr PWMCFG = 0xF6;
#define PWMC (*(unsigned int volatile xdata *)0xFF00)
#define PWMCH (*(unsigned char volatile xdata *)0xFF00)
#define PWMCL (*(unsigned char volatile xdata *)0xFF01)
#define PWMCKS (*(unsigned char volatile xdata *)0xFF02)
#define PWMTADC (*(unsigned int volatile xdata *)0xFF03)
#define PWMTADCH (*(unsigned char volatile xdata *)0xFF03)
#define PWMTADCL (*(unsigned char volatile xdata *)0xFF04)
#define PWMIF (*(unsigned char volatile xdata *)0xFF05)
#define PWMFDCR (*(unsigned char volatile xdata *)0xFF06)
#define PWM0T1 (*(unsigned int volatile xdata *)0xFF10)

Table of Contents

Related product manuals