cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
7,024 Views
Registered: ‎08-03-2009

XPS_Timer

Jump to solution

Hello!

 

  Could someone tell me what units are used when sampling an xps timer in a disign using the following code snippet?

 

Thanks:

 

 

 // Xuint32 Variables

   XTmrCtr xps_timer_0;
    XTmrCtr* timer_0 = &xps_timer_0;
    XStatus Status;
   Xuint32 BeginTime;
    Xuint32 EndTime;
    Xuint32 Calibration;
    Xuint32 TimeRun;

 

 ...

 

  BeginTime = XTmrCtr_GetValue(timer_0, XPAR_XPS_TIMER_0_DEVICE_ID);
     EndTime = XTmrCtr_GetValue(timer_0, XPAR_XPS_TIMER_0_DEVICE_ID);
     Calibration = EndTime - BeginTime;

 

...

 

 

 BeginTime = XTmrCtr_GetValue(&xps_timer_0, XPAR_XPS_TIMER_0_DEVICE_ID);
    SOME_FUNCTION_CALL(parameters);
 EndTime = XTmrCtr_GetValue(&xps_timer_0, XPAR_XPS_TIMER_0_DEVICE_ID);

 

TimeRun = (EndTime - BeginTime - Calibration);

xil_printf("Time to run SOME_FUNCTION_CALL: %d\r\n", TimeRun);

 

Crono

   

 

 

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
8,485 Views
Registered: ‎04-23-2008

Re: XPS_Timer

Jump to solution

Crono,

 

Yes.

 

-Brian

View solution in original post

0 Kudos
3 Replies
Highlighted
Xilinx Employee
Xilinx Employee
7,020 Views
Registered: ‎04-23-2008

Re: XPS_Timer

Jump to solution

The units are whatever the frequency of the clock that's fed to the xps timer periperial.  If, for example, this is 100MHz, then each integer value in the count is 10ns.

 

-Brian

0 Kudos
Highlighted
Visitor
Visitor
7,016 Views
Registered: ‎08-03-2009

Re: XPS_Timer

Jump to solution

So, what you are saying is: every integer value represents one clock cycle?

 

-crono

0 Kudos
Xilinx Employee
Xilinx Employee
8,486 Views
Registered: ‎04-23-2008

Re: XPS_Timer

Jump to solution

Crono,

 

Yes.

 

-Brian

View solution in original post

0 Kudos