Download Print this page

Example Routines; Output Waveforms With Arbitrary Period And Arbitrary Duty - STC micro STC8A8K64D4 Series Reference Manual

Advertisement

STC8A8K64D4 Series Manual

19.3 Example Routines

19.3.1 Output waveforms with arbitrary period and arbitrary duty

C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr
P_SW2
=
sfr
PWMSET
=
sfr
PWMCFG1
=
#define
PWMC
#define
PWMCH
#define
PWMCL
#define
PWMCKS
#define
PWMTADC
#define
PWMTADCH
#define
PWMTADCL
#define
PWMIF
#define
PWMFDCR
#define
PWM0T1
#define
PWM0T1H
#define
PWM0T1L
#define
PWM0T2H
#define
PWM0T2
#define
PWM0T2L
#define
PWM0CR
#define
PWM0HLD
sfr
P0M1
=
sfr
P0M0
=
sfr
P1M1
=
sfr
P1M0
=
sfr
P2M1
=
sfr
P2M0
=
sfr
P3M1
=
sfr
P3M0
=
sfr
P4M1
=
sfr
P4M0
=
sfr
P5M1
=
sfr
P5M0
=
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
0xba;
0xF1;
0xF6;
(*(unsigned int volatile xdata *)0xFF00)
(*(unsigned char volatile xdata *)0xFF00)
(*(unsigned char volatile xdata *)0xFF01)
(*(unsigned char volatile xdata *)0xFF02)
(*(unsigned int volatile xdata *)0xFF03)
(*(unsigned char volatile xdata *)0xFF03)
(*(unsigned char volatile xdata *)0xFF04)
(*(unsigned char volatile xdata *)0xFF05)
(*(unsigned char volatile xdata *)0xFF06)
(*(unsigned int volatile xdata *)0xFF10)
(*(unsigned char volatile xdata *)0xFF10)
(*(unsigned char volatile xdata *)0xFF11)
(*(unsigned char volatile xdata *)0xFF12)
(*(unsigned int volatile xdata *)0xFF12)
(*(unsigned char volatile xdata *)0xFF13)
(*(unsigned char volatile xdata *)0xFF14)
(*(unsigned char volatile xdata *)0xFF15)
0x93;
0x94;
0x91;
0x92;
0x95;
0x96;
0xb1;
0xb2;
0xb3;
0xb4;
0xc9;
0xca;
- 550 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin