//------------------------------------------------------------------------------------// Main.c//------------------------------------------------------------------------------------// Copyright (C) 2013 SINYD.// BY Wbr// Tool chain: KEIL Full c////#pragma CD OE DB SB // Compilation directives//------------------------------------------------------------------------------------// Includes//------------------------------------------------------------------------------------#ifndef C8051REG#include "c8051f020.h" // SFR declarations#define C8051REG#endif#include "1302.h"#include "lcd.h"#include #define SYSCLK 22118400 //SYSCLK frequency in Hz#define BAUDRATE 115200 //Baud rate of UART in bps #define SAR_CLK 2500000 //ADC conversion clock = 2.5MHz#define ADC04V 645 //4毫安電流時(shí)AD采樣初值 12位AD#define ADPRE 175 //AD轉(zhuǎn)溫度時(shí)比值放大1000倍 即:(ADC-ADC04V)*ADPRE /1000//*************溫度標(biāo)定設(shè)置**************#define HTA 32 //線性方程0=0.4a-b;50=2.0a-b 求解得a = 31.25 b=12.5 分別取32和13#define HTB 13#define HRA 63 //線性方程0=0.4a-b;100=2.0a-b 求解得a = 62.5 b=25 分別取63和25#define HRB 25#define TEA 313 //線性方程0=0.4a-b;500=2.0a-b 求解得a = 312.5 b=125 分別取313和125#define TEB 125#define HPA 63 //線性方程-5=0.4a-b;5=2.0a-b 求解得a = 6.25 b=7.5 分別取63和75 放大10倍#define HPB 75//------------------------------------------------------------------------------------// Global CONSTANTS//------------------------------------------------------------------------------------extern void Init_Device(void);#define N 11sfr16 TMR2 = 0xCC; //定義成16位地址sfr16 ADC0 = 0xBE; uint idata ADCbuffer1[N];uint sum = 0; uchar ADcount = 0;uchar Page = 1,direction = 1,direction1 = 1;uchar set = 0,ent = 0,Tset;uchar TH,TL,TT1,TT2,TT3; //用來(lái)拆分送顯示的變量uchar keybuffer[6];uchar BGset=0; //BGset背光關(guān),開(kāi)控制量,如果沒(méi)有鍵按下超過(guò)1分鐘,關(guān)閉背光!有鍵按下立刻開(kāi)背光bit Disptime,sendc;sbit BLK = P3^6 ; //LCD背光uint SPEEDcount1; //計(jì)數(shù)器uint SPEEDcount2; //計(jì)數(shù) uint SPEEDTP; //測(cè)試距離 V=SPEEDrange/SPEEDtime;uint SPEEDNY;uint TPrange = 0;uint TPcount = 0;uint idata TEMP1 = 0;uint idata TEMP2 = 0;uint idata TEMP3 = 0;uint idata TEMP4 = 0;uint idata HT = 0;uint idata HR = 0;uint idata HP = 0;uint idata HP1= 0;uint idata TPHD= 0;uint idata TPHD1= 0;uint idata TPHD2= 0; //8路AD通道變量四路來(lái)料溫度 環(huán)境溫度濕度 橫坡度 攤鋪厚度uchar idata HPF,KT1F,KT2F,KT3F,KT4F,HTF,HRF; //橫坡傳感器狀態(tài)位 long a;//*******參數(shù)設(shè)置,傳感器標(biāo)定 變量和數(shù)組************************//uchar xdata SZL0,SZH0,SZL1,SZH1,SZL2,SZH2;uchar xdata SZL3,SZH3,SZL4,SZH4,SZL5,SZH5,SZL6,SZH6; //0~2為施工站號(hào),3~4,5~6分別為攤鋪,壓實(shí)輸入長(zhǎng)度uchar code CSSZ_c[7] _at_ 0x8000; //7k的地址左右站號(hào)設(shè)置,攤鋪碾壓計(jì)算長(zhǎng)度輸入uchar xdata CSSZ_x[7] _at_ 0x8000;uchar xdata Between[7]; //0~11時(shí)間12~19存功率//////////////////////////////////////GPS數(shù)據(jù)存儲(chǔ)數(shù)組//uchar xdata A_V[1]; // V無(wú)效 A有效//uchar xdata JD01[4]; //經(jīng)度//uchar xdata WD01[4]; //經(jīng)度uchar xdata JD[12] = {0x30,0x30,0x30,0x30,0x30,0x2e,0x30,0x30,0x30,0x30,0x30,0x30}; //經(jīng)度 初始化送數(shù)字“0”uchar xdata JD_a; //經(jīng)度方向uchar xdata WD[11] = {0x30,0x30,0x30,0x30,0x2e,0x30,0x30,0x30,0x30,0x30,0x30}; //緯度 初始化送數(shù)字“0”uchar xdata WD_a; //緯度方向//uchar xdata time[6]; //時(shí)間時(shí)分秒//uchar xdata TIMER[6]; //年月日//uchar xdata speed[5]; //速度//uchar xdata HIGH[6] = {0x30,0x30,0x30,0x30,// 0x30,0x30}; //高度 初始化送數(shù)字“0”//uchar xdata angle[5]; //方位角//uchar xdata use_sat[2]; //使用的衛(wèi)星數(shù)//uchar xdata total_sat[2]; //天空中總衛(wèi)星數(shù)//uchar lock; //定位狀態(tài)//串口中斷需要的變量uchar xdata seg_count; //逗號(hào)計(jì)數(shù)器uchar xdata dot_count; //小數(shù)點(diǎn)計(jì)數(shù)器uchar xdata byte_count; //位數(shù)計(jì)數(shù)器uchar xdata cmd_number; //命令類型uchar xdata mode; //0:結(jié)束模式,1:命令模式,2:數(shù)據(jù)模式uchar xdata buf_full; //1:整句接收完成,相應(yīng)數(shù)據(jù)有效。0:緩存數(shù)據(jù)無(wú)效。uchar xdata cmd[5]; //命令類型存儲(chǔ)數(shù)組extern uchar time_buf1[8] ;uchar code tab0[]={"料溫:"};uchar code tab1[]={"料溫1:"};uchar code tab2[]={"料溫2:"};uchar code tab3[]={"料溫3:"};uchar code tab4[]={"料溫4:"};uchar code tab5[]={"環(huán)境溫度:"};uchar code tab6[]={"環(huán)境濕度:"};uchar code tab7[]={"橫坡度:"};uchar code tab8[]={"℃"};//uchar code tab9[]={"瀝青攤鋪厚度:"};uchar code tab10[]={"緯度:"};uchar code tab11[]={"經(jīng)度:"};uchar code tab12[]={"高度:"};uchar code tab13[]={"設(shè)備ID:"};uchar code tab14[]={"攤鋪S(mm):"};uchar code tab15[]={"碾壓S(mm):"};uchar code page0[]={"參數(shù)設(shè)置:"};uchar code page1[]={"攤鋪壓實(shí)監(jiān)測(cè)裝置"};uchar code page2[]={"實(shí)時(shí)顯示"};uchar code page41[]={"攤鋪速度:"};uchar code page42[]={"碾壓速度:"};//uchar code page5[]={"傳感器標(biāo)定:"};uchar code page5[]={"瀝青攤鋪厚度:"};uchar code page51[]={"前探頭:"};uchar code page52[]={"后探頭:"};uchar code page6[]={"實(shí)時(shí)定位信息:"};uchar code page7[]={"修改時(shí)間:"};uchar code run1[]={"先按:SET再按:ENT"};uchar code run2[]={"未連接"};uchar code run3[]={"%"};uchar code run4[]={"M/MIN"};uchar code run5[]={"KM/H"};uchar code run6[]={"線路故障"};uchar xdata TAB[11]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x20};//數(shù)字0~9及顯示空白0x20*/uchar code tab32[] ={/*-- 寬度x高度=128x64 --*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x1F,0xFE,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF8,0x00,0xFC,0x00,0x1E,0x3E,0x01,0xFE,0x01,0xFF,0xFF,0x80,0x00,0x00,0x00,0x03,0xF0,0x01,0xF8,0x00,0x1E,0x3E,0x01,0xEF,0x03,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x0F,0xC0,0x01,0xF0,0x00,0x3C,0x7F,0x03,0xCF,0x07,0x9F,0xFF,0xC0,0x00,0x00,0x00,0x1F,0x80,0x01,0xF0,0x00,0x3C,0x7F,0x03,0xC7,0x8F,0x1C,0x07,0xC0,0x00,0x00,0x00,0x3F,0x00,0x01,0xE0,0x00,0x7C,0x7F,0x83,0xC7,0x9E,0x38,0x07,0x80,0x00,0x00,0x00,0x3F,0x00,0x01,0xE1,0xE0,0x78,0xFF,0x87,0x83,0xFC,0x38,0x07,0x80,0x00,0x00,0x00,0x7E,0x00,0x00,0xF0,0xF8,0x78,0xF3,0xC7,0x83,0xF8,0x78,0x07,0x80,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xF8,0xF8,0xF3,0xC7,0x81,0xF0,0x70,0x0F,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xFC,0xF1,0xE1,0xEF,0x01,0xE0,0x70,0x0F,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x01,0xF8,0xF1,0xE1,0xFF,0x03,0xE0,0x70,0x0F,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x03,0xF9,0xF1,0xE0,0xFF,0x03,0xC0,0xE0,0x1E,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x07,0xF1,0xE3,0xC0,0xFE,0x03,0xC0,0xFF,0xFE,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x3F,0xE1,0xE3,0xC0,0x7E,0x07,0xC0,0xFF,0xFE,0x00,0x00,0x00,0x00,0xFE,0x00,0x1F,0xFF,0x83,0xE7,0xC0,0x7E,0x07,0x81,0xFF,0xFC,0x00,0x00,0x00,0x00,0xFC,0x00,0x03,0xF8,0x00,0x80,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x10,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x19,0x81,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x18,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x67,0xF0,0x00,0x0F,0xE3,0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0xCE,0x00,0x00,0x07,0x83,0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x71,0x8C,0x00,0x00,0x07,0x83,0x86,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x1E,0x00,0x00,0x07,0x1F,0xCE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0xDF,0xC0,0x00,0x07,0x3F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0xC0,0x00,0x0F,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x38,0xCF,0xFF,0xCE,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0xB9,0xCF,0xFF,0xCE,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x39,0x80,0x00,0x0E,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFE,0x31,0x80,0x00,0x1E,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFE,0x73,0x80,0x00,0x1C,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x76,0x73,0x00,0x00,0x1C,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x76,0x63,0x00,0x00,0x3C,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xE6,0xE7,0x00,0x00,0x38,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xE6,0xE6,0x00,0x00,0x38,0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};//---------------------------------------- // Function PROTOTYPES//----------------------------------------void delayms(uint ms){uint Temp;while(ms--){Temp=2000;while(Temp--);{//PCA0CPH2 = 1;}}}//===========================================//寫(xiě)FLASH函數(shù)//===========================================void Flash_Erase_CSSZ() //flash擦除充電時(shí)間和功率{EA =0;FLSCL |= 0x01; // PSCTL |= 0x03; //允許擦,允許寫(xiě)CSSZ_x[0] = 0;PSCTL &= 0xfc; //禁止寫(xiě),禁止擦FLSCL &= 0xfe; }void Flash_Program_CSSZ() //flash寫(xiě)入充電時(shí)間時(shí)間和功率{uchar j;EA =0; FLSCL |= 0x01; //使能FLASH單穩(wěn)態(tài)定時(shí)器,F(xiàn)LASH讀時(shí)間SYSCLK<=25MHzPSCTL |= 0x01; //write enablefor(j =0;j<7;j++){CSSZ_x[j] = Between[j];}PSCTL &= 0xfc; //禁止寫(xiě)FLSCL &= 0xfe;EA = 1;}//================================//中值濾波程序//================================void filter(){static uchar count,i,j;uint xdata value_buf[N];uint temp;sum=0;for(count=0;countvalue_buf[i+1] ){temp = value_buf[i];value_buf[i] = value_buf[i+1]; value_buf[i+1] = temp;}}}for(count=1;count1){BGset = 2;}}} }if(BGset ==2 ){if(!(Mkey&0x08)) //ESC按下嗎? P63{delayms(200); //消抖if(!(Mkey&0x08)) //再判斷{BGset =2; //開(kāi)背光//if(k<1) {Page = 0;} //頁(yè)面0:顯示版本信息狀態(tài) //k++;//if(k>1) {k =0;Page = 1; } //再按后退出Page = 1;set = 0;} }if(!(Mkey&0x10)) //DATA按下嗎? P64{delayms(200); //消抖if(!(Mkey&0x10)) //再判斷{BGset =2; //開(kāi)背光//if(k<1) {Page = 0;} //頁(yè)面0:顯示版本信息狀態(tài) //k++;//if(k>1) {k =0;Page = 1; } //再按后退出Page = 0;set = 0;} }if(!set){if(!(Mkey&0x80)) //--->按下嗎?下翻{delayms(200);if(!(Mkey&0x80)){if(Page !=0){Page++;BGset =2;if(Page>7) //如果超過(guò)7界面回到1畫(huà)面{Page = 1;}}} }if(!(Mkey&0x20)) //<---按下嗎?上翻{delayms(200);if(!(Mkey&0x20)){if(Page !=0){Page--;BGset =2;if(Page<1) //小于1畫(huà)面后不顯示0畫(huà)面,顯示7畫(huà)面{Page = 7;}}} }}//************************************************//設(shè)置參數(shù)//************************************************if(Page ==0){if(!(Mkey&0x02)) //SET按下嗎?設(shè)定SET在0畫(huà)面設(shè)置參數(shù){delayms(200);if(!(Mkey&0x02)){BGset =2;set = 1; //如果按下SET鍵表示開(kāi)始設(shè)置時(shí)間,置設(shè)置標(biāo)志位;}}if(set == 1){if(!(Mkey&0x20)) //<- 按下嗎?左移<- 在0畫(huà)面修改參數(shù){delayms(200);if(!(Mkey&0x20)){BGset =2;direction1++;if(direction1 > 14){direction1 = 1; //本界面14個(gè)數(shù)字要修改}}}if(!(Mkey&0x80)) //->按下嗎?右移->只在0畫(huà)面修改時(shí)間{delayms(200);if(!(Mkey&0x80)){BGset =2;direction1--;if(direction1 < 1){ direction1 = 14;} } }switch(direction1){case 1: //第一位修改{//number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]); number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);number_disp (0x9f,1,TAB[SZH5],TAB[SZL5]);number_disp (0x9e,1,TAB[SZH6],TAB[SZL6]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZL0++;if(SZL0>9) //設(shè)置,不超過(guò)9{SZL0 = 0;}} }/*if(!(Mkey&0x10)) //-按下嗎?{delayms(200);if(!(Mkey&0x10)){BGset =2;if(SZL0<=0) //小于1畫(huà)面后不顯示0畫(huà)面{SZL0 = 9;}SZL0--;} }*/if(Tset < 2){number_disp (0x97,1,TAB[SZH0],TAB[SZL0]);}if(Tset>2){number_disp (0x97,1,TAB[SZH0],0x20); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 2://第二位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZH0++;if(SZH0>9) //設(shè)置,不超過(guò)9{SZH0 = 0;}} }if(Tset < 2){number_disp (0x97,1,TAB[SZH0],TAB[SZL0]);}if(Tset>2){number_disp (0x97,1,0x20,TAB[SZL0]); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 3://第三位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZL1++;if(SZL1>9) //設(shè)置,不超過(guò)9{SZL1 = 0;}} }if(Tset < 2){number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);}if(Tset>2){number_disp (0x96,1,TAB[SZH1],0x20); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 4://第4位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZH1++;if(SZH1>9) //設(shè)置,不超過(guò)9{SZH1 = 0;}} }if(Tset < 2){number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);}if(Tset>2){number_disp (0x96,1,0x20,TAB[SZL1]); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 5://第5位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]); if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZL2++;if(SZL2>9) //設(shè)置,不超過(guò)9{SZL2 = 0;}} }if(Tset < 2){number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);}if(Tset>2){number_disp (0x95,1,TAB[SZH2],0x20); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 6://第6位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZH2++;if(SZH2>9) //設(shè)置,不超過(guò)9{SZH2 = 0;}} }if(Tset < 2){number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);}if(Tset>2){number_disp (0x95,1,0x20,TAB[SZL2]); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 7://第7位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]); if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZL3++;if(SZL3>9) //設(shè)置,不超過(guò)9{SZL3 = 0;}} }if(Tset < 2){number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]);}if(Tset>2){number_disp (0x8f,1,TAB[SZH3],0x20); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 8://第8位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZH3++;if(SZH3>9) //設(shè)置,不超過(guò)9{SZH3 = 0;}} }if(Tset < 2){number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]);}if(Tset>2){number_disp (0x8f,1,0x20,TAB[SZL3]); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 9://第9位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]); if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZL4++;if(SZL4>9) //設(shè)置,不超過(guò)9{SZL4 = 0;}} }if(Tset < 2){number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);}if(Tset>2){number_disp (0x8e,1,TAB[SZH4],0x20); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 10://第10位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]); if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZH4++;if(SZH4>9) //設(shè)置,不超過(guò)9{SZH4 = 0;}} }if(Tset < 2){number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);}if(Tset>2){number_disp (0x8e,1,0x20,TAB[SZL4]); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 11://第11位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]);number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZL5++;if(SZL5>9) //設(shè)置,不超過(guò)9{SZL5 = 0;}} }if(Tset < 2){number_disp (0x9f,1,TAB[SZH5],TAB[SZL5]);}if(Tset>2){number_disp (0x9f,1,TAB[SZH5],0x20); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 12://第12位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]); number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZH5++;if(SZH5>9) //設(shè)置,不超過(guò)9{SZH5 = 0;}} }if(Tset < 2){number_disp (0x9f,1,TAB[SZH5],TAB[SZL5]);}if(Tset>2){number_disp (0x9f,1,0x20,TAB[SZL5]); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 13://第11位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]);number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);number_disp (0x9f,1,TAB[SZH5],TAB[SZL5]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZL6++;if(SZL6>9) //設(shè)置,不超過(guò)9{SZL6 = 0;}} }if(Tset < 2){number_disp (0x9e,1,TAB[SZH6],TAB[SZL6]);}if(Tset>2){number_disp (0x9e,1,TAB[SZH6],0x20); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;case 14://第12位修改{number_disp (0x97,1,TAB[SZH0],TAB[SZL0]); //把前面的顯示了number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]); number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);number_disp (0x9f,1,TAB[SZH5],TAB[SZL5]);if(!(Mkey&0x01)) //+按下嗎?{delayms(200);if(!(Mkey&0x01)){BGset =2;SZH6++;if(SZH6>9) //設(shè)置,不超過(guò)9{SZH6 = 0;}} }if(Tset < 2){number_disp (0x9e,1,TAB[SZH6],TAB[SZL6]);}if(Tset>2){number_disp (0x9e,1,0x20,TAB[SZL6]); //定時(shí)送滅狀態(tài),實(shí)現(xiàn)閃爍}}break;default:break;}if(!(Mkey&0x04)) //ENT按下嗎?確認(rèn)ENT 在0畫(huà)面設(shè)定參數(shù){delayms(200);if(!(Mkey&0x04)){BGset =2;Between[0] = SZH0*10 + SZL0;Between[1] = SZH1*10 + SZL1;Between[2] = SZH2*10 + SZL2;Between[3] = SZH3*10 + SZL3;Between[4] = SZH4*10 + SZL4;Between[5] = SZH5*10 + SZL5;Between[6] = SZH6*10 + SZL6; Flash_Erase_CSSZ(); Flash_Program_CSSZ(); //寫(xiě)入FLASHset = 0;Page = 1; //退出到1畫(huà)面} }} }
評(píng)論