#include "STC15F2K60S2.h" //STC15系列的头文件,添加方法参考视频:https://www.bilibili.com/video/av95391542/ #include "iic.h" #include "onewire.h" #define u8 unsigned char #define u16 unsigned int u8 code smg_du[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x39,0x73}; //0-9 u8 code smg_wei[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; void ADC_process(); #define NO_KEY 0x0f //无按键按下 #define KEY_STATE0 0 //判断按键按下 #define KEY_STATE1 1 //确认按键按下 #define KEY_STATE2 2 //释放按键 unsigned char Key_Scan() { static unsigned char key_state=KEY_STATE0; //定义为静态变量,用于保存每次按键的状态 u8 key_value=0,key_temp; //key_val:返回的键值;key_temp:读取的IO状态 key_temp=P3&0x0f; switch(key_state) { case KEY_STATE0: //判断按键按下 if(key_temp!=NO_KEY) { key_state=KEY_STATE1; //有键按下,就转到状态1 } break; case KEY_STATE1: //经过10ms,再次确认按键按下&#
蓝桥十一届省赛第二场 多参数 PCF8591 输出adc
最新推荐文章于 2023-05-17 20:55:57 发布