|
樓主 |
發表於 2014-9-4 10:44:52
|
顯示全部樓層
本帖最後由 antlu 於 2014-9-4 10:50 AM 編輯
jojoling大:
感謝您的指導!! 點出了問題點!! 就是 extern 變數不能有指定值(=0),可以在 global_define.c 裡面設定,我已經試出來了請過目,再次感謝!!- unsigned char Hundreds,Tens,Units;//顯示百位十位個位
- unsigned int Display_Data;//
- unsigned char count6;//timer 6
- unsigned char display_time;//interrupt for display
- unsigned char Menu=0;//菜單選擇按鍵-------------
- unsigned char One_Sec_Flag;
- unsigned char One_Tenth_Count;//1/10 second
- unsigned char One_Sec_Count;
- unsigned char One_Minute_Count;
- unsigned char One_Tenth_Flag;
- unsigned char One_Minute_Flag;
- unsigned char One_Hour_Flag;
- unsigned char Step_count;//record lamp on/off 次數
- unsigned char rec_Step_On_Time[10];
- unsigned char rec_Step_Off_Time[10];
- unsigned char rec_Out_MOS[10];
- unsigned char Step_On_Time;//current step of on time
- unsigned char Step_Off_Time;//current off time
- unsigned char Out_MOS;//out put port define
- unsigned char Start_Run_Flag;//start stop clear
- unsigned char Step_On_Time_finish;//flag
- unsigned char Step_Off_Time_finish;//flag
- unsigned char Stop_Run_count=0;//for clear------------
- unsigned char Running_Flag=0;//正在倒數---------------
- unsigned char Display_Change_Flag;//變換顯示步驟與時間
- unsigned char Display_Change_count;
- unsigned char Load_Data_flag;//first load data
- unsigned char Alarm_flag;//alarm use
- unsigned char Sec_alarm_flag;//alarm use
- unsigned char Alarm_Time_count=0;//1 minutes---------
- unsigned char Finish_flag=0;//------------------------
複製代碼- //#include "global_defined.h"
- #ifndef __GLOBAL_DEFINED_H__
- #define __GLOBAL_DEFINED_H__
- extern unsigned char Hundreds,Tens,Units;//顯示百位十位個位
- extern unsigned int Display_Data;//
- extern unsigned char count6;//timer 6
- extern unsigned char display_time;//interrupt for display
- extern unsigned char Menu;//菜單選擇按鍵
- extern unsigned char One_Sec_Flag;
- extern unsigned char One_Tenth_Count;//1/10 second
- extern unsigned char One_Sec_Count;
- extern unsigned char One_Minute_Count;
- extern unsigned char One_Tenth_Flag;
- extern unsigned char One_Minute_Flag;
- extern unsigned char One_Hour_Flag;
- extern unsigned char Step_count;//record lamp on/off 次數
- extern unsigned char rec_Step_On_Time[10];
- extern unsigned char rec_Step_Off_Time[10];
- extern unsigned char rec_Out_MOS[10];
- extern unsigned char Step_On_Time;//current step of on time
- extern unsigned char Step_Off_Time;//current off time
- extern unsigned char Out_MOS;//out put port define
- extern unsigned char Start_Run_Flag;//start stop clear
- extern unsigned char Step_On_Time_finish;//flag
- extern unsigned char Step_Off_Time_finish;//flag
- extern unsigned char Stop_Run_count;//for clear
- extern unsigned char Running_Flag;//正在倒數
- extern unsigned char Display_Change_Flag;//變換顯示步驟與時間
- extern unsigned char Display_Change_count;
- extern unsigned char Load_Data_flag;//first load data
- extern unsigned char Alarm_flag;//alarm use
- extern unsigned char Sec_alarm_flag;//alarm use
- extern unsigned char Alarm_Time_count;//1 minutes
- extern unsigned char Finish_flag;
- #endif
複製代碼 MAIN.C 內容- #include "stm8s.h"
- #include "stm8s_tim1.h"
- #include "stm8s_tim5.h"
- #include "stm8s_tim6.h"
- #include "stm8s_adc1.h"
- #include "stm8s_delay.h"
- #include "stm8s_alarm_work.h"
- #include "global_defined.h"
- #define S 10
- #define T 11
- #define P 12
- #define D 13
- #define O 14
- #define F 15
- #define BUZZER GPIO_PIN_0
- //---------20140815-----------------
- #define Out0PORT GPIOB
- #define Out1PORT GPIOB
- #define Out2PORT GPIOA
- #define Out3PORT GPIOF
- #define Out0 GPIO_PIN_6 //小TRIAC
- #define Out1 GPIO_PIN_7 //大TRIAC
- #define Out2 GPIO_PIN_2 //大TRIAC
- #define Out3 GPIO_PIN_4 //繼電器
- u8 pcdis[]={0xd6,0x14,0xcc,0x5c,0x1e,0x5a,0xda,0x14,0xde,0x5e,0x52,0xca,0x8e,0x08,0xd8,0x8a};//定義pc port 顯示的值
- u8 pedis[]={0x01,0x00,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x00,0x00,0x01};//定義pe port 顯示的值對應于7段顯示
- // 增加了stpdop等字段
- /*
- u8 Hundreds,Tens,Units;//顯示百位十位個位
- u16 Display_Data;//
複製代碼 因為 pcdis[]= 內容只用在 主程式的顯示程式內又有等號內容所以乾脆就不放入 global_defined.c內了 |
|