Hi Alexis,
The timer counter is 16-bit. TCNT counter is free running from 0x0000 to 0xFFFF. When TCNT counter reach TCx values, the OC channels generate events. For periodic event generation, you can set the interval.
The example generate output frequency. The shorter the interval, the higher the frequency.
See interrupt function, the value of the interval (ECT_PERIOD) is added to the counter value.
//==============================================================================
// Input Capture Interrupt
//==============================================================================
interrupt VectorNumber_Vtim0ch0 void IC0_ISR()
{
PTS_PTS0 = ~PTS_PTS0; //toggle PS0
TIM0TC0 = TIM0TC0+ECT_PERIOD; //the next event update
TIM0TFLG1 = 0x01; //clear the flag
}
In the init function is needed to enable interrupts and set the TCx value: TIM0TC0 = ECT_PERIOD;
Whole example under the name ZVML128-TIM-500usPeriod-CW105.zip and discussion on this theme you can find on this site: https://community.nxp.com/message/860977
I hope it helps you.
Best regards,
Diana