interrupt_sw.c
来自「瑞萨(Renesas)M16C系列芯片的函数库」· C语言 代码 · 共 70 行
C
70 行
#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 + =
减小字号Ctrl + -
显示快捷键?