![](/images/new-backgrounds/1300294/30029463x1.webp)
FIFO Operation
After each A/D conversion is completed, the A/D data is stored in the FIFO. The data is inserted in LSB / MSB sequence. The FIFO holds 4096 bytes, or 2048 samples. It has several flags that indicate its state:
EF | Empty flag | 1 when the FIFO is empty and 0 otherwise. |
8F | 1/8 full flag | 1 when the FIFO has 256 or more samples, 0 otherwise |
HF | Half full | 1 when the FIFO has 2048 or more bytes of data (1024 or more |
|
| samples), 0 otherwise |
FF | Full flag | 1 when the FIFO has 4096 bytes (2048 samples), 0 otherwise |
OVF | Overflow flag | 1 when the FIFO is full and the board attempts to store a new A/D |
|
| sample in the FIFO. This indicates an error condition. The new A/D |
|
| data will not be stored in the FIFO and will be lost. The current |
|
| contents of the FIFO will be preserved. |
If OVF is set, the only way to clear it is to reset the FIFO by writing a 1 to the FIFORST bit in register 8. Generally the data would be read out before resetting the FIFO.
Interrupt Operation
If AINTE is set, the board will generate an interrupt when the selected condition occurs, as determined by the control bits FIFOEN, FIFOTH, and SCANEN. The table below describes the timing of interrupts and the expected performance of the application software’s interrupt routine (including Diamond Systems’ Universal Driver software). Note that in all cases, A/D data is stored in and read from the FIFO, regardless of the FIFOEN setting. FIFOEN only controls whether the FIFO flags are used to drive interrupt requests.
FIFOEN | FIFOTH | SCANEN | Interrupt Operation |
|
0 | 0 | 0 | Interrupt occurs at the end of each individual A/D | |
|
|
| conversion. Interrupt routine reads one A/D sample from | |
|
|
| the board. |
|
0 | 0 | 1 | Interrupt occurs at the end of each A/D scan. Interrupt | |
|
|
| routine reads one complete scan from the board. |
|
0 | 1 | 0 | Same as case 0 0 0 above. FIFOTH is ignored when | |
|
|
| FIFOEN = 0. |
|
0 | 1 | 1 | Same as case 0 0 1 above. FIFOTH is ignored when | |
|
|
| FIFOEN = 0. |
|
1 | 0 | 0 | Interrupt occurs when 1024 A/D conversions are | |
|
|
| complete. Interrupt routine reads 1024 samples from the | |
|
|
| FIFO. |
|
1 | 0 | 1 | Interrupt occurs when 1024 A/D conversions are | |
|
|
| complete AND the current A/D scan is complete (total | |
|
|
| no. of conversions may be greater than 1024). Interrupt | |
|
|
| routine reads enough scans from the A/D FIFO to equal | |
|
|
| or exceed 1024 samples. |
|
1 | 1 | 0 | Interrupt occurs when 256 A/D conversions are | |
|
|
| complete. Interrupt routine reads 256 samples from the | |
|
|
| FIFO. |
|
1 | 1 | 1 | Interrupt occurs when 256 A/D conversions are | |
|
|
| complete AND the current A/D scan is complete (total | |
|
|
| no. of conversions may be greater than 256). Interrupt | |
|
|
| routine reads enough scans from the A/D FIFO to equal | |
|
|
| or exceed 256 samples. |
|
|
|
| Page 32 |