1476 views|0 replies

2015

Posts

0

Resources
The OP
 

C6000 Timer Application (Part 2) [Copy link]

Many main control chips have timers. The use of timers is nothing more than setting a timer, generating an interrupt when the time is up, and then doing something in the interrupt. If you follow this line of thought, it seems that the C6000 timer cannot escape this pattern. Of course, the C6000 timer can also count the number of external events and generate pulse signals. The difference in what the timer does lies in the configuration of the control register, which is configured according to the functional requirements and the tasks that can be completed.
In my project, it is also used as an ordinary timer, and so many functions are not developed. The implementation method is as follows:
First, it needs to be initialized. The initialization process has been introduced in the previous section. The code is as follows:
void TIMER_Init(void)
{
TIMER_Config myTimerConfig;
hTimer = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET);
TIMER_getConfig( hTimer, &myTimerConfig);
myTimerConfig.ctl &= 0xff3f;
myTimerConfig.ctl |= 0x3c0;
myTimerConfig.prd = 0x200;
myTimerConfig.cnt = 0x00000000;
TIMER_config(hTimer, &myTimerConfig);
IRQ_enable(TIMER_getEventId(hTimer));
}

The timing period register prd can modify the timing period as needed.
Then complete the tasks that need to be completed in the timing interrupt interrupt void timer0_isr().
Finally, it should be noted that this interrupt should be added to the interrupt vector list.

In the main control chip, the timer interrupt is an important content, but it does not seem to be so troublesome to implement it in C6000. However, if you want to see the interrupt effect, using printf will have a certain time delay. If you also consider the influence of other factors in the system, the interrupt time is not only affected by prd. The specific situation needs to be reflected in the actual program.

This post is from DSP and ARM Processors
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list