Article How do I configure the GPIO for Timer Input Capture?

To use a Timer in input capture mode, configure the Timer's input pin using the GPIO registers.

Set the Timer's port pin to a Normal Input (MXC_E_GPIO_IN_MODE_NORMAL).

Set the Timer's port pin output mode to Normal Tristate (MXC_E_GPIO_OUT_MODE_NORMAL_TRISTATE).

Next enable the Timer function for the port pin by setting the Function Select to Timer Capture mode.

CMSIS code snippet follows:

    /* Set up Timer 1 for port 2, pin 7, Timer Input Capture Mode */
    GPIO_SetInMode(PORT2, PIN7, MXC_E_GPIO_IN_MODE_NORMAL); /* Set P2.7 to Normal Input mode */
    GPIO_SetOutMode(PORT2, PIN7, MXC_E_GPIO_OUT_MODE_NORMAL_TRISTATE); /* Set P2.7 to Normal Tristate Output mode */
    GPIO_SetFuncSel(PORT2, PIN7, PIN7_FUNC_SEL_TMR1); /* Set up P2.7 as Timer 1 Input Capture */
    /* Note: PORT2 is defined as 2, PIN7 is defined as 7 and PIN7_FUNC_SEL_TMR1 is defined as 6 in this code example */
    /* Configure Timer 1 for input capture */
    ....

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.