cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
crono123
Visitor
Visitor
7,489 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
brianhill
Xilinx Employee
Xilinx Employee
8,950 Views
Registered: ‎04-23-2008

Crono,

 

Yes.

 

-Brian

View solution in original post

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

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
crono123
Visitor
Visitor
7,481 Views
Registered: ‎08-03-2009

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

 

-crono

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

Crono,

 

Yes.

 

-Brian

View solution in original post

0 Kudos