★ PROGRAMMER'S GUIDE ★ Timer library
Uint32 time_flg; / * Interrupt flag * /
...
void vblankOut () / * V-BLANK OUT execution function * /
{
Uint32 intr_count = 0; / * Interrupt counter * /
...
TIM_T1_DISABLE (); / * Timer 1 interrupt disabled * /
TIM_T1_SET_MODE (TIM_MD_LINE); / * Specify interrupt generation 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 enabled * /
...
for (intr_count <ALL_LINE_NUM) {
/ * Until the interrupt of all lines is 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 format macro | number |
|---|---|---|
Counter value-> microsecond conversion | TIM_FRT_CNT_TO_MCR | 15 |
Microsecond-> Counter value conversion | TIM_FRT_MCR_TO_CNT | 16 |
function | Function format macro | number |
|---|---|---|
FRT initialization | TIM_FRT_INIT | 8 |
function | Function format macro | number |
|---|---|---|
Counter value setting (16 bits) | TIM_FRT_SET_16 | 9 |
Counter value acquisition (16 bits) | TIM_FRT_GET_16 | Ten |
void sysInit ()
{
TIM_FRT_INIT (8); / * Set frequency division to 8 * /
...
} void writeFrameBuff ()
{
Uint16 count; / * Acquisition count value storage area * /
float micro_sec; / * Microsecond storage area * /
TIM_FRT_SET_16 (0); / * Set the count value to 0 * /
WriteAllVram (); / * Execution of 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