📄 interrupt_sw.c
字号:
#include "interrupt_sw.h" // interrupt switch utility header file#include "sfr62p.h" // SFR definition of M16C/62P#define TRUE 1#define FALSE 0/*""FUNC COMMENT""************************************************************** ID : ---* Function name : void InitInterruptSW(void)* Function : initialize interrupt switch * Paramenter : none* Return : none* Function used : none* Notice : none* History : ---*""FUNC COMMENT END""*********************************************************/void InitInterruptSW(void){ int0ic = 0x1; //set INT0 IPL as 1 int1ic = 0x1; //set INT1 IPL as 1}/*""FUNC COMMENT""************************************************************** ID : ---* Function name : int rm_sw9chat(void)* Function : cancel chattering of switch INT0 * Paramenter : none* Return : int : the state of switch INT0* Function used : none* Notice : none* History : ---*""FUNC COMMENT END""*********************************************************/int rm_sw9chat(void){ int i; for(i = 0; i < 2000; i++); //software wait ir_int0ic = 0 ; //clear interrupt request bit if(p8_2 == 0){ //check INT0 switch state return TRUE; // INT0 = ON }else{ return FALSE; //INT0 = OFF }}/*""FUNC COMMENT""************************************************************** ID : ---* Function name : int rm_sw10chat(void)* Function : cancel chattering of switch INT1 * Paramenter : none* Return : int : the state of switch INT1* Function used : none* Notice : none* History : ---*""FUNC COMMENT END""*********************************************************/int rm_sw10chat( void ){ int i; for(i = 0; i < 2000; i++); //software wait ir_int1ic = 0 ; //clear interrupt request bit if(p8_3 == 0){ //check INT1 switch state return TRUE; //INT1 = ON }else{ return FALSE; //INT1 = OFF }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -