![Apex Digital STX104 Reference Manual Download Page 75](http://html.mh-extra.com/html/apex-digital/stx104/stx104_reference-manual_2952893075.webp)
It should be further stated that the CPU can still readout data at any rate along with any ADC sampling mode. In fact, the data
fragment buffer will be used in nearly all cases, thus bus wait states become a thing of the past. The only case where I/O bus
wait states will exist are cases where the number of samples read out by the CPU in a CPU-bursting readout (i.e. Insw()
function) exceeds the data fragment buffer size.
FIFO CLEAR or RESET
Note that writing to the Channel Register will reset the FIFO.
See Also
Register Summary ( see page 41)
Example
Below is an example of properly reading the FIFO status. This applies to firmware revisions specifically before 080214H
(although it will still work fine for any revision 080214H or higher).
static
int
stx104_fifo_status_blocks[STX104_BOARDS_COUNT_MAX];
static
unsigned
char
stx104_fifo_status_full[STX104_BOARDS_COUNT_MAX];
static
unsigned
char
stx104_fifo_status_empty[STX104_BOARDS_COUNT_MAX];
/*****************************************************************
/ FIFO STATUS
/ Revision History:
/ 15JAN07 - read FIFO status twice to remove the possibility
/ of reading an incorrect value due to FIFO status
/ changing during a 25nSec interval.
*/
#define
STX104_FIFO_STATUS_READ_COUNT_MAX 1
void
STX104_FIFO_Status(
int
board )
{
union
{
unsigned
int
value;
unsigned
char
octet[2]; }
ff_stat[STX104_FIFO_STATUS_READ_CO1];
unsigned
int
fbr_blocks;
unsigned
int
fbr_blocks_minimum;
unsigned
char
i;
fbr_blocks_minimum = 0x0FFF;
for
( i=0; i<=STX104_FIFO_STATUS_READ_COUNT_MAX; i++ )
{
ff_stat[i].octet[0] = inp( stx104_base_address[board] + STX104_FIFO_DATA_STATUS );
ff_stat[i].octet[1] = inp( stx104_base_address[board] + STX104_FIFO_FLAGS );
fbr_blocks = ff_stat[i].value & 0x0FFF;
if
( fbr_blocks < fbr_blocks_minimum )
{
fbr_blocks_minimum = fbr_blocks;
}
}
stx104_fifo_status_blocks[board] = (
int
) fbr_blocks_minimum;
if
( (ff_stat[STX104_FIFO_STATUS_READ_COUNT_MAX].value & 0x1000) != 0x0000)
stx104_fifo_status_empty[board] =
true
;
else
stx104_fifo_status_empty[board] =
false
;
if
( (ff_stat[STX104_FIFO_STATUS_READ_COUNT_MAX].value & 0x2000) != 0x0000)
11.19 FIFO Status MSB (Offset=10)
STX104 Reference Manual
Copyright © 2009 by
Apex Embedded Systems
. All rights reserved.
Thursday, October 08, 2009
67
11