4. Update SC3 to select whether conversions will be continuous or completed only once
(ADCO) and whether to perform hardware averaging.
5. Update SC1:SC1n registers to enable or disable conversion complete interrupts.
Also, select the input channel which can be used to perform conversions.
37.6.2 Pseudo-code example
In this example, the ADC module is set up with interrupts enabled to perform a single 10-
bit conversion at low-power with a long sample time on input channel 1, where ADCK is
derived from the bus clock divided by 1.
ADC_CFG1 = ADC_CFG1_ADLPC_MASK |
ADC_CFG1_ADLSMP_MASK | ADC_CFG1_MODE(0x10);
// Bit 7 ADLPC 1 Configures for low power, lowers maximum clock speed.
// Bit 6:5 ADIV 00 Sets the ADCK to the input clock ÷ 1.
// Bit 4 ADLSMP 1 Configures for long sample time.
// Bit 3:2 MODE 10 Selects the single-ended 10-bit conversion.
// Bit 1:0 ADICLK 00 Selects the bus clock.
ADC_SC2 = 0x00;
// Bit 7 ADACT 0 Flag indicates if a conversion is in progress.
// Bit 6 ADTRG 0 Software trigger selected.
// Bit 5 ACFE 0 Compare function disabled.
// Bit 4 ACFGT 0 Not used in this example.
// Bit 3 ACREN 0 Compare range disabled.
// Bit 2 DMAEN 0 DMA request disabled.
// Bit 1:0 REFSEL 00 Selects default voltage reference pin pair (External pins V
REFH
and
V
REFL
).
ADC_SC1A = ADC_SC1_AIEN_MASK | ADC_SC1_ADCH(0x1);
// Bit 7 COCO 0 Read-only flag which is set when a conversion completes.
// Bit 6 AIEN 1 Conversion complete interrupt enabled.
// Bit 4:0 ADCH 00001 Input channel 1 selected as ADC input channel.
ADC_RA = 0xxx
// Holds results of conversion.
ADC_CV = 0xxx
// Holds compare value when compare function enabled.
Usage Guide
Kinetis KE1xF Sub-Family Reference Manual, Rev. 4, 06/2019
860
NXP Semiconductors
Содержание KE1xF Series
Страница 2: ...Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 2 NXP Semiconductors...
Страница 60: ...SysTick Clock Configuration Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 60 NXP Semiconductors...
Страница 114: ...Initialization application information Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 114 NXP Semiconductors...
Страница 138: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 138 NXP Semiconductors...
Страница 320: ...Private Peripheral Bus PPB memory map Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 320 NXP Semiconductors...
Страница 342: ...Functional Description Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 342 NXP Semiconductors...
Страница 360: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 360 NXP Semiconductors...
Страница 490: ...Interrupts Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 490 NXP Semiconductors...
Страница 550: ...Memory map and register definition Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 550 NXP Semiconductors...
Страница 562: ...Boot Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 562 NXP Semiconductors...
Страница 662: ...Power supply supervisor Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 662 NXP Semiconductors...
Страница 694: ...On chip resource access control mechanism Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 694 NXP Semiconductors...
Страница 706: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 706 NXP Semiconductors...
Страница 724: ...Application Information Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 724 NXP Semiconductors...
Страница 736: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 736 NXP Semiconductors...
Страница 750: ...Debug and Security Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 750 NXP Semiconductors...
Страница 798: ...Functional description Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 798 NXP Semiconductors...
Страница 808: ...Functional description Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 808 NXP Semiconductors...
Страница 866: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 866 NXP Semiconductors...
Страница 1164: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 1164 NXP Semiconductors...
Страница 1178: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 1178 NXP Semiconductors...
Страница 1380: ...Usage Guide Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 1380 NXP Semiconductors...
Страница 1472: ...Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 1472 NXP Semiconductors...
Страница 1482: ...Kinetis KE1xF Sub Family Reference Manual Rev 4 06 2019 1482 NXP Semiconductors...