English
Language : 

AN979 Datasheet, PDF (2/14 Pages) STMicroelectronics – DRIVING AN ANALOG KEYBOARD WITH THE ST7 ADC
DRIVING AN ANALOG KEYBOARD WITH THE ST7 ADC
F (PF0, PF4), and Port C (PC0, PC1, PC5, PC7). The I/O port pins used by the ADC must be
configured as floating inputs to avoid conflicts in alternate function mode.
Refer to the Data Sheet for information on configuring the I/O ports.
3.2 ANALOG TO DIGITAL CONVERTER
The ST7 ADC is a 10-bit successive approximation converter, with internal sample and hold-
circuitry.
3.2.1 ADC control
You control the ADC using the ADC Control Status Register (ADCCSR).
EOC SPEED ADON 0 CH3 CH2 CH1 CH0
The EOC bit is the end of conversion bit:
- When this bit is set, the conversion is done and result can be read from the ADC
Data Registers (ADCDRL & ADCDRH).
- When the bit is reset, the conversion is not complete.
The SPEED bit:
- When this bit is set, fADC = fCPU / 2.
- When this bit is reset, fADC = fCPU / 4.
The ADON bit:
- Enable ADC and start conversion when this bit is set.
- Disable ADC and stop conversion when this bit is reset.
CH3-CH0 bits:
- They are used to select which analog input to convert. In the ST72324 there are 12
analog pins.
3.2.2 Characteristics
The conversion time is 15 ADC cycles including a sampling time of 4 ADC cycles.
The ADC is linear and the digital result of the conversion is given by the formula:
1023*Input Voltage
Digital Result =
Reference Voltage
3.2.3 Process
First the analog input pins must be configured as floating inputs (see Section 3.1).
2/14