cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pavithra
Adventurer
Adventurer
3,000 Views
Registered: ‎10-25-2009

how to read data from the fifo

hi...

can any one tell code how to read the datas stored in fifo and display in rs232 terminal

 

i m geeting output 0 for my  code. i tagged my c code

 

thanku in advance 

0 Kudos
Reply
2 Replies
tushar_dongre
Xilinx Employee
Xilinx Employee
2,985 Views
Registered: ‎02-25-2009

You need to reset write and read FIFO, then read the FIFO and write to the RS232.

 

For example:

 

Xuint32 *baseaddr_p = (Xuint32 *)XPAR_FFT_0_BASEADDR;

 

main()

{

 

Xuint32 baseaddr;

Xuint32 temp;

 

// Reset read and write packet FIFOs to initial state

FFT_mResetWriteFIFO(baseaddr);

FFT_mResetReadFIFO(baseaddr);

 

// pop data out from read packet FIFO

 

for(i = 0; i < 4; i++){

temp = FFT_mReadFromFIFO(baseaddr,0);

xil_printf("Read: 0x%08x \n\r", temp);

}

 

 

 

0 Kudos
Reply
pavithra
Adventurer
Adventurer
2,969 Views
Registered: ‎10-25-2009

 thank u

i wrote like that only code but i m not getting proper output.

i m attached  my user_logic file .

 

 

#include "xparameters.h"
#include "fft.h"
#include "xbasic_types.h"
#include "xstatus.h"
#include "xio.h"

unsigned int *baseaddr_p =(unsigned int *)XPAR_FFT_0_BASEADDR;

int main()
{
  Xuint32 baseaddr;
  Xuint32 occupancy;
  Xuint32  output;
  XStatus status;
  int i;
 
 xil_printf("%c[2J",27);
 
  baseaddr = (Xuint32)baseaddr_p;
 
 FFT_mResetReadFIFO(baseaddr);
  
  status=FFT_mReadFIFOEmpty(baseaddr);
 
 if ( status = XTRUE )
  {
  xil_printf("FIFO is Empty\n");
  }
  
 occupancy=FFT_mReadFIFOOccupancy(baseaddr);
 xil_printf("Occupancy of the Read fifo:-----%d\n\r",occupancy);

    for (i=0 ; i<25 ;i++)
  {
   output= FFT_mReadFromFIFO(baseaddr,0);
            xil_printf("Read:  0x%08x \n\r",output); 
     
  }
 return 0; 
}

 

 

 

thank u in advance

0 Kudos
Reply