📄 sw.c
字号:
#include "sw.h" // switch utility header file#include "sfr62p.h" // SFR definition of M16C/62P/*""FUNC COMMENT""************************************************************** ID : ---* Function name : void InitSW(void)* Function : initialize switch* Paramenter : none* Return : none* Function used : none* Notice : none* History : ---*""FUNC COMMENT END""*********************************************************/void InitSW(void){ pd3 = 0; // set the port of switch as input}/*""FUNC COMMENT""************************************************************** ID : ---* Function name : unsigned char GetSW(void)* Function : get the switch state* Paramenter : none* Return : none* Function used : none* Notice : none* History : ---*""FUNC COMMENT END""*********************************************************/unsigned char GetSW(void){ unsigned char value; value = p3; // read the state of P3 value = ~value; // reverse the value because of the circuit return value;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -