16路電壓檢測(cè)程序_第1頁
16路電壓檢測(cè)程序_第2頁
16路電壓檢測(cè)程序_第3頁
16路電壓檢測(cè)程序_第4頁
16路電壓檢測(cè)程序_第5頁
免費(fèi)預(yù)覽已結(jié)束,剩余1頁可下載查看

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、#include #include #define uint unsigned int #define uchar unsigned char #define ulong unsigned long #define addo (5.0/65535.0) sbit E=P2A0; sbit RW=P2A1; sbit RS=P2A2; sbit SDO=P2A3; sbit SCK=P2A4; sbit CONV=P2A5; sbit CS1=P2A6; sbit CS2=P2A7; uchar code num= 0 x00,0 xE0,0 x10,0 x08,0 x08,0 x10,0 xE

2、0,0 x00,0 x00,0 x0F,0 x10,0 x20,0 x20,0 x10,0 x0F,0 x00,/*0,0* / 0 x00,0 x10,0 x10,0 xF8,0 x00,0 x00,0 x00,0 x00,0 x00,0 x20,0 x20,0 x3F,0 x20,0 x20,0 x00,0 x00,/*1,1* / 0 x00,0 x70,0 x08,0 x08,0 x08,0 x88,0 x70,0 x00,0 x00,0 x30,0 x28,0 x24,0 x22,0 x21,0 x30,0 x00,/*2,2* / 0 x00,0 x30,0 x08,0 x88,0

3、 x88,0 x48,0 x30,0 x00,0 x00,0 x18,0 x20,0 x20,0 x20,0 x11,0 x0E,0 x00,/*3,3* / 0 x00,0 x00,0 xC0,0 x20,0 x10,0 xF8,0 x00,0 x00,0 x00,0 x07,0 x04,0 x24,0 x24,0 x3F,0 x24,0 x00,/*4,4* / 0 x00,0 xF8,0 x08,0 x88,0 x88,0 x08,0 x08,0 x00,0 x00,0 x19,0 x21,0 x20,0 x20,0 x11,0 x0E,0 x00,/*5,5* / 0 x00,0 xE

4、0,0 x10,0 x88,0 x88,0 x18,0 x00,0 x00,0 x00,0 x0F,0 x11,0 x20,0 x20,0 x11,0 x0E,0 x00,/*6,6* / 0 x00,0 x38,0 x08,0 x08,0 xC8,0 x38,0 x08,0 x00,0 x00,0 x00,0 x00,0 x3F,0 x00,0 x00,0 x00,0 x00,/*7,7* / 0 x00,0 x70,0 x88,0 x08,0 x08,0 x88,0 x70,0 x00,0 x00,0 x1C,0 x22,0 x21,0 x21,0 x22,0 x1C,0 x00,/*8,

5、8 */ 0 x00,0 xE0,0 x10,0 x08,0 x08,0 x10,0 xE0,0 x00,0 x00,0 x00,0 x31,0 x22,0 x22,0 x11,0 x0F,0 x00,/*9,9* / 0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x30,0 x30,0 x00,0 x00,0 x00,0 x00,0 x00,/*.,A* / ; uchar code Hz= 0 x00,0 x04,0 x04,0 xF4,0 x94,0 x94,0 x9C,0 x97,0 x94,0 x94,0 x94,0

6、xF4,0 x04,0 x04,0 x00,0 x00, 0 x40,0 x40,0 x40,0 x7F,0 x4A,0 x4A,0 x4A,0 x4A,0 x4A,0 x4A,0 x4A,0 x7F,0 x40,0 x40,0 x40,0 x00,/* 直,0*/ 0 x10,0 x60,0 x01,0 x86,0 x60,0 x04,0 x44,0 x64,0 x55,0 x4E,0 x44,0 x64,0 xC4,0 x04,0 x04,0 x00, 0 x04,0 x04,0 xFC,0 x03,0 x40,0 x30,0 x0F,0 x00,0 x00,0 x7F,0 x00,0 x

