User`s manual
http://www.adtechcn.com   52 
) 8. Hardware buffer 
8.1 adt8840a_reset_fifo( ) 
Name int adt8840a_reset_fifo(int dev_num) 
Definition  Reset buffer. In other words, clear all commands in the buffer. 
Input parameter  dev_num: device number 
Output 
parameter 
None 
Return value  0: execution OK; -1: transmission abnormity; -4: disabled device interface 
Note 
Clearing FIFO (first-in-first-out) is only to clear the data in the buffer, and it won’t stop the 
current motion. 
8.2
adt8840a_read_fifo( ) 
Name  int adt8840a_read_fifo(int dev_num, UINT *value) 
Definition  Get to know buffer’s space used 
Input parameter  None 
Output 
parameter 
dev_num: device number 
value: space used 
The value indicates the status of FIFO, whose definitions are as follows: 
D15: full D14: almost full  D13: empty    D12: almost empty 
Full—FIFO is full and nor more data can be written (normally not used); 
Almost full—The remaining space of FIFO is less than 8 (used for judging whether more 
data can be placed into FIFO); 
Empty—There are no data in FIFO (used for judging whether FIFO is empty); 
Almost empty—The remaining data in FIFO are less than 8 (normally not used). 
The above statuses can be judged by referring to the data saved in FIFO. 
“Byte” is used as the unit of data, with 2048 bytes for maximum. The number of the bytes is 
subject to the interpolation command: 
fifo_inp_move1: 3 byte 
  fifo_inp_move2: 4 byte 
  fifo_inp_move3: 5 byte 
  fifo_inp_move4: 6 byte 
Return value 
0: execution OK; 1: execution failure; -1: transmission abnormity; -2: response overtime; 
-3: abnormal data received; -4: disabled device interface
Note 
Clearing FIFO (first-in-first-out) is only to clear the data in the buffer, and it won’t stop the 
current motion. 
8.3
adt8840a_ fifo_inp_move1() 










