版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、單片機(jī)12864動(dòng)態(tài)波形顯示單片機(jī)12864動(dòng)態(tài)波形顯示 編輯整理:尊敬的讀者朋友們:這里是精品文檔編輯中心,本文檔內(nèi)容是由我和我的同事精心編輯整理后發(fā)布的,發(fā)布之前我們對(duì)文中內(nèi)容進(jìn)行仔細(xì)校對(duì),但是難免會(huì)有疏漏的地方,但是任然希望(單片機(jī)12864動(dòng)態(tài)波形顯示)的內(nèi)容能夠給您的工作和學(xué)習(xí)帶來(lái)便利。同時(shí)也真誠(chéng)的希望收到您的建議和反饋,這將是我們進(jìn)步的源泉,前進(jìn)的動(dòng)力。本文可編輯可修改,如果覺(jué)得對(duì)您有幫助請(qǐng)收藏以便隨時(shí)查閱,最后祝您生活愉快 業(yè)績(jī)進(jìn)步,以下為單片機(jī)12864動(dòng)態(tài)波形顯示的全部?jī)?nèi)容。/* 描述: 12864標(biāo)準(zhǔn)字庫(kù)液晶演示 數(shù)據(jù)p0,控制p2 */include include ma
2、th.hinclude intrins.h#define uchar unsigned char#define uint unsigned int/* 12864lcd引腳定義 */define lcd_data p0 /數(shù)據(jù)口sbit lcd_rs = p26; /寄存器選擇輸入 sbit lcd_rw = p25; /液晶讀/寫(xiě)控制sbit lcd_en = p27; /液晶使能控制sbit lcd_psb = p32; /串/并方式控制sbit lcd_rst = p37; /液晶復(fù)位端口define delaynop(); _nop_();_nop_();_nop_();_nop_()
3、;;/*/uchar code dis1 = vpp:;uchar code dis2 = f:;uchar dis3 = ”5v;uchar dis4 = ”12hz”;uchar d1=”0123456789”;/*/正弦波代碼uchar code tab=126,100,80,70,65,62,65,70,80,100,126,152,172,182,187,190,187,182,172,152;/背景圖片uchar code photo1=0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x0
4、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
5、0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
6、0,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x0
7、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x0
8、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
9、0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
10、0,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x0
11、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x0
12、0,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
13、0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
14、0,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x0
15、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x0
16、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
17、0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
18、0,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x0
19、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x0
20、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00;/*/*/* / 延時(shí)函數(shù) */ /*/void delay(int ms) while(ms) ucha
21、r i; for(i=0;i150;i+) _nop_(); _nop_();_nop_();_nop_(); /*/* */ 延時(shí)函數(shù) /* /*/void delay1(int ms) while(ms-) uchar y; for(y=0;y100;y+) ; /*/* */*檢查lcd忙狀態(tài) /lcd_busy為1時(shí),忙,等待。lcdbusy為0時(shí),閑,可寫(xiě)指令與數(shù)據(jù)。 */ */*/bit lcd_busy() bit result; lcd_rs = 0; lcd_rw = 1; lcd_en = 1; delaynop(); result = (bit)(p00x80); lcd
22、_en = 0; return(result); /*/* */寫(xiě)指令數(shù)據(jù)到lcd */*rs=l,rw=l,e=高脈沖,d0d7=指令碼。 */ /*/void lcd_wcmd(uchar cmd) while(lcd_busy()); lcd_rs = 0; lcd_rw = 0; lcd_en = 0; _nop_(); _nop_(); p0 = cmd; delaynop(); lcd_en = 1; delaynop(); lcd_en = 0; /*/ /*寫(xiě)顯示數(shù)據(jù)到lcd */rs=h,rw=l,e=高脈沖,d0d7=數(shù)據(jù). */* /*/void lcd_wdat(uch
23、ar dat) while(lcd_busy()); lcd_rs = 1; lcd_rw = 0; lcd_en = 0; p0 = dat; delaynop(); lcd_en = 1; delaynop(); lcd_en = 0; /*讀數(shù)據(jù)*/unsigned char readdata(void)unsigned char rdata;while(lcd_busy();p0=0xff;lcd_rs=1;lcd_rw=1;lcd_en=0;lcd_en=1;rdata=p0;/rdata=dataport;lcd_en=0;return rdata;/*/ /* lcd初始化設(shè)定
24、*/* */*/void lcd_init() lcd_psb = 1; /并口方式 lcd_rst = 0; /液晶復(fù)位 delay(2); lcd_rst = 1; delay(2); lcd_wcmd(0x34); /擴(kuò)充指令操作 delay(5); lcd_wcmd(0x30); /基本指令操作 delay(5); lcd_wcmd(0x0c); /顯示開(kāi),關(guān)光標(biāo) delay(5); lcd_wcmd(0x01); /清除lcd的顯示內(nèi)容 delay(5);/*/ */* 設(shè)定顯示位置 */* /*/void lcd_pos(uchar x,uchar y) uchar pos; if
25、 (x=1) x=0x80; else if (x=2) x=0x90; else if (x=3) x=0x88; else if (x=4) x=0x98; pos = x+y ; lcd_wcmd(pos); /顯示地址/* * 圖形顯示 */void photodisplay(uchar *bmp) uchar i,j; lcd_wcmd(0x34); /寫(xiě)數(shù)據(jù)時(shí),關(guān)閉圖形顯示 for(i=0;i32;i+) lcd_wcmd(0x80+i); /先寫(xiě)入水平坐標(biāo)值 lcd_wcmd(0x80); /寫(xiě)入垂直坐標(biāo)值 for(j=0;j16;j+) /再寫(xiě)入兩個(gè)8位元的數(shù)據(jù) lcd_wda
26、t(bmp+); delay1(1); for(i=0;i32;i+) lcd_wcmd(0x80+i); lcd_wcmd(0x88); for(j=0;j(i*4))(a=((i+1)*4)break;return i;/*函數(shù)名: drawpoint函數(shù)說(shuō)明:畫(huà)點(diǎn)傳入?yún)?shù):打點(diǎn)位置(x0,y0);color=1,點(diǎn)亮;color=0,擦除傳出參數(shù):無(wú)返回值: 無(wú)*/void drawpoint(unsigned char x,unsigned char y,unsigned char color)unsigned char row,collum,cbite;unsigned char t
27、emph,templ;lcd_wcmd(0x34); /設(shè)置擴(kuò)充指令集,關(guān)閉繪圖lcd_wcmd(0x36); /擴(kuò)充指令集,打開(kāi)繪圖collum=x4; /列 左移四位cbite=x0x0f;if(y32)row=y;elserow=y32;collum+=8;lcd_wcmd(0x80+row);lcd_wcmd(0x80+collum);readdata();temph=readdata();templ=readdata();lcd_wcmd(0x80+row);lcd_wcmd(0x80+collum);if (color)if(cbite8)temph|=(1(7cbite));/t
28、empl=(1(7-cbite);else/temph=(1(15cbite);templ|=(1(15cbite));elseif(cbite8)temph&=(1(7-cbite);/templ=(1(7-cbite));else/temph=(1(15-cbite));templ&=(1 y1 ) temp = y1 ; y1 = y0 ; y0 = temp ; for(; y0 = y1 ; y0+) drawpoint( x, y0,1);/*任意兩點(diǎn)畫(huà)直線*/void w_line( unsigned char startx, unsigned char starty, unsi
29、gned char endx, unsigned char endy) signed int t, distance; /根據(jù)屏幕大小改變變量類型(如改為int型)/ signed int x = 0 , y = 0 , delta_x, delta_y ; signed char incx, incy ; delta_x = endx startx ; delta_y = endy starty ; if( delta_x 0 ) incx = 1; else if( delta_x = 0 ) w_liney( startx, starty, endy ) ; return ; else incx = 1 ; if( delta_y 0 ) incy = 1 ; else if(delta_y = 0 ) w_linex( startx, endx, starty ) ; return ; else incy = -1
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年中圖版七年級(jí)化學(xué)下冊(cè)階段測(cè)試試卷含答案
- 二零二五年度環(huán)境保護(hù)設(shè)施運(yùn)行管理驗(yàn)收合同3篇
- 實(shí)習(xí)報(bào)告機(jī)械專業(yè)
- 2025年教科新版必修3物理上冊(cè)階段測(cè)試試卷
- 2025年人教新課標(biāo)七年級(jí)科學(xué)上冊(cè)月考試卷含答案
- 2025年北師大版高三生物下冊(cè)階段測(cè)試試卷含答案
- 2024年黃浦區(qū)中西醫(yī)結(jié)合醫(yī)院高層次衛(wèi)技人才招聘筆試歷年參考題庫(kù)頻考點(diǎn)附帶答案
- 2025年西師新版三年級(jí)語(yǔ)文上冊(cè)階段測(cè)試試卷含答案
- 2025年滬教版七年級(jí)數(shù)學(xué)下冊(cè)月考試卷含答案
- 2024版家電家具采購(gòu)合同
- 山西省2024年中考物理試題(含答案)
- 矯形器師(三級(jí))試題
- 2024-2030年中國(guó)硅氧負(fù)極材料行業(yè)競(jìng)爭(zhēng)狀況與發(fā)展形勢(shì)預(yù)測(cè)報(bào)告
- 2025屆天津市河西區(qū)物理高一第一學(xué)期期末檢測(cè)試題含解析
- 登高車高空作業(yè)施工方案
- 2024年廣東揭陽(yáng)市揭西縣集中招聘事業(yè)單位人員85人歷年高頻考題難、易錯(cuò)點(diǎn)模擬試題(共500題)附帶答案詳解
- 豬肉配送投標(biāo)方案(技術(shù)方案)
- 財(cái)務(wù)盡職調(diào)查資料清單-立信
- 2024至2030年中國(guó)柔性電路板(FPC)行業(yè)市場(chǎng)深度分析及發(fā)展趨勢(shì)預(yù)測(cè)報(bào)告
- IGCSE考試練習(xí)冊(cè)附答案
- 小學(xué)三年級(jí)下一字多義(答案)
評(píng)論
0/150
提交評(píng)論