LoginSignup
0
0

More than 5 years have passed since last update.

Zybo > Chronicles blog 20 > TTC > match mode > XTTCPS_OPTION_MATCH_MODE / XTtcPs_SetMatchValue() / XTtcPs_GetInterval() / XTtcPs_EnableInterrupts() / ISRの例

Last updated at Posted at 2016-05-22

MicroZed Chronicles リスト http://adiuvoengineering.com/?page_id=285
@ Adam Taylor blog
https://forums.xilinx.com/t5/Xcell-Daily-Blog/Introduction-to-the-Zynq-Triple-Timer-Counter-Part-Four-Adam/ba-p/416243

We will look at using the match registers to issue interrupts for different counter values.

...

We can OR the XTTCPS_OPTION_MATCH_MODE as defined within the xttcps.h file to enable the match mode along with the disabled waveform and interval mode.

...

次にトリガーを設定

XTtcPs_SetMatchValue(&Timer, 0, (interval/3));

内部カウンター(interval)はXTtcPs_GetInterval()にて取得。

次にmatch interruptを設定

XTtcPs_EnableInterrupts(TtcPsInt, XTTCPS_IXR_MATCH_0_MASK);

ISR(TickHandler()としている)では各interruptに対応する処理を書く

static void TickHandler(void *CallBackRef)
{
    u32 StatusEvent;

    StatusEvent = XTtcPs_GetInterruptStatus((XTtcPs *)CallBackRef);
    XTtcPs_ClearInterruptStatus((XTtcPs *)CallBackRef, StatusEvent);

    if (0 != (XTTCPS_IXR_INTERVAL_MASK & StatusEvent)) {
        printf("interval interrupt event\n\r");
        //XTtcPs_SetMatchValue(Timer, 0, *MatchReg);
        }
    if (0 != (XTTCPS_IXR_MATCH_0_MASK & StatusEvent)) {
            printf("match interrupt event\n\r");
            //XTtcPs_SetMatchValue(Timer, 0, *MatchReg);
            }

}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0