Download Print this page

Use Pwm To Trigger Adc Conversion - STC micro STC8A8K64D4 Series Reference Manual

Advertisement

STC8A8K64D4 Series Manual

19.3.4 Use PWM to trigger ADC conversion

C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr
P_SW2
=
sfr
PWMSET
=
sfr
PWMCFG
=
#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
ADC_CONTR
=
#define
ADC_POWER
#define
ADC_START
#define
ADC_FLAG
#define
ADC_EPWMT
sfr
ADC_RES
=
sfr
ADC_RESL
=
sbit
EADC
=
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 delay()
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)
0xbc;
0x80
0x40
0x20
0x10
0xbd;
0xbe;
IE^5;
0x93;
0x94;
0x91;
0x92;
0x95;
0x96;
0xb1;
0xb2;
0xb3;
0xb4;
0xc9;
0xca;
- 561 -

Advertisement

loading
Need help?

Need help?

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

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin