Rev.1.01 2007.02.16
RJJ10J1643-0101
16
2.7 A/D Converter Driver
The A/D converter driver sets the A/D converter, controls the A/D converter, clears
settings of the A/D converter, acquires the A/D converter value, acquires the status of the
A/D converter, and clears the status of the A/D converter.
[A/D converter driver usage example (single-shot mode)]
Here, a program example is shown for the A/D converter operating in single-shot mode
under the conditions given below.
CPU
:
R8C
Operating
clock
:
fAD divided by 2
Resolution
:
10 bits
Analog
input
pin
:
AN0 pin
A/D conversion start condition
:
Software trigger
Sample-and-hold
:
Enabled
A program flow and a program example are shown below.
(Program flow)
__CreateADC()
__EnableADC()
__GetADCStatus()
__GetADC()
__ClearADCStatus()
main()
Set the A/D converter in
single-shot mode
Start A/D conversion
A/D interrupt?
Clear the A/D interrupt flag
No
Yes
Read out the A/D conversion value