Calling sequence
The following shows a calling sequence that causes a timer 1 interrupt when drawing on the 10th bit of each line using timer 1 and inverts that line for odd lines.
Uint32 time_flg; / * Interrupt flag * /
...
void vblankOut () / * V-BLANK OUT execution function * /
{
Uint32 intr_count = 0; / * Interrupt counter * /
...
TIM_T1_DISABLE (); / * Disable timer 1 interrupt * /
TIM_T1_SET_MODE (TIM_MD_LINE); / * Specify the occurrence of interrupt for each line * /
TIM_T1_SET_DATA(10);
/ * Specify the interrupt generation timing at the 10th bit of the line * /
time_flg = OFF; / * Turn off the interrupt flag * /
TIM_T1_ENABLE (); / * Timer 1 interrupt enable * /
...
for(intr_count < ALL_LINE_NUM){
/ * Until all line interrupts are executed * /
changeLine (intr_count); / * Invert odd number line * /
intr_count ++; / * Line count * /
}
}
void timeIntr () / * Interrupt execution function * /
{
time_flg = ON; / * Turn on the interrupt flag * /
}
The count-up cycle of the counter value varies depending on the frequency division specification and graphic mode specification. The count-up cycle can be obtained by the following calculation.
Count-up cycle (s) = Divide x 1 / Clock frequency (Hz)
∙ Use the following function format macro to convert the count value to microseconds and the microseconds to count value.