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