PIC12F683-I/P Microchip Technology Inc., PIC12F683-I/P Datasheet - Page 66
![no-image](/images/manufacturer_photos/0/4/440/microchip_technology_inc__sml.jpg)
PIC12F683-I/P
Manufacturer Part Number
PIC12F683-I/P
Description
8 PIN, 3.5 KB FLASH, 128 RAM, 6 I/O
Manufacturer
Microchip Technology Inc.
Datasheet
1.PIC12F683-IP.pdf
(176 pages)
Specifications of PIC12F683-I/P
A/d Inputs
4-Channel, 10-Bit
Comparators
1
Cpu Speed
5 MIPS
Eeprom Memory
256 Bytes
Input Output
5
Memory Type
Flash
Number Of Bits
8
Package Type
8-pin PDIP
Programmable Memory
3.5K Bytes
Ram Size
128 Bytes
Speed
20 MHz
Timers
2-8-bit, 1-16-bit
Voltage, Range
2-5.5 V
Lead Free Status / Rohs Status
RoHS Compliant part
Electrostatic Device
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
Company:
Part Number:
PIC12F683-I/P
Manufacturer:
KINGBRIGHT
Quantity:
12 000
Company:
Part Number:
PIC12F683-I/P
Manufacturer:
Microchip Technology
Quantity:
41 739
Part Number:
PIC12F683-I/P
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
PIC12F683
9.2.4
The ADC module can operate during Sleep. This
requires the ADC clock source to be set to the F
option. When the F
ADC waits one additional instruction before starting the
conversion. This allows the SLEEP instruction to be
executed, which can reduce system noise during the
conversion. If the ADC interrupt is enabled, the device
will wake-up from Sleep when the conversion
completes. If the ADC interrupt is disabled, the ADC
module is turned off after the conversion completes,
although the ADON bit remains set.
When the ADC clock source is something other than
F
sion to be aborted and the ADC module is turned off,
although the ADON bit remains set.
9.2.5
The CCP Special Event Trigger allows periodic ADC
measurements without software intervention. When
this trigger occurs, the GO/DONE bit is set by hardware
and the Timer1 counter resets to zero.
Using the Special Event Trigger does not assure proper
ADC timing. It is the user’s responsibility to ensure that
the ADC timing requirements are met.
See Section 11.0 “Capture/Compare/PWM (CCP)
Module” for more information.
9.2.6
This is an example procedure for using the ADC to
perform an Analog-to-Digital conversion:
1.
2.
3.
4.
5.
6.
7.
DS41211C-page 64
RC
, a SLEEP instruction causes the present conver-
Configure GPIO Port:
• Disable pin output driver (See TRIS register)
• Configure pin as analog
Configure the ADC module:
• Select ADC conversion clock
• Configure voltage reference
• Select ADC input channel
• Select result format
• Turn on ADC module
Configure ADC interrupt (optional):
• Clear ADC interrupt flag
• Enable ADC interrupt
• Enable peripheral interrupt
• Enable global interrupt
Wait the required acquisition time
Start conversion by setting the GO/DONE bit.
Wait for ADC conversion to complete by one of
the following:
• Polling the GO/DONE bit
• Waiting for the ADC interrupt (interrupts
Read ADC Result
enabled)
ADC OPERATION DURING SLEEP
SPECIAL EVENT TRIGGER
A/D CONVERSION PROCEDURE
RC
clock source is selected, the
(1)
(2)
.
RC
8.
EXAMPLE 9-1:
9.2.7
The following registers are used to control the
operation of the ADC.
;This code block configures the ADC
;for polling, Vdd reference, Frc clock
;and GP0 input.
;
;Conversion start & polling for completion
; are included.
;
BANKSEL
BSF
BANKSEL
MOVLW
IORWF
BANKSEL
MOVLW
MOVWF
CALL
BSF
BTFSC
GOTO
BANKSEL
MOVF
MOVWF
BANKSEL
MOVF
MOVWF
Note 1: The global interrupt can be disabled if the
Clear the ADC interrupt flag (required if interrupt
is enabled).
2: See
ADC REGISTER DEFINITIONS
user is attempting to wake-up from Sleep
and resume in-line code execution.
Requirements”.
TRISIO
TRISIO,0
ANSEL
B’01110001’
ANSEL
ADCON0
B’10000001’
ADCON0
SampleTime
ADCON0,GO
ADCON0,GO
$-1
ADRESH
ADRESH,W
RESULTHI
ADRESL
ADRESL,W
RESULTLO
Section 9.3
A/D CONVERSION
© 2006 Microchip Technology Inc.
;
;Set GP0 to input
;
;ADC Frc clock,
; and GP0 as analog
;
;Right justify,
;Vdd Vref, AN0, On
;Acquisiton delay
;Start conversion
;Is conversion done?
;No, test again
;
;Read upper 2 bits
;Store in GPR space
;
;Read lower 8 bits
;Store in GPR space
“A/D
Acquisition