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 interrupt generation every line */
TIM_T1_SET_DATA(10);
/* Specify the interrupt generation timing at the 10th bit of the line */
time_flg = OFF; /* Turn off 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 line */
intr_count ++; /* Line count */
}
}
void timeIntr() /* Interrupt execution function */
{
time_flg = ON; /* Turn on interrupt flag */
}
function | function-like macro | number |
|---|---|---|
Counter value -> microsecond conversion | TIM_FRT_CNT_TO_MCR | 15 |
microsecond -> Counter value conversion | TIM_FRT_MCR_TO_CNT | 16 |
function | function-like macro | number |
|---|---|---|
FRT initialization | TIM_FRT_INIT | 8 |
function | function-like macro | number |
|---|---|---|
Counter value setting (16 bits) | TIM_FRT_SET_16 | 9 |
Obtain counter value (16 bit) | TIM_FRT_GET_16 | 10 |
void sysInit()
{
TIM_FRT_INIT(8); /* Set divider to 8 */
...
} void writeFrameBuff()
{
Uint16 count; /* Obtained count value storage area */
float micro_sec; /* Microsecond storage area */
TIM_FRT_SET_16(0); /* Set the count value to 0 */
WriteAllVram(); /* Execute the process you want to measure */
count = TIM_Frt_Get_16(); /* Get the count value */
/* count indicates the execution time of WriteAllVram() */
micro_sec = TIM_FRT_CNT_TO_MCR(count);/* Convert counter value to microseconds */
printDisplay(micro_sec); /* Display the elapsed time on the screen */
}
★ PROGRAMMER'S GUIDE ★ Timer library