EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Example Routines; ADC Basic Operation (Polling Mode)

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
- 488 -
47u C?
P0.3
P0.4
P0.5
P0.6
P0.7
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
AGnd
AVref
AVcc
P5.4
Vcc
P5.5
Gnd
P0.2
P0.1
P0.0
P2.7
P2.6
P2.5
P2.4
P2.3
P2.2
P2.1
P2.0
P4.1
P3.7
P3.6
P3.5
P3.4
P3.3
P3.2
P3.1
P3.0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
STC8A8K64D4
System power
(Can be powered from USB)
Vin
Power On
Vcc
103
External analog
signal input
C?
System clock<=10MHz System clock>10MHz
104(0.1uF) 103(0.01uF)
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 = 0xbc;
sfr ADC_RES = 0xbd;
sfr ADC_RESL = 0xbe;
sfr ADCCFG = 0xde;
sfr P_SW2 = 0xba;
#define ADCTIM (*(unsigned cha volatile xdata *)0xfea8)
sfr P0M1 = 0x93;
sfr P0M0 = 0x94;
sfr P1M1 = 0x91;
sfr P1M0 = 0x92;
sfr P2M1 = 0x95;
sfr P2M0 = 0x96;
sfr P3M1 = 0xb1;
sfr P3M0 = 0xb2;
sfr P4M1 = 0xb3;

Table of Contents

Related product manuals