标签:select cte time selected 数据 int 关键字 typedef was
以下代码是单片机程序,51单片机,编译器为HT-IDE3000,
简单来说
头文件中只能申明,
变量在头文件中申明时,要加上extern 这个关键字用来告诉编译器,变量在其它的文件中定义,
enum 不是变量,是我们自己定义的数据类型,像int char 一样,只不过是我们自己定义的,所以不用加,
1 extern u16 g_u16TimeBaseCount; 2 extern u8 g_8count_2s; 3 extern u8 g_8count_8s; 4 extern u8 g_8count_18s; 5 extern u8 g_8count_60s; 6 extern u8 g_8count_200s; 7 extern u8 g_8count_6h; 8 extern u8 g_8count_200sw;//6hour wash 9 extern u8 g_8count_6hw;//6hour wash 10 extern u8 w_6hw_start; 11 extern u8 w_6hw_end; 12 extern u8 g_state; 13 extern u16 make_6h_count; 14 extern u8 g_once; 15 extern u16 s_c1;//中间变量 16 extern u16 s_c2; 17 extern u16 s_c3; 18 extern u16 s_c4; 19 20 extern u8 UARTReceive; 21 extern u8 AD[6]; 22 extern u8 TDS[6]; 23 extern u8 count_AD; 24 extern u8 count_ADS; 25 extern u16 sumTDS_H,sumTDS_L,sum; 26 extern u16 temer; 27 28 typedef enum GPIOPin 29 { 30 GPIO_Pin_0 = ((u8)0x01), /*!< Pin 0 selected */ 31 GPIO_Pin_1 = ((u8)0x02), /*!< Pin 1 selected */ 32 GPIO_Pin_2 = ((u8)0x04), /*!< Pin 2 selected */ 33 GPIO_Pin_3 = ((u8)0x08), /*!< Pin 3 selected */ 34 GPIO_Pin_4 = ((u8)0x10), /*!< Pin 4 selected */ 35 GPIO_Pin_5 = ((u8)0x20), /*!< Pin 5 selected */ 36 GPIO_Pin_6 = ((u8)0x40), /*!< Pin 6 selected */ 37 GPIO_Pin_7 = ((u8)0x80), /*!< Pin 7 selected */ 38 GPIO_Pin_LNib = ((u8)0x0F), /*!< Low nibble pins selected */ 39 GPIO_Pin_HNib = ((u8)0xF0), /*!< High nibble pins selected */ 40 GPIO_Pin_All = ((u8)0xFF) /*!< All pins selected */ 41 }GPIO_Pin_TypeDef;
函数也在头文件中,也只能申明,不能加函数体
u8 UART_Receive();
变量和函数的实现也就是函数体,只能在源文件中定义
1 uFlg uF1,uF2,uF3,uF4; 2 u16 g_u16TimeBaseCount; 3 u8 g_8count_2s; 4 u8 g_8count_8s; 5 u8 g_8count_18s; 6 u8 g_8count_60s; 7 u8 g_8count_200s; 8 u8 g_8count_6h; 9 u8 g_8count_200sw;//6hour wash 10 u8 g_8count_6hw;//6hour wash 11 u8 w_6hw_start; 12 u8 w_6hw_end; 13 u8 g_state; 14 u16 make_6h_count; 15 u8 g_once; 16 u16 s_c1;//中间变量 17 u16 s_c2; 18 u16 s_c3; 19 u16 s_c4; 20 u8 UARTReceive=0; 21 u8 AD[6]={0,0,0,0,0,0}; 22 u8 TDS[6]={0,0,0,0,0,0}; 23 u8 count_AD=0; 24 u8 count_ADS=0; 25 u16 sumTDS_H=0,sumTDS_L=0,sum=0; 26 u16 temer; 27 28 //===========================数据接收=========================================// 29 u8 UART_Receive() 30 { 31 u8 data; 32 if(_rxif==1)//如果接收到数据 33 { 34 data=_txr_rxr; 35 return data; 36 } 37 }
标签:select cte time selected 数据 int 关键字 typedef was
原文地址:https://www.cnblogs.com/chenzhong-w/p/9610988.html