How to activate a timer on sdk?

时间:2015-05-12 23:09:11

标签: fpga xilinx-edk

I need to use a timer on my C program on SDK. I'm using Atlys Spartan-6 LX45 and I try to use this code:

cookie.setPath("/")

When I debug the program it hangs and I don't get any result. How to use a timer?

1 个答案:

答案 0 :(得分:0)

您需要在使用之前初始化计时器。

XTmrCtr TmrCtrInstance; /* It's not a pointer, so no ptr suffix... */

if (XTmrCtr_Initialize(&TmrCtrInstance, XPAR_AXI_TIMER_0_DEVICE_ID) != XST_SUCCESS) { /* Your ID may be different */
    /* Stop execution */
    return;
}

time1 = XTmrCtr_GetValue(&TmrCtrInstance, 0);
...