您的位置 首页 国产IC

c8051f单片机ad采样程序

————————————————————————————Mainc———–

//————————————————————————————

// 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毫安电流时AD采样初值  12位AD#define ADPRE    175      //AD转温度时比值扩大1000倍 即:(ADC-ADC04V)*ADPRE /1000//*************温度标定设置**************#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;        //用来拆分送显现的变量uchar keybuffer[6];uchar BGset=0;             //BGset背光关,开操控量,假如没有键按下超越1分钟,封闭背光!有键按下马上开背光bit Disptime,sendc;sbit BLK = P3^6 ;          //LCD背光uint  SPEEDcount1;          //计数器uint  SPEEDcount2;          //计数 uint  SPEEDTP;           //测验间隔  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通道变量四路来料温度 环境温度湿度 横斜度 摊铺厚度uchar idata  HPF,KT1F,KT2F,KT3F,KT4F,HTF,HRF;   //横坡传感器状况位  long a;//*******参数设置,传感器标定 变量和数组************************//uchar xdata SZL0,SZH0,SZL1,SZH1,SZL2,SZH2;uchar xdata SZL3,SZH3,SZL4,SZH4,SZL5,SZH5,SZL6,SZH6;  //0~2为施工站号,3~4,5~6别离为摊铺,压实输入长度uchar code  CSSZ_c[7] _at_ 0x8000;             //7k的地址左右站号设置,摊铺碾压计算长度输入uchar xdata CSSZ_x[7] _at_ 0x8000;uchar xdata Between[7];          //0~11时刻12~19存功率//////////////////////////////////////GPS数据存储数组//uchar xdata A_V[1];       // V无效 A有用//uchar xdata JD01[4];                //经度//uchar xdata WD01[4];                //经度uchar xdata JD[12] = {0x30,0x30,0x30,0x30,0x30,0x2e,0x30,0x30,0x30,0x30,0x30,0x30};  //经度  初始化送数字“0”uchar xdata JD_a;                 //经度方向uchar xdata WD[11] = {0x30,0x30,0x30,0x30,0x2e,0x30,0x30,0x30,0x30,0x30,0x30};    //纬度  初始化送数字“0”uchar xdata WD_a;                 //纬度方向//uchar xdata time[6];             //时刻时分秒//uchar xdata TIMER[6];       //年月日//uchar xdata speed[5];             //速度//uchar xdata HIGH[6] = {0x30,0x30,0x30,0x30,// 0x30,0x30};         //高度  初始化送数字“0”//uchar xdata angle[5];             //方位角//uchar xdata use_sat[2];            //运用的卫星数//uchar xdata total_sat[2];         //天空中总卫星数//uchar lock;                  //定位状况//串口中止需求的变量uchar xdata seg_count;             //逗号计数器uchar xdata dot_count;             //小数点计数器uchar xdata byte_count;             //位数计数器uchar xdata cmd_number;             //指令类型uchar xdata mode;                    //0:完毕形式,1:指令形式,2:数据形式uchar xdata buf_full;                //1:整句接纳完结,相应数据有用。0:缓存数据无效。uchar xdata cmd[5];                 //指令类型存储数组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[]={"环境温度:"};uchar  code tab6[]={"环境湿度:"};uchar  code tab7[]={"横斜度:"};uchar  code tab8[]={"℃"};//uchar  code tab9[]={"沥青摊铺厚度:"};uchar  code tab10[]={"纬度:"};uchar  code tab11[]={"经度:"};uchar  code tab12[]={"高度:"};uchar  code tab13[]={"设备ID:"};uchar  code tab14[]={"摊铺S(mm):"};uchar  code tab15[]={"碾压S(mm):"};uchar  code page0[]={"参数设置:"};uchar  code page1[]={"摊铺压实监测设备"};uchar  code page2[]={"实时显现"};uchar  code page41[]={"摊铺速度:"};uchar  code page42[]={"碾压速度:"};//uchar  code page5[]={"传感器标定:"};uchar  code page5[]={"沥青摊铺厚度:"};uchar  code page51[]={"前探头:"};uchar  code page52[]={"后探头:"};uchar  code page6[]={"实时定位信息:"};uchar  code page7[]={"修正时刻:"};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};//数字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;}}}//===========================================//写FLASH函数//===========================================void Flash_Erase_CSSZ()                //flash擦除充电时刻和功率{EA =0;FLSCL |= 0x01;                          // PSCTL |= 0x03;                       //答应擦,答应写CSSZ_x[0] = 0;PSCTL &= 0xfc;                       //制止写,制止擦FLSCL &= 0xfe; }void Flash_Program_CSSZ()              //flash写入充电时刻时刻和功率{uchar j;EA =0;                  FLSCL |= 0x01;                          //使能FLASH单稳态守时器,FLASH读时刻SYSCLK<=25MHzPSCTL |= 0x01;                    //write enablefor(j =0;j<7;j++){CSSZ_x[j] = Between[j];}PSCTL &= 0xfc;                       //制止写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;       //开背光//if(k<1) {Page = 0;}     //页面0:显现版别信息状况  //k++;//if(k>1) {k =0;Page = 1; }   //再按后退出Page = 1;set = 0;} }if(!(Mkey&0x10))           //DATA按下吗?  P64{delayms(200);        //消抖if(!(Mkey&0x10))        //再判别{BGset =2;       //开背光//if(k<1) {Page = 0;}     //页面0:显现版别信息状况  //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)     //假如超越7界面回到1画面{Page = 1;}}} }if(!(Mkey&0x20))        //<---按下吗?上翻{delayms(200);if(!(Mkey&0x20)){if(Page !=0){Page--;BGset =2;if(Page<1)     //小于1画面后不显现0画面,显现7画面{Page = 7;}}} }}//************************************************//设置参数//************************************************if(Page ==0){if(!(Mkey&0x02))          //SET按下吗?设定SET在0画面设置参数{delayms(200);if(!(Mkey&0x02)){BGset =2;set = 1;       //假如按下SET键表明开端设置时刻,置设置标志位;}}if(set == 1){if(!(Mkey&0x20))        //<- 按下吗?左移<- 在0画面修正参数{delayms(200);if(!(Mkey&0x20)){BGset =2;direction1++;if(direction1 > 14){direction1 = 1;  //本界面14个数字要修正}}}if(!(Mkey&0x80))        //->按下吗?右移->只在0画面修正时刻{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)       //设置,不超越9{SZL0 = 0;}} }/*if(!(Mkey&0x10))          //-按下吗?{delayms(200);if(!(Mkey&0x10)){BGset =2;if(SZL0<=0)       //小于1画面后不显现0画面{SZL0 = 9;}SZL0--;} }*/if(Tset < 2){number_disp (0x97,1,TAB[SZH0],TAB[SZL0]);}if(Tset>2){number_disp (0x97,1,TAB[SZH0],0x20);        //守时送灭状况,完成闪耀}}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)       //设置,不超越9{SZH0 = 0;}} }if(Tset < 2){number_disp (0x97,1,TAB[SZH0],TAB[SZL0]);}if(Tset>2){number_disp (0x97,1,0x20,TAB[SZL0]);        //守时送灭状况,完成闪耀}}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)       //设置,不超越9{SZL1 = 0;}} }if(Tset < 2){number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);}if(Tset>2){number_disp (0x96,1,TAB[SZH1],0x20);        //守时送灭状况,完成闪耀}}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)       //设置,不超越9{SZH1 = 0;}} }if(Tset < 2){number_disp (0x96,1,TAB[SZH1],TAB[SZL1]);}if(Tset>2){number_disp (0x96,1,0x20,TAB[SZL1]);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZL2 = 0;}} }if(Tset < 2){number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);}if(Tset>2){number_disp (0x95,1,TAB[SZH2],0x20);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZH2 = 0;}} }if(Tset < 2){number_disp (0x95,1,TAB[SZH2],TAB[SZL2]);}if(Tset>2){number_disp (0x95,1,0x20,TAB[SZL2]);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZL3 = 0;}} }if(Tset < 2){number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]);}if(Tset>2){number_disp (0x8f,1,TAB[SZH3],0x20);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZH3 = 0;}} }if(Tset < 2){number_disp (0x8f,1,TAB[SZH3],TAB[SZL3]);}if(Tset>2){number_disp (0x8f,1,0x20,TAB[SZL3]);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZL4 = 0;}} }if(Tset < 2){number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);}if(Tset>2){number_disp (0x8e,1,TAB[SZH4],0x20);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZH4 = 0;}} }if(Tset < 2){number_disp (0x8e,1,TAB[SZH4],TAB[SZL4]);}if(Tset>2){number_disp (0x8e,1,0x20,TAB[SZL4]);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZL5 = 0;}} }if(Tset < 2){number_disp (0x9f,1,TAB[SZH5],TAB[SZL5]);}if(Tset>2){number_disp (0x9f,1,TAB[SZH5],0x20);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZH5 = 0;}} }if(Tset < 2){number_disp (0x9f,1,TAB[SZH5],TAB[SZL5]);}if(Tset>2){number_disp (0x9f,1,0x20,TAB[SZL5]);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZL6 = 0;}} }if(Tset < 2){number_disp (0x9e,1,TAB[SZH6],TAB[SZL6]);}if(Tset>2){number_disp (0x9e,1,TAB[SZH6],0x20);            //守时送灭状况,完成闪耀}}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)        //设置,不超越9{SZH6 = 0;}} }if(Tset < 2){number_disp (0x9e,1,TAB[SZH6],TAB[SZL6]);}if(Tset>2){number_disp (0x9e,1,0x20,TAB[SZL6]);            //守时送灭状况,完成闪耀}}break;default:break;}if(!(Mkey&0x04))          //ENT按下吗?承认ENT 在0画面设定参数{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();                   //写入FLASHset = 0;Page = 1;       //退出到1画面} }}    }				   

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/bandaoti/ic/255192.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部