用12864液晶屏来显示的单片机数字万用表制作资料,菜单显示处理很经典:
单片机源程序如下:
- /************************************************************************************************
- 控制说明:
- 电阻测量: 10: send0(0x80); 100: send0(0x81);
- 1K: send0(0x82); 10K: send0(0x83);
- 100K: send0(0x84); 1M: send0(0x85);
- 10M: send0(0x86);
-
- 直流电压测量:100MV: send1(0x04);
- 10V: send1(0x08);
- 100V: send1(0x10);
- 10KV: send1(0x20);
- 交流电压测量:100MV: send1(0x06);
- 10V: send1(0x0a);
- 100V: send1(0x12);
- 10KV: send1(0x22);
- 直流电流测量: 1MA: send2(0x02);
- 10MA: send2(0x04);
- 100MA: send2(0x08);
- 10A: send2(0x10);
- 交流电流测量: 1MA: send2(0x03);
- 10MA: send2(0x05);
- 100MA: send2(0x09);
- 10A: send2(0x11);
- 注:初始化时要全部处于非工作状态<send0(0x08) send1(0x00) send2(0x00)>使用时选择相应指令,返回时关断.
- *************************************************************************************************/
- #include <reg52.h>
- #include <stdio.h>
- #include <intrins.h>
- #include <string.h>
- #include <math.h>
- #include "ziku.h" //字库
- sbit key_up = P3^2; //光标上移按键
- sbit key_down = P3^3; //光标下移按键
- sbit key_ok = P3^4; //确定按键
- sbit key_back = P3^5; //退出按键
- sbit ZLDL = P3^0; //
- /*** 利用二维数组存放字模 ***/
- unsigned char code arrayadress0[][4];
- unsigned char code arrayadress1[][12];
- unsigned char code arrayadress2[][16];
- unsigned char code arrayadress3[][8];
- unsigned char code arrayadress4[][4];
- unsigned char code arrayadress5[][8];
- unsigned char code arrayadress6[][16];
- unsigned char code arrayadress7[][12];
- /***** 函数声明 *****/
- extern void InitLCD(); //液晶初始化函数
- extern void delay1ms(unsigned char x); //延时1ms函数
- extern void delay10ms(unsigned char x); //延时10ms函数
- extern void biaoge(); //画表格函数
- extern void Clrscreen(unsigned char m); //送指定数据函数
- extern double duqudata0(unsigned char i); //采集数据函数
- extern double duqudata1_1(unsigned char i); //采集数据函数
- extern double duqudata1_2(unsigned char i); //采集数据函数
- extern double duqudata1_3(unsigned char i); //采集数据函数
- extern double duqudata2(unsigned char i); //采集数据函数
- extern double duqudata3(unsigned char i); //采集数据函数
- extern void send0(unsigned char abc); //串口发送子函数(控制电阻档)
- extern void send1(unsigned char abc); //模拟串口发送子函数(控制电压档)
- extern void send2(unsigned char abc); //模拟串口发送子函数(控制电压档)
- extern void Clrscreen_ge(unsigned char dat,unsigned char layer,unsigned char column,unsigned char whidth); //送固定数据\画表格
- extern void Clrscreen_data(unsigned char dat,unsigned char layer,unsigned char column,unsigned char whidth); //送固定数据函数
- extern void display_GD(unsigned char layer,unsigned char column,unsigned char whidth,unsigned char daxiao,signed char KY,signed char HY,unsigned char *china_code); //移动显示函数
- extern void display(unsigned char layer,unsigned char column,unsigned char whidth,unsigned char daxiao,unsigned char *china_code); //随意显示函数
- extern void display_LM(unsigned char layer,unsigned char column,unsigned char whidth,unsigned char daxiao,unsigned char *china_code); //拉幕显示
- extern void QU_ASCII(unsigned char layer,unsigned char column,unsigned char whidth,unsigned char daxiao,unsigned char *china_code); //动态数字显示
- void InitJDQ(); //初始化继电器
- void display_start(); //开屏显示内容
- void display_RES(); //进入电阻档显示界面
- void display_VOL(); //进入电压档显示界面
- void display_GAL(); //进入电流档显示界面
- void display_figure(unsigned char i); //采集处理的数字显示
- void display_dat(); //采集数据处理显示
- /**** 全局变量定义 ****/
- unsigned char k;
- unsigned char Z,Z0,Z1,Z2;
- double number,numb,N=0,Y;
- /********************************************************************************************************
- void InitJDQ() //初始化继电器
- *********************************************************************************************************/
- void InitJDQ()
- {
- send0(0x08);
- send1(0x00);
- send2(0x00);
- ZLDL=0;
- }
- /********************************************************************************************************
- void display_start() //开屏显示内容
- *********************************************************************************************************/
- void display_start()
- {
- Clrscreen(0x00);
- display(0,0,4,12,arrayadress1[0]); //电阻测量
- display(2,0,4,12,arrayadress1[8]); //短路检测
- display(4,0,6,12,arrayadress1[16]); //直流电压测量
- display(6,0,6,12,arrayadress1[28]); //交流电压测量
- display(0,56,6,12,arrayadress1[40]); //直流电流测量
- display(2,56,6,12,arrayadress1[52]); //交流电流测量
- display(4,80,4,12,arrayadress1[64]); //频率测量
- }
- /*******************************************************************************************************
- void display_RES() //进入电阻档显示界面
- *********************************************************************************************************/
- void display_RES()
- {
- Clrscreen(0x00);
- display(0,0,6,12,arrayadress7[0]); //请选择档位:
- display(6,32,8,12,arrayadress7[12]); //选择后请按确认键
- display(2,6,2,8,arrayadress3[12]); //10
- display(2,34,3,8,arrayadress3[16]); //100
- QU_ASCII(2,70,1,8,"1");
- display(2,78,1,8,arrayadress3[10]); //1K
- display(2,98,2,8,arrayadress3[12]);
- display(2,114,1,8,arrayadress3[10]); //10K
- display(4,6,3,8,arrayadress3[16]);
- display(4,30,1,8,arrayadress3[10]); //100K
- QU_ASCII(4,60,1,8,"1");
- display(4,68,1,8,arrayadress3[6]); //1M
- display(4,98,2,8,arrayadress3[12]);
- display(4,114,1,8,arrayadress3[6]); //10M
- }
- /******************************************************************************************************
- void display_VOL() //进入电压档显示界面
- ***********************************************************************************************************/
- void display_VOL()
- {
- Clrscreen(0x00);
- display(0,0,6,12,arrayadress7[0]); //请选择档位:
- display(6,32,8,12,arrayadress7[12]); //选择后请按确认键
- display(2,22,3,8,arrayadress3[16]);
- display(2,46,1,8,arrayadress3[6]);
- display(2,54,1,8,arrayadress3[0]); //100MV
- display(2,82,2,8,arrayadress3[12]);
- display(2,98,1,8,arrayadress3[0]); //10V
- display(4,22,3,8,arrayadress3[16]);
- display(4,46,1,8,arrayadress3[0]); //100V
- QU_ASCII(4,82,1,8,"1");
- display(4,90,1,8,arrayadress3[10]);
- display(4,98,1,8,arrayadress3[0]); //1KV
- }
- /*****************************************************************************************************
- void display_GAL() //进入电流档显示界面
- ******************************************************************************************************/
- void display_GAL()
- {
- Clrscreen(0x00);
- display(0,0,6,12,arrayadress7[0]); //请选择档位:
- display(6,32,8,12,arrayadress7[12]); //选择后请按确认键
- QU_ASCII(2,22,1,8,"1");
- display(2,32,2,8,arrayadress3[6]); //1MA
- display(2,74,2,8,arrayadress3[12]);
- display(2,92,2,8,arrayadress3[6]); //10MA
- display(4,22,3,8,arrayadress3[16]);
- display(4,48,2,8,arrayadress3[6]); //100MA
- display(4,82,2,8,arrayadress3[12]);
- display(4,100,1,8,arrayadress3[8]); //10A
- }
- /******************************************************************************************************
- void display_figure() //采集处理数字显示
- *******************************************************************************************************/
- void display_figure(unsigned char i)
- {
- switch(i)
- {
- case 1: QU_ASCII(3,k,1,8,"1"); break;
- case 2: QU_ASCII(3,k,1,8,"2"); break;
- case 3: QU_ASCII(3,k,1,8,"3"); break;
- case 4: QU_ASCII(3,k,1,8,"4"); break;
- case 5: QU_ASCII(3,k,1,8,"5"); break;
- case 6: QU_ASCII(3,k,1,8,"6"); break;
- case 7: QU_ASCII(3,k,1,8,"7"); break;
- case 8: QU_ASCII(3,k,1,8,"8"); break;
- case 9: QU_ASCII(3,k,1,8,"9"); break;
- default: QU_ASCII(3,k,1,8,"0");
- }
- }
- /******************************************************************************************************
- void display_dat() //采集数据处理显示
- *******************************************************************************************************/
- void display_dat()
- {
- unsigned char j;
- j=number;
- if(j/100) //判断最高位是否为十位
- {
- k=32; //全局变量K(显示起始列)的赋值
- Z0=number/100; //取十位上的数值
- display_figure(Z0); //显示数据(switch...case)
- number=number-Z0*100; //减掉十位数据
- k+=8;
- Z0=number/10; //取十位上的数值
- display_figure(Z0); //显示数据(switch...case)
- number=number-Z0*10; //减掉十位数据
- k+=8; //列地址加八
- Z0=number/1; //取个位数值
- display_figure(Z0); //显示数据(switch...case)
- display(3,56,1,4,arrayadress0[0]); //小数点显示
- number=number-Z0*1; //减掉个位数据
- k+=12;
- Z0=number/0.1; //取小数点后第一位的数值
- display_figure(Z0);
- number=number-Z0*0.1;
- k+=8;
- Z0=number/0.01; //取小数点后第二位的数值
- display_figure(Z0);
- number=number-Z0*0.01;
- k+=8;
- Z0=number/0.001; //取小数点后第三位的数值;
- display_figure(Z0);
- }
- else if(j/10) //判断最高位是否为十位
- {
- Clrscreen_data(0x00,3,32,8);
- k=40; //全局变量K(显示起始列)的赋值
- Z0=number/10; //取十位上的数值
- display_figure(Z0); //显示数据(switch...case)
- number=number-Z0*10; //减掉十位数据
- k+=8; //列地址加八
- Z0=number/1; //取个位数值
- display_figure(Z0); //显示数据(switch...case)
- display(3,56,1,4,arrayadress0[0]); //小数点显示
- number=number-Z0*1; //减掉个位数据
- k+=12;
- Z0=number/0.1; //取小数点后第一位的数值
- display_figure(Z0);
- number=number-Z0*0.1;
- k+=8;
- Z0=number/0.01; //取小数点后第二位的数值
- display_figure(Z0);
- number=number-Z0*0.01;
- k+=8;
- Z0=number/0.001; //取小数点后第三位的数值;
- display_figure(Z0);
- }
- else if(j/1) //判断最高位是否为个位
- {
- Clrscreen_data(0x00,3,40,8);
- k=48;
- Z1=number/1;
- display_figure(Z1); //显示数据(switch...case)
- display(3,56,1,4,arrayadress0[0]); //小数点显示
- number=number-Z1*1;
- k+=12;
- Z1=number/0.1;
- display_figure(Z1);
- number=number-Z1*0.1;
- k+=8;
- Z1=number/0.01;
- display_figure(Z1);
- number=number-Z1*0.01;
- k+=8;
- Z1=number/0.001;
- display_figure(Z1);
- }
- else //显示小于1的数
- {
- Clrscreen_data(0x00,3,40,8);
- QU_ASCII(3,48,1,8,"0");
- display(3,56,1,4,arrayadress0[0]); //小数点显示
- k=60;
- Z2=number/0.1;
- display_figure(Z2);
- number=number-Z2*0.1;
- k+=8;
- Z2=number/0.01;
- display_figure(Z2);
- number=number-Z2*0.01;
- k+=8;
- Z2=number/0.001;
- display_figure(Z2);
- }
- }
- /*************************************************************************/
- void main()
- {
- signed char i,j;
- InitLCD();
- Clrscreen(0x00); //清屏
- InitJDQ(); //继电器初始化
- do
- {
- // W_G();
- for(i=96,j=0;i>=0,j<64;i--,j++)
- {
- display_GD(1,i,j,16,96,0,arrayadress2[0]); //水平滚动 欢迎使用
- delay1ms(50);
- }
- display_LM(3,23,80,16,arrayadress2[8]); //拉幕 数字万用表
- delay10ms(200);
- /**************************************************************************************************电阻测量/
- ***********************************************************************************************************/
- start_1:
- display_start(); //主屏显示
- start_1_0:
- do
- {
- // W_G();
- Clrscreen_data(0xff,0,0,48); //光标闪动
- delay10ms(43);
- display(0,0,4,12,arrayadress1[0]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1); //按键判断
- if(key_up==0) goto start_7_0; //光标上移
- else if(key_down==0) goto start_2_0; //光标下移
- else if(key_ok==0) //确认
- {
- RES:
- display_RES();
- RES_10:
- do
- {
- Clrscreen_data(0x00,2,4,20); //光标闪动
- delay10ms(43);
- display(2,6,2,8,arrayadress3[12]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1&key_back); //按键判断
- if(key_up==0) goto RES_10M_0; //光标上移
- else if(key_down==0) goto RES_100_0; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //当前阻值
- display(3,92,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x80); //相应继电器控制选择档位
- do
- {
- for(i=0;i<5;i++) //MAX111采集5次
- {
- number=duqudata0(1);
- N=N+number;
- }
- number=N/5; //求5次采集的平均值
- N=0;
- number=(40*number)/(0.65-number);
- display_dat(); //对采集数据的处理显示
- }while(key_back==1);
- send0(0x08); //关继电器
- goto RES;
- }
- else goto start_1;
- /*******************************************************************************************************/
- RES_100:
- display_RES();
- RES_100_0:
- do
- {
- Clrscreen_data(0x00,2,32,28); //光标闪动
- delay10ms(43);
- display(2,34,3,8,arrayadress3[16]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1&key_back); //按键判断
- if(key_up==0) goto RES_10; //光标上移
- else if(key_down==0) goto RES_1K_0; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //当前阻值
- display(3,92,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x81); //相应继电器控制选择档位
- do
- {
- for(i=0;i<5;i++) //MAX111采集5次
- {
- number=duqudata0(1);
- N=N+number;
- }
- number=N/5; //求5次采集的平均值
- N=0;
- number=(400*number)/(3.21-number);
- display_dat(); //对采集数据的处理显示
- }while(key_back==1);
- send0(0x08); //关继电器
- goto RES_100;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_1K:
- display_RES();
- RES_1K_0:
- do
- {
- Clrscreen_data(0x00,2,68,20); //光标闪动
- delay10ms(43);
- QU_ASCII(2,70,1,8,"1");
- display(2,78,1,8,arrayadress3[10]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1&key_back); //按键判断
- if(key_up==0) goto RES_100_0; //光标上移
- else if(key_down==0) goto RES_10K_0; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //当前阻值
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x82); //相应继电器控制选择档位
- do
- {
- for(i=0;i<5;i++) //MAX111采集5次
- {
- number=duqudata0(1);
- N=N+number;
- }
- number=N/5; //求5次采集的平均值
- N=0;
- number=(4*number)/(4.27-number); //1K
- display_dat(); //对采集数据的处理显示
- }while(key_back==1);
- send0(0x08); //关继电器
- goto RES_1K;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_10K:
- display_RES();
- RES_10K_0:
- do
- {
- Clrscreen_data(0x00,2,96,28); //光标闪动
- delay10ms(43);
- display(2,98,2,8,arrayadress3[12]);
- display(2,114,1,8,arrayadress3[10]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1&key_back); //按键判断
- if(key_up==0) goto RES_1K_0; //光标上移
- else if(key_down==0) goto RES_100K_0; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //当前阻值
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x83); //相应继电器控制选择档位
- do
- {
- for(i=0;i<5;i++) //MAX111采集5次
- {
- number=duqudata0(1);
- N=N+number;
- }
- number=N/5; //求5次采集的平均值
- N=0;
- number=(40*number)/(4.5-number);
- display_dat(); //对采集数据的处理显示
- }while(key_back==1);
- send0(0x08); //关继电器
- goto RES_10K;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_100K:
- display_RES();
- RES_100K_0:
- do
- {
- Clrscreen_data(0x00,4,4,36); //光标闪动
- delay10ms(43);
- display(4,6,3,8,arrayadress3[16]);
- display(4,30,1,8,arrayadress3[10]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1&key_back); //按键判断
- if(key_up==0) goto RES_10K_0; //光标上移
- else if(key_down==0) goto RES_1M_0; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //当前阻值
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x84); //相应继电器控制选择档位
- do
- {
- for(i=0;i<5;i++) //MAX111采集5次
- {
- number=duqudata0(1);
- N=N+number;
- }
- number=N/5; //求5次采集的平均值
- N=0;
- number=(400*number)/(4.67-number);
- display_dat(); //对采集数据的处理显示
- }while(key_back==1);
- send0(0x08); //关继电器
- goto RES_100K;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_1M:
- display_RES();
- RES_1M_0:
- do
- {
- Clrscreen_data(0x00,4,58,20); //光标闪动
- delay10ms(43);
- QU_ASCII(4,60,1,8,"1");
- display(4,68,1,8,arrayadress3[6]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1&key_back); //按键判断
- if(key_up==0) goto RES_100K_0; //光标上移
- else if(key_down==0) goto RES_10M_0; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //当前阻值
- display(3,92,1,8,arrayadress3[6]); //M
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x85); //相应继电器控制选择档位
- do
- {
- for(i=0;i<5;i++) //MAX111采集5次
- {
- number=duqudata0(1);
- N=N+number;
- }
- number=N/5; //求5次采集的平均值
- N=0;
- number=(4*number)/(4.82-number);
- display_dat(); //对采集数据的处理显示
- }while(key_back==1);
- send0(0x08); //关继电器
- goto RES_1M;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_10M:
- display_RES();
- RES_10M_0:
- do
- {
- Clrscreen_data(0x00,4,96,28); //光标闪动
- delay10ms(43);
- display(4,98,2,8,arrayadress3[12]);
- display(4,114,1,8,arrayadress3[6]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1&key_back); //按键判断
- if(key_up==0) goto RES_1M_0; //光标上移
- else if(key_down==0) goto RES_10; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //当前阻值
- display(3,92,1,8,arrayadress3[6]); //M
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x86); //相应继电器控制选择档位
- do
- {
- for(i=0;i<5;i++) //MAX111采集5次
- {
- number=duqudata0(1);
- N=N+number;
- }
- number=N/5; //求5次采集的平均值
- N=0;
- number=(40*number)/(5.55-number);
- display_dat(); //对采集数据的处理显示
- }while(key_back==1);
- send0(0x08); //关继电器
- goto RES_10M;
- }
- else goto start_1;
- }
- /*************************************************************************************************/
- /**************************************************************************************************短路检测/
- ***********************************************************************************************************/
- start_2:
- display_start();
- start_2_0:
- do
- {
- // W_G();
- Clrscreen_data(0xff,2,0,48); //光标闪动
- delay10ms(43);
- display(2,0,4,12,arrayadress1[8]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1); //按键判断
- if(key_up==0) goto start_1_0; //光标上移
- else if(key_down==0) goto start_3_0; //光标下移
- else if(key_ok==0) //确认
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[40]); //线路状态
- biaoge();
- do
- {
- R_10:
- do
- {
- send0(0x80);
- numb=duqudata3(1);
- if(numb<1)
- {
- send0(0xc0); //蜂鸣器响
- number=(40*numb)/(0.65-numb);
- display_dat();
- display(3,92,1,16,arrayadress6[0]);
- Clrscreen_data(0x00,3,109,18);
- }
- else goto R_100;
- }while(numb<1&key_back==1);
- send0(0x00); //关继电器
- goto start_2;
- R_100:
- do
- {
- send0(0x81);
- numb=duqudata3(1);
- if(numb<1)
- {
- if(numb<0.5) goto R_10;
- else
- send0(0xc1); //蜂鸣器响
- number=(400*numb)/(3.21-numb);
- display_dat();
- display(3,92,1,16,arrayadress6[0]);
- Clrscreen_data(0x00,3,109,18);
- }
- else goto R_1K;
- }while(numb<1&key_back==1);
- send0(0x00); //关继电器
- goto start_2;
- R_1K:
- do
- {
- send0(0x82);
- numb=duqudata3(1);
- if(numb<1)
- {
- if(numb<0.5) goto R_100;
- else
- number=(4*numb)/(4.27-numb);
- display_dat();
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- }
- else goto R_10K;
- }while(numb<1&key_back==1);
- send0(0x00); //关继电器
- goto start_2;
- R_10K:
- do
- {
- send0(0x83);
- numb=duqudata3(1);
- if(numb<1)
- {
- if(numb<0.5) goto R_1K;
- else
- number=(40*numb)/(4.5-numb);
- display_dat();
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- }
- else goto R_100K;
- }while(numb<1&key_back==1);
- send0(0x00); //关继电器
- goto start_2;
- R_100K:
- do
- {
- send0(0x84);
- numb=duqudata3(1);
- if(numb<1)
- {
- if(numb<0.5) goto R_10K;
- else
- number=(400*numb)/(4.67-numb);
- display_dat();
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- }
- else goto R_1M;
- }while(numb<1&key_back==1);
- send0(0x00); //关继电器
- goto start_2;
- R_1M:
- do
- {
- send0(0x85);
- numb=duqudata3(1);
- if(numb<1)
- {
- if(numb<0.5) goto R_100K;
- else
- number=(4*numb)/(4.82-numb);
- display_dat();
- display(3,92,1,8,arrayadress3[6]); //M
- display(3,100,1,16,arrayadress6[0]); //Ω
- }
- else goto R_10M;
- }while(numb<1&key_back==1);
- send0(0x00); //关继电器
- goto start_2;
- R_10M:
- do
- {
- send0(0x86);
- numb=duqudata3(1);
- if(numb<1)
- {
- if(numb<0.5) goto R_1M;
- else
- number=(40*numb)/(5.55-numb);
- display_dat();
- display(3,92,1,8,arrayadress3[6]); //M
- display(3,100,1,16,arrayadress6[0]); //Ω
- }
- else
- {
- Clrscreen_data(0x00,3,30,18);
- QU_ASCII(3,48,1,8,"0");
- display(3,56,1,4,arrayadress0[0]); //小数点显示
- QU_ASCII(3,60,1,8,"0");
- QU_ASCII(3,68,1,8,"0");
- QU_ASCII(3,76,1,8,"0");
- Clrscreen_data(0x00,3,84,42);
- }
- }while(numb<1&key_back==1);
- }while(key_back==1);
- send0(0x00); //关继电器
- goto start_2;
- }
- /**********************************************************************************************直流电压测量/
- ***********************************************************************************************************/
- start_3:
- display_start();
- start_3_0:
- do
- {
- // W_G();
- Clrscreen_data(0xff,4,0,72); //光标闪动
- delay10ms(43);
- display(4,0,6,12,arrayadress1[16]);
- delay10ms(100);
- }while(key_up==1&key_down==1&key_ok==1); //按键判断
- if(key_up==0) goto start_2_0; //光标上移
- else if(key_down==0) goto start_4_0; //光标下移
- else if(key_ok==0) //确认
- {
- VOL:
- display_VOL();
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
(数字万用表)程序.zip
(169.93 KB, 下载次数: 57)
|