T89C5115 ATMEL Corporation, T89C5115 Datasheet - Page 81

no-image

T89C5115

Manufacturer Part Number
T89C5115
Description
Low Pin Count 8-bit MCU with A/D Converter and 16-Kbytes of Flash Memory
Manufacturer
ATMEL Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
T89C5115-RATIM
Manufacturer:
TI
Quantity:
1 474
Part Number:
T89C5115-RATIM
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
T89C5115-SISIM
Manufacturer:
Atmel
Quantity:
10 000
IT ADC Management
Routine Examples
4128A–8051–04/02
An interrupt end-of-conversion will occurs when the bit ADEOC is activated and the bit
EADC is set. For re-arming the interrupt the bit ADEOC must be cleared by software.
Figure 39. ADC interrupt structure
1. Configure P1.2 and P1.3 in ADC channels
2. Start a standard conversion
3. Start a precision conversion (need interrupt ADC)
Note:
// configure channel P1.2 and P1.3 for ADC
// Enable the ADC
// The variable "channel" contains the channel to convert
// The variable "value_converted" is an unsigned int
// Clear the field SCH[2:0]
// Select channel
// Start conversion in standard mode
// Wait flag End of conversion
// Clear the End of conversion flag
// read the value
// The variable "channel" contains the channel to convert
// Enable ADC
// clear the field SCH[2:0]
// Select the channel
// Start conversion in precision mode
ADCF = 0Ch
ADCON = 20h
ADCON &= F8h
ADCON |= channel
ADCON |= 08h
while((ADCON & 01h)!= 01h)
ADCON &= EFh
value_converted = (ADDH << 2)+(ADDL)
EADC = 1
ADCON &= F8h
ADCON |= channel
ADCON |= 48h
to enable the ADC interrupt:
EA = 1
ADEOC
ADCON.2
EADC
IEN1.1
T89C5115
ADCI
81

Related parts for T89C5115