本帖最后由 缥缈九哥 于 2012-9-14 12:03 编辑
M0516LAN中,从P4.0中送入一个50HZ方波信号,测量周期。
初始化如下:
SYSCLK->CLKSEL1.PWM01_S = 0x00;
PWMA->CSR.CSR0 = 0x04;
PWMA->;PPR.CP01 = 12;
PWMA->CCR0.INV0 = 0;
PWMA->CCR0.CRL_IE0 = 1;
PWMA->CCR0.CAPCH0EN = 1;
PWMA->CNR0 = 0xffff;
PWMA->CAPENR = 0x01;
SYS->;P4_MFP.SCHMITT = 0X01;
SYS->;P4_MFP.ALT0_PWM0 = 0X00;
SYS->;P4_MFP.MFP0_PWM0 = 0X01;
PWMA->;PCR.CH0EN = 1;
中断一直进不去,P0.0上没有反应:
void PWMA_IRQHandler(void)
{
if (giv_temp0==0)
{
giv_temp0 = 1;
DrvGPIO_SetBit(E_PORT0,E_PIN0);
}
else
{
giv_temp0 = 0;
DrvGPIO_ClrBit(E_PORT0,E_PIN0);
}
}
谁能帮忙看看,是不是哪里设置错了,谢谢! |