EM77950
BB Controller
ADIE (Bit 6): ADC interrupt enable.
ADRUN (Bit 7): ADC starts to RUN
0 = reset on completion of the conversion; this bit cannot be reset by
software.
1 = an A/D conversion is started; this bit can be set by software.
10.2 Programming Steps/Considerations
Follow these steps to obtain data from the ADC:
1.
2.
Set ADC function power on (PRIE.ADE).
Write to the three bits (IMS2:IMS0) on the ADCCR register to define the
characteristics of PD and PF: Digital I/O, analog channels, and voltage reference
pin;
3.
4.
Write to the ADCAIS register to configure ADC module:
i
Select ADC input channel (AIPS3: AIPS0)
ii Define ADC conversion clock rate (CKR2: CKR1: CKR0)
Set ADC interrupt enable (ADCCR.ADIE). Include the “ENI” instruction, if the
interrupt function is employed.
5.
6.
7.
8.
9.
Set the ADRUN bit to 1 to begin sampling.
Wait for either the interrupt flag to be set or the ADC interrupt to occur.
Read the conversion data register ADDATA.
Clear the interrupt flag bit (INTF.ADIF).
For next conversion, go to Step 2 or Step 3 as required. At least 2Tct is required
before the next acquisition starts.
NOTE
To obtain an accurate value, it is necessary to avoid any data transition on the I/O
pins during AD conversion.
74 •
Product Specification (V1.0) 10.09.2007
(This specification is subject to change without further notice)