在线时间0 小时
UID258882
注册时间2009-3-25
NXP金币0
该用户从未签到
新手上路

- 积分
- 14
- 最后登录
- 1970-1-1
|
发表于 2012-9-6 17:43:28
|
显示全部楼层
回复:谁会MPC5604B
我刚做过用eMIOS的MC模式累加外部事件(上升沿或下降沿) 然后用中断读取累加的外部事件数
贴一下代码:
LC_Rate = EMIOS_1.CH[16].CCNTR.B.CCNTR; /* num_per/s */
EMIOS_1.CH[15].CCR.B.MODE = 0x20; /* SAIC model*/
EMIOS_1.CH[15].CCR.B.BSL = 0x0; /* Use internal counter */
EMIOS_1.CH[15].CCR.B.UCPRE=0; /* Set channel prescaler to divide by 1 */
EMIOS_1.CH[15].CCR.B.UCPEN = 1; /* Enable prescaler; uses default divide by 1 */
EMIOS_1.CH[15].CCR.B.FREN = 0; /* Freeze channel counting when in debug mode */
EMIOS_1.CH[15].CCR.B.FEN = 1; /* Enable interrupt signal */
SIU.PCR[102].R = 0x0504; /* eMOIS1_15 to pad*/
EMIOS_1.CH[16].CADR.R = 65536; /* Compare num */
EMIOS_1.CH[16].CCR.B.MODE = 0x44; /* Modulus Counter Buffered (MCB) */
EMIOS_1.CH[16].CCR.B.BSL = 0x0; /* Use internal counter */
EMIOS_1.CH[16].CCR.B.UCPRE=0; /* Set channel prescaler to divide by 1 */
EMIOS_1.CH[16].CCR.B.UCPEN = 1; /* Enable prescaler; uses default divide by 1 */
EMIOS_1.CH[16].CCR.B.FREN = 0; /* Freeze channel counting when in debug mode */
SIU.PCR[103].R = 0x0504; /* eMOIS1_16 to pad*/
EMIOS_1.UCDIS.R = 0x0FFE7FFF;
/* Channel n is Enabled */
/* n = 15,16 */
/* Channel n is Disabled */
/* n = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20,21,22,23,24,25,26,27 */ |
|