STC8A8K64D4 Series Manual
17.5 Example Routines
17.5.1 ADC Basic Operation (Polling Mode)
C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr
ADC_CONTR
=
sfr
ADC_RES
=
sfr
ADC_RESL
=
sfr
ADCCFG
=
sfr
P_SW2
=
#define
ADCTIM
(*(unsigned cha volatile xdata *)0xfea8)
sfr
P0M1
=
sfr
P0M0
=
sfr
P1M1
=
sfr
P1M0
=
sfr
P2M1
=
sfr
P2M0
=
sfr
P3M1
=
sfr
P3M0
=
sfr
P4M1
=
1
2
3
4
5
External analog
6
signal input
7
8
System power
9
(Can be powered from USB)
10
103
11
12
13
Vin
14
15
Power On
16
17
Vcc
18
19
20
47u
C?
System clock<=10MHz
C?
104(0.1uF)
0xbc;
0xbd;
0xbe;
0xde;
0xba;
0x93;
0x94;
0x91;
0x92;
0x95;
0x96;
0xb1;
0xb2;
0xb3;
40
P0.3
P0.2
39
P0.4
P0.1
38
P0.5
P0.0
37
P0.6
P2.7
36
P0.7
P2.6
35
P1.0
P2.5
34
P1.1
P2.4
33
P1.2
P2.3
32
P1.3
P2.2
31
P1.4
P2.1
30
P1.5
P2.0
29
P1.6
P4.1
28
P1.7
P3.7
27
AGnd
P3.6
26
AVref
P3.5
25
AVcc
P3.4
24
P5.4
P3.3
23
Vcc
P3.2
22
P5.5
P3.1
21
Gnd
P3.0
STC8A8K64D4
System clock>10MHz
103(0.01uF)
- 488 -
Need help?
Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?