SN32F280 Series
32-Bit Cortex-M0 Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 94
Version 1.1
7.3 ADC CONTROL NOTICE
7.3.1 ADC SIGNAL
The ADC high reference voltage includes internal VDD/4V/3V/2V and external reference voltage source from
P2.0/AVREFH pin controlled by AVREFHSEL bit. If AVREFHSEL=0, ADC reference voltage is from internal voltage
source; if EVHENB=1, ADC reference voltage is from external voltage source (P2.0/AVREFH).
ADC reference voltage range limitation is
“(ADC high reference voltage – low reference voltage)
≧
2V”
. ADC low
reference voltage is Vss = 0V. So
ADC high reference voltage range is 2V~Vdd
. The range is ADC external high
reference voltage range.
ADC Internal Low Reference Voltage = 0V
ADC Internal High Reference Voltage = VDD/4.5V/3V/2V (AVREFHSEL = 0)
ADC External High Reference Voltage = 2V~VDD
(AVREFHSEL = 1)
ADC sampled input signal voltage must be from ADC low reference voltage to ADC high reference. If the ADC input
signal voltage is over the range, the ADC converting result is error (full scale or zero).
ADC Low Reference Voltage (VSS)
≦
ADC Sampled Input Voltage
≦
ADC High Reference Voltage
7.3.2 ADC PROGRAM
The first step of ADC execution is to setup ADC configuration. The ADC program setup sequence and notices are as
following.
Step 1:
Enable ADC. ADENB is ADC control bit to control. ADENB = 1 is to enable ADC. ADENB = 0 is to disable
ADC.
When ADENB is enabled, the system must be delay 100us to be the ADC warm-up time by program,
and then set ADS to do ADC converting. The 100us delay time is necessary after ADENB setting (not ADS
setting), or the ADC converting result would be error.
Normally, the ADENB is set one time when the system
under normal run condition, and do the delay time only one time.
Step 2:
If the ADC high reference voltage is from external voltage source, set the AVREFHSEL = 1. The ADC
external high reference voltage inputs from P2.0 pin.
It is necessary to set P2.0 as input mode without pull-up
resistor.
Step 3:
Select the ADC input pin by CHS[3:0], and enable ADC global input.
When one AIN pin is selected to be
analog signal input pin, it is necessary to setup the pin as input mode and disable the pull-up resistor by
program.
Step 4:
Start to execute ADC conversion by setting ADS = 1.
Step 5:
Wait the end of ADC converting through checking EOC = 1 or ADCIF = 1. If ADC interrupt function is
enabled, the program executes ADC interrupt service when ADC interrupt occurrence.
ADS is cleared when the
end of ADC converting automatically. EOC bit indicates ADC processing status immediately and is cleared
when ADS = 1. Users needn’t to clear it by program.
7.3.3 ADC PIN CONFIGURATION
ADC input pins are shared with Port 2 digital I/O pins. ADC channel selection is through CHS[4:0] bits in
ADC_ADM
register. CHS[4:0] value points to the ADC input channel directly, CHS[4:0]=0000b selects AIN0, CHS[4:0]=0001b
selects AIN1, etc.
Connect an analog signal to COMS digital input pin, especially, the analog signal level is about 1/2 VDD will cause extra
current leakage. In the power down mode, the above leakage current will be a big problem. Unfortunately, if users
connect more than one analog input signal to Port 2 will encounter above current leakage situation.
The P2.0/AIN0 can be ADC external high reference voltage input pin when AVREFHSEL =1. In the condition, P2.0