新闻  |   论坛  |   博客  |   在线研讨会
R8C\2K 2L的定时A定时模式初始化设置
renesasrulz | 2009-12-26 12:09:19    阅读:1194   发布文章

原文:R8C\2K 2L的定时A定时模式初始化设置

/************************************************************************
*函数原型: Timer_RA_Init
*功能 : 初始化RA
************************************************************************/
void Timer_RA_Init(void)
{
 tstart_tracr = 0;     /* Stop Timer RA operation */
 while(tcstf_tracr != 0);
 traic = 0x00;      /* Disable Timer RA Interrupt */
 tstop_tracr = 1;     /* The TRAPRE and TRA registers are initialized */
/*****************************************************/
 /* Period between underflows : 40MHz  * 4 * 100 * 50 = 1ms */
 trapre = 100-1;      /* Set (100 - 1) in TRAPRE register */
 tra = 50-1;       /* Set (100 - 1) in TRA register */
/*****************************************************/
 tedgsel_traioc = 0;     /* Set to "0" in timer mode */
 topcr_traioc = 0;     /* Set to "0" in timer mode */
 //toena_traioc = 0;     /* Set to "0" in timer mode */
 tipf0_traioc = 0;     /* Set to "0" in timer mode */
 tipf1_traioc = 0;     /* Set to "0" in timer mode */
 tmod0_tramr = 0;     /* Set to "000" in timer mode */
 tmod1_tramr = 0;
 tmod2_tramr = 0;
 tck0_tramr = 0;              /* Select "fOCO" in Count Source */
 tck1_tramr = 1;
 tck2_tramr = 0;
 tckcut_tramr = 0;     /* Provides count source */
 traic=2;/*中断级别*/
 tstart_tracr = 1;     /* Start Timer RA operation */
 while(tcstf_tracr != 1);
}

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
来自瑞萨单片机论坛(www.renesas-mcu.com)的经典文章。仅供大家参考,版权归作者所有。
推荐文章
最近访客