3,需要指定中断函数(其他中断也是这样)
#pragma interrupt INTKR R_Key_Interrupt
__interrupt void R_Key_Interrupt(void)
{
/* Start user code. Do not edit comment generated here */
// R_InvertLED(); /* Set new timer interval & LED output */
switch(KRF)
{
case 0x10:
keyval =1;
break;
case 0x20:
keyval =2;
break;
case 0x40:
keyval =3;
break;
default:break;
}
KRF = 0; /* clear flag for next key in */
/* End user code. Do not edit comment generated here */
}