R01UH0823EJ0100 Rev.1.00
Page 1606 of 1823
Jul 31, 2019
RX23W Group
44. 12-Bit A/D Converter (S12ADE)
44.3.5.3
Using Data Buffers
This S12ADE is provided with a ring buffer function consisting of 16 A/D data buffers. This function sequentially stores
A/D conversion results other than self-diagnosis result (including addition/average results) in data buffers (ADBUFn, n =
0 to 15) when the compare function is used.
Each conversion result is stored at the timing when the A/D conversion result is stored in the data register, and most
recent 16 conversion result data are retained.
The following shows the schematic of data buffers, pointer, and overflow flag operations. When the BUFEN bit is set
to1, the A/D conversion result is transferred at each end of A/D conversion. The pointer indicates the number of data
buffer to which the next transferred data is to be written. When data is written to up to buffer 15, the pointer is reset to
0000b and the overflow flag is set to 1. Subsequently transferred data overwrites the previously written data. The pointer
and overflow flag are reset to the initial value by writing 00h to the ADBUFPTR register.
Figure 44.21
Schematic of Data Buffers, Pointer, and Overflow Flag Operations
BUF_0
BUF_1
BUF_2
BUF_14
BUF_15
BUFPTR
After reset
= 0000b
= 000h
= 000h
= 000h
= 000h
= 000h
After 1-time conversion
= 0001b
= aaah
= 000h
= 000h
= 000h
= 000h
PTROVF = 0
After 2-time conversion
= 0010b
= aaah
= bbbh
= 000h
= 000h
= 000h
After 15-time conversion
= 1111b
= aaah
= bbbh
= ccch
= adch
= 000h
After 16-time conversion
= 0000b
= aaah
= bbbh
= ccch
= adch
= defh
After 17-time conversion
= 0001b
= 111h
= bbbh
= ccch
= adch
= defh
Data is overwritten
Write ADBUFPTR = 00h
= 0000b
= 111h
= bbbh
= ccch
= adch
= defh
:
:
Pointer continues operating
BUF_0
BUF_1
BUF_2
BUF_14
BUF_15
BUFPTR
PTROVF = 0
:
:
BUF_0
BUF_1
BUF_2
BUF_14
BUF_15
BUFPTR
PTROVF = 0
:
:
BUF_0
BUF_1
BUF_2
BUF_14
BUF_15
BUFPTR
PTROVF = 0
:
:
BUF_0
BUF_1
BUF_2
BUF_14
BUF_15
BUFPTR
PTROVF = 1
:
:
BUF_0
BUF_1
BUF_2
BUF_14
BUF_15
BUFPTR
PTROVF = 1
:
:
BUF_0
BUF_1
BUF_2
BUF_14
BUF_15
BUFPTR
PTROVF = 0
:
: