下面是SH67P847的PDF说明: Port Interrupt The PORTA.3 are used as external port interrupt sources. Only the voltage transition from VDD to GND applying to the digital input port can generate a port interrupt. The analog input cannot generate any interrupt request. Port Interrupts (including other external interrupt sources) can be used to wake up the CPU from the HALT or the STOP mode.
但我在测试程序时会发现上升沿同样能触发此中断,而且并不是每次都能触发.不知为何.应如何配置??? 我的程序就是一个按键.上电后程序进STOP,按键按下时通过此中断唤醒程序工作,再次按下程序再进STOP.相应程序见下面:
同样的问题在SH69P20这颗芯片中,使用PA0,PA3中断时,设置为下降沿触发,上升沿同样能触发!
//---------------中断初始化-------------------- LDI IRQ,0000B LDI IE,0001B NOP STOP NOP MAIN: NOP LDA STATE,0 BNZ RUN_PRG LDA HOLD_CNT,0 BNZ RUN_PRG LDI HOLD_CNT,HOLD_CNT_VAL ANDIM PORTA,1011B LDI IE,0001B STOP NOP //------------------------------------------------------- NOP NOP RUN_PRG: LDI IE,0100B NOP HALT NOP NOP JMP MAIN
;============================================================ ;PORT中断服务子程序 PINT_SVR: NOP //---------------IO初始化---------------------- LDI PORTA,0000B LDI PACR,0100B LDI PPACR,0100B LDI PORTB,0000B LDI PBCR,0000B LDI PPBCR,0000B //---------------AD初始化---------------------- LDI ADCON,0000B //---------------PWM初始化--------------------- LDI PWMCON,0000B //---------------TIMER0 初始化----------------- LDI TL0,03H LDI TH0,08H LDI TM0,0111B //---------------中断初始化-------------------- LDI IRQ,0000B LDI IE,0001B //---------------寄存器初始化----------------- LDI K1ST,00H LDI K2CD,00H LDI SUB_CNT_L,SUB_CNT_L_VAL LDI SUB_CNT_H,SUB_CNT_H_VAL LDI MY_CNT,MY_CNT_VAL LDI HOLD_CNT,HOLD_CNT_VAL LDI OUT_L_CNT,OUT_L_CNT_VAL LDI OUT_H_CNT,OUT_H_CNT_VAL LDI STATE,00H LDI IE,0100B LDI IRQ,00H RTNI NOP
|