/************************************************************************
*函数原型: 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);
}
文章评论(0条评论)
登录后参与讨论