各位大佬我寫了兩個程序,用一個獨立按鍵進行切換(想法是按下一次切換A程序,再按下切換B程序),現在結果是只能顯示一種程序,求各位大佬幫忙看下。只列出了主函數,全部單片機程序代碼仿真打包在最下面。
- #include "public.h"
- #include "lcd.h"
- #include "temp.h"
- #include "temperature.h"
- #include "reg52.h"
- #include "calculator.h"
- sbit k4=P3^2;
- bit flag_a=0;
- void keypros()
- {
- if(k4==0)
- {
- flag_a=1;
- }
- else
- {
- flag_a=0;
- }
- if(flag_a==0) //執(zhí)行溫度計程序
- {
- LCD_Init();
- kai_display();
- while(1)
- {
- if(mode==0)
- Temp_DataPros();
- KEY_Pros();
- TempData_Compare();
- }
- }
- else //執(zhí)行計算器程序
- {
- lcdinit();
- while(1)
- {
- keyscan();
- }
- }
- }
- void main()
- {
- while(1)
- {
- keypros(); //按鍵函數
- }
- }
復制代碼
新建文件夾.zip
(190.78 KB, 下載次數: 26)
2020-3-26 18:57 上傳
點擊文件名下載附件
|