LPC Demo Board Lessons
3.2.4.2
ADCON0
ADCON0 controls the ADC operation. Bit 0 turns on the ADC module. Bit 1 starts a
conversion and bits <5:2> selects which channel the ADC will operate. VCFG bit< 6>
selects the ADC reference, which may be either V DD or a separate reference voltage
on V REF . ADFM bit <7> selects whether the 10 bits are right or left justified in the 16 bits.
For purposes of this lesson, the ADC must be turned on and pointed to RA0. Choose
the internal voltage reference and 8T OSC conversion clock.
The ADC needs about 5 μ s, after changing channels, to allow the ADC sampling
capacitor to settle. Finally, we ca n start the conversion by setting the GO bit in ADCON0.
The bit also serves as the DONE flag. That is, the ADC will clear the same bit when the
conversion is complete. The answer is then available in ADRESH:ADRESL.
This lesson takes the high order 4 bits of the result and copies them to the display LEDs
attached to PORTC.
See the Analog-to-Digital section in the PIC16F685/687/689/690 Data Sheet
(DS41262) for more details on the ADC module.
REGISTER 3-2:
ADCON0 – A/D CONTROL REGISTER (ADDRESS: 1Fh)
R/W-0
ADFM
R/W-0
VCFG
R/W-0
CHS3
R/W-0
CHS2
R/W-0
CHS1
R/W-0
CHS0
R/W-0
GO/DONE
R/W-0
ADON
bit 7
bit 0
bit 7
bit 6
bit 5-2
bit 1
bit 0
ADFM: A/D Result Formed Select bit
1 = Right justified
0 = Left justified
VCFG: Voltage Reference bit
1 = V REF pin
0 = V DD
CHS<3:0>: Analog Channel Select bits
0000 = Channel 00 (AN0)
0001 = Channel 01 (AN1)
0010 = Channel 02 (AN2)
0011 = Channel 03 (AN3)
0100 = Channel 04 (AN4)
0101 = Channel 05 (AN5)
0110 = Channel 06 (AN6)
0111 = Channel 07 (AN7)
1000 = Channel 08 (AN8)
1001 = Channel 09 (AN9)
1010 = Channel 10 (AN10)
1011 = Channel 11 (AN11)
1100 = CV REF
1101 = VP6
1110 = Reserved. Do not use.
1111 = Reserved. Do not use.
GO/DONE: A/D Conversion Status bit
1 = A/D conversion cycle in progress. Setting this bit starts an A/D conversion cycle.
This bit is automatically cleared by hardware when the A/D conversion has completed.
0 = A/D conversion completed/not in progress
ADON: A/D Enable bit
1 = A/D converter module is enabled
0 = A/D converter is shut off and consumes no operating current
Legend:
R = Readable bit
W = Writable bit
U = Unimplemented bit, read as ‘0’
- n = Value at POR
? 2005 Microchip Technology Inc.
‘1’ = Bit is set
‘0’ = Bit is cleared
x = Bit is unknown
DS51556A-page 21
相关PDF资料
DM164120-3 BOARD DEMO PICKIT2 28-PIN
DM164120-5 BOARD DEMO PICKIT 2 64/80-PIN
DM164123 KIT MANAGEMENT SYSTEM PICDEM
DM180021 KIT STARTER MPLAB FOR PIC18F MCU
DM183022 BOARD DEMO PIC18FXX22 64/80TQFP
DM183032 BOARD EXPLORER PICDEM PIC18
DM240001 BOARD DEMO PIC24/DSPIC33/PIC32
DM240002 BOARD DEV EXPLORER 16 44-PIN
相关代理商/技术参数
DM164120-1 制造商:Microchip Technology Inc 功能描述:DEVELOPMENT TOOLS - PICKIT 2 LOW PIN COU
DM164120-2 功能描述:开发板和工具包 - PIC / DSPIC PICkit 2 44-Pin Count Demo Brd RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM164120-3 功能描述:开发板和工具包 - PIC / DSPIC PICkit 2 Count Demo Board RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM164120-4 功能描述:开发板和工具包 - PIC / DSPIC PICkit 2 1 Dem Board RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM164120-4 制造商:Microchip Technology Inc 功能描述:PICkit 2 18-Pin Demo Board
DM164120-4/16F1827/PG164130 制造商:Microchip Technology Inc 功能描述:PICKIT PIC16F648A DEMO BOARD 制造商:Microchip Technology Inc 功能描述:KIT STARTER 18PIN F1 ENHANCED CORE 制造商:Microchip Technology Inc 功能描述:PICKIT, PIC16F648A, DEMO BOARD 制造商:Microchip Technology Inc 功能描述:PICKIT, PIC16F648A, 18 PIN, DEMO BOARD; Silicon Manufacturer:Microchip; Core Architecture:PIC; Core Sub-Architecture:PIC16; Silicon Core Number:PIC16F; Silicon Family Name:PIC16F18xx; Kit Contents:Demo Board, 2x Bare PCB Boards
DM164120-5 功能描述:开发板和工具包 - PIC / DSPIC PICkit 2 64 demoBoard RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM164123 功能描述:开发板和工具包 - PIC / DSPIC PICDEM Sys Mgmt Board RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压: