|
用12864液晶屏來顯示的單片機(jī)數(shù)字萬用表制作資料,菜單顯示處理很經(jīng)典:
0.png (62.49 KB, 下載次數(shù): 79)
下載附件
2017-7-4 21:48 上傳
單片機(jī)源程序如下:
- /************************************************************************************************
- 控制說明:
- 電阻測量: 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);
- 注:初始化時(shí)要全部處于非工作狀態(tài)<send0(0x08) send1(0x00) send2(0x00)>使用時(shí)選擇相應(yīng)指令,返回時(shí)關(guān)斷.
- *************************************************************************************************/
- #include <reg52.h>
- #include <stdio.h>
- #include <intrins.h>
- #include <string.h>
- #include <math.h>
- #include "ziku.h" //字庫
- sbit key_up = P3^2; //光標(biāo)上移按鍵
- sbit key_down = P3^3; //光標(biāo)下移按鍵
- sbit key_ok = P3^4; //確定按鍵
- sbit key_back = P3^5; //退出按鍵
- sbit ZLDL = P3^0; //
- /*** 利用二維數(shù)組存放字模 ***/
- 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];
- /***** 函數(shù)聲明 *****/
- extern void InitLCD(); //液晶初始化函數(shù)
- extern void delay1ms(unsigned char x); //延時(shí)1ms函數(shù)
- extern void delay10ms(unsigned char x); //延時(shí)10ms函數(shù)
- extern void biaoge(); //畫表格函數(shù)
- extern void Clrscreen(unsigned char m); //送指定數(shù)據(jù)函數(shù)
- extern double duqudata0(unsigned char i); //采集數(shù)據(jù)函數(shù)
- extern double duqudata1_1(unsigned char i); //采集數(shù)據(jù)函數(shù)
- extern double duqudata1_2(unsigned char i); //采集數(shù)據(jù)函數(shù)
- extern double duqudata1_3(unsigned char i); //采集數(shù)據(jù)函數(shù)
- extern double duqudata2(unsigned char i); //采集數(shù)據(jù)函數(shù)
- extern double duqudata3(unsigned char i); //采集數(shù)據(jù)函數(shù)
- extern void send0(unsigned char abc); //串口發(fā)送子函數(shù)(控制電阻檔)
- extern void send1(unsigned char abc); //模擬串口發(fā)送子函數(shù)(控制電壓檔)
- extern void send2(unsigned char abc); //模擬串口發(fā)送子函數(shù)(控制電壓檔)
- extern void Clrscreen_ge(unsigned char dat,unsigned char layer,unsigned char column,unsigned char whidth); //送固定數(shù)據(jù)\畫表格
- extern void Clrscreen_data(unsigned char dat,unsigned char layer,unsigned char column,unsigned char whidth); //送固定數(shù)據(jù)函數(shù)
- 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); //移動(dòng)顯示函數(shù)
- extern void display(unsigned char layer,unsigned char column,unsigned char whidth,unsigned char daxiao,unsigned char *china_code); //隨意顯示函數(shù)
- 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); //動(dòng)態(tài)數(shù)字顯示
- void InitJDQ(); //初始化繼電器
- void display_start(); //開屏顯示內(nèi)容
- void display_RES(); //進(jìn)入電阻檔顯示界面
- void display_VOL(); //進(jìn)入電壓檔顯示界面
- void display_GAL(); //進(jìn)入電流檔顯示界面
- void display_figure(unsigned char i); //采集處理的數(shù)字顯示
- void display_dat(); //采集數(shù)據(jù)處理顯示
- /**** 全局變量定義 ****/
- 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() //開屏顯示內(nèi)容
- *********************************************************************************************************/
- 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() //進(jìn)入電阻檔顯示界面
- *********************************************************************************************************/
- void display_RES()
- {
- Clrscreen(0x00);
- display(0,0,6,12,arrayadress7[0]); //請選擇檔位:
- display(6,32,8,12,arrayadress7[12]); //選擇后請按確認(rèn)鍵
- 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() //進(jìn)入電壓檔顯示界面
- ***********************************************************************************************************/
- void display_VOL()
- {
- Clrscreen(0x00);
- display(0,0,6,12,arrayadress7[0]); //請選擇檔位:
- display(6,32,8,12,arrayadress7[12]); //選擇后請按確認(rèn)鍵
- 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() //進(jìn)入電流檔顯示界面
- ******************************************************************************************************/
- void display_GAL()
- {
- Clrscreen(0x00);
- display(0,0,6,12,arrayadress7[0]); //請選擇檔位:
- display(6,32,8,12,arrayadress7[12]); //選擇后請按確認(rèn)鍵
- 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() //采集處理數(shù)字顯示
- *******************************************************************************************************/
- 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() //采集數(shù)據(jù)處理顯示
- *******************************************************************************************************/
- void display_dat()
- {
- unsigned char j;
- j=number;
- if(j/100) //判斷最高位是否為十位
- {
- k=32; //全局變量K(顯示起始列)的賦值
- Z0=number/100; //取十位上的數(shù)值
- display_figure(Z0); //顯示數(shù)據(jù)(switch...case)
- number=number-Z0*100; //減掉十位數(shù)據(jù)
- k+=8;
- Z0=number/10; //取十位上的數(shù)值
- display_figure(Z0); //顯示數(shù)據(jù)(switch...case)
- number=number-Z0*10; //減掉十位數(shù)據(jù)
- k+=8; //列地址加八
- Z0=number/1; //取個(gè)位數(shù)值
- display_figure(Z0); //顯示數(shù)據(jù)(switch...case)
- display(3,56,1,4,arrayadress0[0]); //小數(shù)點(diǎn)顯示
- number=number-Z0*1; //減掉個(gè)位數(shù)據(jù)
- k+=12;
- Z0=number/0.1; //取小數(shù)點(diǎn)后第一位的數(shù)值
- display_figure(Z0);
- number=number-Z0*0.1;
- k+=8;
- Z0=number/0.01; //取小數(shù)點(diǎn)后第二位的數(shù)值
- display_figure(Z0);
- number=number-Z0*0.01;
- k+=8;
- Z0=number/0.001; //取小數(shù)點(diǎn)后第三位的數(shù)值;
- display_figure(Z0);
- }
- else if(j/10) //判斷最高位是否為十位
- {
- Clrscreen_data(0x00,3,32,8);
- k=40; //全局變量K(顯示起始列)的賦值
- Z0=number/10; //取十位上的數(shù)值
- display_figure(Z0); //顯示數(shù)據(jù)(switch...case)
- number=number-Z0*10; //減掉十位數(shù)據(jù)
- k+=8; //列地址加八
- Z0=number/1; //取個(gè)位數(shù)值
- display_figure(Z0); //顯示數(shù)據(jù)(switch...case)
- display(3,56,1,4,arrayadress0[0]); //小數(shù)點(diǎn)顯示
- number=number-Z0*1; //減掉個(gè)位數(shù)據(jù)
- k+=12;
- Z0=number/0.1; //取小數(shù)點(diǎn)后第一位的數(shù)值
- display_figure(Z0);
- number=number-Z0*0.1;
- k+=8;
- Z0=number/0.01; //取小數(shù)點(diǎn)后第二位的數(shù)值
- display_figure(Z0);
- number=number-Z0*0.01;
- k+=8;
- Z0=number/0.001; //取小數(shù)點(diǎn)后第三位的數(shù)值;
- display_figure(Z0);
- }
- else if(j/1) //判斷最高位是否為個(gè)位
- {
- Clrscreen_data(0x00,3,40,8);
- k=48;
- Z1=number/1;
- display_figure(Z1); //顯示數(shù)據(jù)(switch...case)
- display(3,56,1,4,arrayadress0[0]); //小數(shù)點(diǎn)顯示
- 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的數(shù)
- {
- Clrscreen_data(0x00,3,40,8);
- QU_ASCII(3,48,1,8,"0");
- display(3,56,1,4,arrayadress0[0]); //小數(shù)點(diǎn)顯示
- 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]); //水平滾動(dòng) 歡迎使用
- delay1ms(50);
- }
- display_LM(3,23,80,16,arrayadress2[8]); //拉幕 數(shù)字萬用表
- delay10ms(200);
- /**************************************************************************************************電阻測量/
- ***********************************************************************************************************/
- start_1:
- display_start(); //主屏顯示
- start_1_0:
- do
- {
- // W_G();
- Clrscreen_data(0xff,0,0,48); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto start_2_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- RES:
- display_RES();
- RES_10:
- do
- {
- Clrscreen_data(0x00,2,4,20); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto RES_100_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //當(dāng)前阻值
- display(3,92,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x80); //相應(yīng)繼電器控制選擇檔位
- 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(); //對采集數(shù)據(jù)的處理顯示
- }while(key_back==1);
- send0(0x08); //關(guān)繼電器
- goto RES;
- }
- else goto start_1;
- /*******************************************************************************************************/
- RES_100:
- display_RES();
- RES_100_0:
- do
- {
- Clrscreen_data(0x00,2,32,28); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto RES_1K_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //當(dāng)前阻值
- display(3,92,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x81); //相應(yīng)繼電器控制選擇檔位
- 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(); //對采集數(shù)據(jù)的處理顯示
- }while(key_back==1);
- send0(0x08); //關(guān)繼電器
- goto RES_100;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_1K:
- display_RES();
- RES_1K_0:
- do
- {
- Clrscreen_data(0x00,2,68,20); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto RES_10K_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //當(dāng)前阻值
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x82); //相應(yīng)繼電器控制選擇檔位
- 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(); //對采集數(shù)據(jù)的處理顯示
- }while(key_back==1);
- send0(0x08); //關(guān)繼電器
- goto RES_1K;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_10K:
- display_RES();
- RES_10K_0:
- do
- {
- Clrscreen_data(0x00,2,96,28); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto RES_100K_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //當(dāng)前阻值
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x83); //相應(yīng)繼電器控制選擇檔位
- 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(); //對采集數(shù)據(jù)的處理顯示
- }while(key_back==1);
- send0(0x08); //關(guān)繼電器
- goto RES_10K;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_100K:
- display_RES();
- RES_100K_0:
- do
- {
- Clrscreen_data(0x00,4,4,36); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto RES_1M_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //當(dāng)前阻值
- display(3,92,1,8,arrayadress3[10]); //K
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x84); //相應(yīng)繼電器控制選擇檔位
- 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(); //對采集數(shù)據(jù)的處理顯示
- }while(key_back==1);
- send0(0x08); //關(guān)繼電器
- goto RES_100K;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_1M:
- display_RES();
- RES_1M_0:
- do
- {
- Clrscreen_data(0x00,4,58,20); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto RES_10M_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //當(dāng)前阻值
- display(3,92,1,8,arrayadress3[6]); //M
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x85); //相應(yīng)繼電器控制選擇檔位
- 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(); //對采集數(shù)據(jù)的處理顯示
- }while(key_back==1);
- send0(0x08); //關(guān)繼電器
- goto RES_1M;
- }
- else goto start_1;
- /*************************************************************************************************/
- RES_10M:
- display_RES();
- RES_10M_0:
- do
- {
- Clrscreen_data(0x00,4,96,28); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto RES_10; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[0]); //當(dāng)前阻值
- display(3,92,1,8,arrayadress3[6]); //M
- display(3,100,1,16,arrayadress6[0]); //Ω
- biaoge();
- send0(0x86); //相應(yīng)繼電器控制選擇檔位
- 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(); //對采集數(shù)據(jù)的處理顯示
- }while(key_back==1);
- send0(0x08); //關(guān)繼電器
- goto RES_10M;
- }
- else goto start_1;
- }
- /*************************************************************************************************/
- /**************************************************************************************************短路檢測/
- ***********************************************************************************************************/
- start_2:
- display_start();
- start_2_0:
- do
- {
- // W_G();
- Clrscreen_data(0xff,2,0,48); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto start_3_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- Clrscreen(0x00); //清屏
- display(1,6,5,16,arrayadress4[40]); //線路狀態(tài)
- 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); //關(guān)繼電器
- 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); //關(guān)繼電器
- 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); //關(guān)繼電器
- 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); //關(guān)繼電器
- 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); //關(guān)繼電器
- 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); //關(guān)繼電器
- 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]); //小數(shù)點(diǎn)顯示
- 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); //關(guān)繼電器
- goto start_2;
- }
- /**********************************************************************************************直流電壓測量/
- ***********************************************************************************************************/
- start_3:
- display_start();
- start_3_0:
- do
- {
- // W_G();
- Clrscreen_data(0xff,4,0,72); //光標(biāo)閃動(dòng)
- 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; //光標(biāo)上移
- else if(key_down==0) goto start_4_0; //光標(biāo)下移
- else if(key_ok==0) //確認(rèn)
- {
- VOL:
- display_VOL();
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
(數(shù)字萬用表)程序.zip
(169.93 KB, 下載次數(shù): 57)
2017-7-4 18:08 上傳
點(diǎn)擊文件名下載附件
程序詳細(xì) 下載積分: 黑幣 -5
|
|