这个是arm Cortex-M0新唐m052外部中断
#include "register.h"
int main(void)
{
rREGWRPROT = 0x59; //解锁
rREGWRPROT = 0x16;
rREGWRPROT = 0x88;
rPWRCON |= (0x1<<0); //使能晶振
while( (rCLKSTATUS & (0x1<<0)) == 0); //等待时钟稳定
rP1_PMD = 0x5555;
rP1_DOUT = 0xff;
rP3_IMD &= ~(0x1<<3); //下降沿触发中断
rDBNCECON = (0x1<<5) | (0xf); //采样周期为128*256个时钟
rP3_DBEN |= (0x1<<3);//防反弹使能
rP3_IEN |= (0x1<<3); //使能下降沿中断
rNVIC_ISER |= (0x1<<3);
rREGWRPROT = 0x0; //上锁
while(1)
{
}
}
void EINT1_IRQHandler(void)
{
rP1_DOUT ^= 0xff;
rP3_ISRC = rP3_ISRC;
}
|