7、3F,0 x40,0 x40,0 x70,0 x00,/* 0 x40,0 x20,0 xF8,0 x17,0 x02,0 xFE,0 x02,0 xF2,0 x02,0 xFE,0 x00,0 xF8,0 x00,0 xFF,0 x00,0 x00, 0 x00,0 x00,0 x7F,0 x40,0 x20,0 x13,0 x0C,0 x03,0 x04,0 x3B,0 x10,0 x27,0 x40,0 x3F,0 x00,0 x00,/* 0 x00,0 x00,0 xF8,0 x48,0 x48,0 x48,0 x48,0 xFF,0 x48,0 x48,0 x48,0 x48,0

8、xF8,0 x00,0 x00,0 x00, 0 x00,0 x00,0 x0F,0 x04,0 x04,0 x04,0 x04,0 x3F,0 x44,0 x44,0 x44,0 x44,0 x4F,0 x40,0 x70,0 x00,/* 0 x00,0 x00,0 xFE,0 x02,0 x42,0 x42,0 x42,0 x42,0 xFA,0 x42,0 x42,0 x42,0 x62,0 x42,0 x02,0 x00, 0 x20,0 x18,0 x27,0 x20,0 x20,0 x20,0 x20,0 x20,0 x3F,0 x20,0 x21,0 x2E,0 x24,0 x

9、20,0 x20,0 x00,/* ,4*/ ; void delay_1ms(uint z)/延時(shí)子程序 uint x,y; for(x=0;xz;x+) for(y=0;y110;y+); void checkbusy12864(void)/ 判忙 uchar dat; EX0=0; /寫數(shù)據(jù) /寫命令 void clear12864(void) /清屏 uchar page,row; for(page=0 xb8;page0 xc0;page+) cmd_w12864(page); cmd_w12864(0 x40); RS=0; RW=1; do P0=0 x00; E=1; dat=

10、P0 E=0; while(dat!=0 x00); EX0=1; void dat_w12864(uchar dat) checkbusy12864(); EX0=0; RS=1; RW=0; E=1; P0=dat; E=0; EX0=1; void cmd_w12864(uchar cmd) checkbusy12864(); EX0=0; RS=0; RW=0; E=1; P0=cmd; E=0; EX0=1; for(row=0;row64;row+) dat_w12864(0 x00); void choose12864(uchar i) switch(i) case 0: CS1

11、=0; CS2=1; break; case 1: CS1=1; CS2=0; break; case 2: CS1=0; CS2=0; break; default: break; /選屏,i是要寫的屏,0是左屏,1是右屏,2是雙屏。 void init12864(void) checkbusy12864(); cmd_w12864(0 xc0); cmd_w12864(0 x3f); /初始化 /從第零行開始顯示 /LCD 顯示 RAM 中的內(nèi)容 /8*8 字符顯示 void play8(uchar ch,uchar row,uchar page,uchar number) uint i;

12、 choose12864(ch); page=page1; row=row3; cmd_w12864(row+0 x40); cmd_w12864(page+0 xb8); for(i=0;i8;i+) dat_w12864(numi+16*number); cmd_w12864(row+0 x40); cmd_w12864(page+0 xb9); for(i=0;i8;i+) dat_w12864(numi+16*number+8); void play16(uchar ch,uchar row,uchar page,uchar number)/16*16 字符顯示 uint i; cho

13、ose12864(ch); page=page1; row=row3; cmd_w12864(row+0 x40); cmd_w12864(page+0 xb8); for(i=0;i16;i+) dat_w12864(Hzi+32*number); cmd_w12864(row+0 x40); cmd_w12864(page+0 xb9); for(i=0;i16;i+) dat_w12864(Hzi+32*number+16); arrange 頁 uchar dat_r12864(uchar page,uchar arrange)/讀數(shù)據(jù), page 頁地址, 地址 uchar dat;

14、 checkbusy12864(); cmd_w12864(page+0 xb8); cmd_w12864(arrange+0 x40); EX0=0; P0=0 xff; RW=1; RS=1; E=1; E=0; E=1; dat=P0; E=0; return(dat); EX0=1; uint LTC1864_READ() uchar i; uint temp = 0; CONV = 0; CONV = 1; _nop_();_nop_();_nop_(); CONV = 0; SDO = 1; for(i=0;i16;i+) SCK = 1; _nop_(); SCK = 0; _nop_(); temp = 1; if(SDO=1) temp |= 0 x0001; CONV = 1; return temp; void main() uchar a,b,c,d,i; uint temp; choose12864(2); init12864(); clear12864(); while(1) LTC1864_READ(); for(i=0;i4

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論