NHC-36彩色液晶顯示控制模塊使用說明2_第1頁
NHC-36彩色液晶顯示控制模塊使用說明2_第2頁
NHC-36彩色液晶顯示控制模塊使用說明2_第3頁
NHC-36彩色液晶顯示控制模塊使用說明2_第4頁
NHC-36彩色液晶顯示控制模塊使用說明2_第5頁
已閱讀5頁,還剩18頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

NHC_36彩色液晶顯示控制模塊使用說明NHC_36型顯示控制模塊的特點。A:安裝方便,板尺寸為168mm╳116mm,安裝孔Ф3mm,四個安裝孔位置為1B:微處理器可以隨時讀寫顯示存儲器,而不影響顯示效果,即顯示不會出現(xiàn)“雪花”。C:與微處理器接口連接簡單,接口的讀、寫操作兼容8031總線時序。D:有兩頁顯示緩存,可以任意設(shè)定顯示頁和操作頁。二、物理特性:NO。ItemSpecificationRemark1DisplayResolution(dot)480(W)*234(H)2Activearea(mm)155.7(W)*88.2(H)3Screensize(inch)7.0(Diagonal)4Dotpitch(mm)0.320(W)*0.370(H)5ColorconfigurationR.G.B.stripe6Overalldimension(mm)168*116*147Weight(g)三、電器參數(shù):ParameterSymbolMinMaxUnitCommentPowerSupplyforVoltageVDD4.85.2VPowerSupplyforCurrentIcc110150mANOTE1InputVoltage(H)forlogicVih2.4VDD+0.3VInputVoltage(L)forlogicVilVSS-0.3V0.8VInputCurrentforlogicLi0.024mAOutputVoltage(H)forlogicVoh3.0VDD+0.3VOutputVoltage(L)forlogicVolVss-0.30.4VPowerSupplyforLampVlamp1113VIlamp320380mANOTE1:最小電流的條件是電源4.8V,不對模塊操作,液晶屏幕顯示全黑。最大電流的條件是電源5.2V,對控制卡進行高速邏輯寫操作,屏幕顯示全白。使用環(huán)境參數(shù):ItemOPERATIONSTORAGECOMMENTMINMAXMINMAXAmbientTemperature-207-280RelativeHumidity0%85%0%95%四、MCU接口定義用戶板和NHC_36控制模塊的連接(J1)采用21線2.54mm間距單排插針。對液晶的操作采用標準intel總線時序(8031總線時序)。管腳圖如下:(頂視圖)序號符號狀態(tài)功能J1-1A--背光電源+12VJ1-2K--背光電源地J1-3GND--邏輯電源地J1-4VDD--邏輯電源+5VJ1-5WR\輸入寫操作信號,低電位有效J1-6RD\輸入讀操作信號,低電位有效J1-7CS\輸入使能信號,低電位有效J1-8A0輸入地址信號0J1-9A1輸入地址信號1J1-10D0三態(tài)數(shù)據(jù)總線J1-11D1三態(tài)數(shù)據(jù)總線J1-12D2三態(tài)數(shù)據(jù)總線J1-13D3三態(tài)數(shù)據(jù)總線J1-14D4三態(tài)數(shù)據(jù)總線J1-15D5三態(tài)數(shù)據(jù)總線J1-16D6三態(tài)數(shù)據(jù)總線J1-17D7三態(tài)數(shù)據(jù)總線J1-18VDD--邏輯電源+5VJ1-19GND--邏輯電源地J1-20GND--邏輯電源地J1-21NC--五、NHC_36液晶控制板與微處理器的接口時序接口時序與8031的總線時序相同時序:A0、A1、/CST1T2T3/WR,/RDT4T5T6D7—D0(WRITE)T7T8D7—D0(READ)時序特性參數(shù)項目符號參數(shù)說明Vdd=4.8to5.2V單位測試條件最小最大A0、A1、/CST2地址保持時間10-nsCL=100pFT1地址建立時間0-ns/WR,/RDT3讀寫周期350-nsT4讀寫脈沖速度120-nsD0—D7T5寫數(shù)據(jù)保持時間120-nsT6寫數(shù)據(jù)建立時間80-nsT7讀數(shù)據(jù)建立時間-50nsT8讀數(shù)據(jù)保持時間1050ns六、指令介紹及編程方法: CS WR RD A1 H 任意任意 任意任意操作無效 L L H 0 0 寫顯示數(shù)據(jù)到LCD L H L 0 0 從LCD讀數(shù)據(jù) L L H 0 1 寫顯示數(shù)據(jù)前用:設(shè)定行地址, 地址 0-233對應(yīng)液晶屏從上到下1到234行 L L H 1 0 設(shè)定列地址(0-479) L L H 1 1 設(shè)定顯示頁和操作頁寫指令和數(shù)據(jù)設(shè)定顯示頁和操作頁地址。(A1=A0=1,CS=0,WR=0)開機時先執(zhí)行此操作再執(zhí)行其他操作,工作中不需要換頁時|D7D6D5D4D3D2D1D0|0001/00001/0D0位設(shè)定顯示頁。D4位設(shè)定操作頁。寫行地址。(A1=0,A0=1)寫列地址高字節(jié)。(A1=1,A0=0)寫列地址低字節(jié)。(A1=1,A0=0)寫1個字節(jié)數(shù)據(jù)。對應(yīng)一個象素點。(A1=0,A0=0)|D7D6D5D4D3D2D1D0|R2R1R0G2G1G0B1B0R2、R1、R0表示紅色灰度,從000到111,灰度有8級R2為高灰度位,R0為低灰度位。G2、G1、G0表示綠色灰度,從000到111,灰度有8級G2為高灰度位,G0為低灰度位。B1、B0表示藍色灰度,從00到11,灰度有4級B1為高灰度位,B0為低灰度位。如在同一行內(nèi)連續(xù)讀、寫數(shù)據(jù)不用每次重寫行坐標和列坐標,每一次“讀、寫數(shù)據(jù)”操作后列地址自動+1。2、操作說明:a)在開機后,延時一段時間(如100毫秒),讓液晶模塊充分上電。軟件先寫顯示頁和操作頁指令,工作中如果不需要換頁就不用重復(fù)使用該指令。設(shè)定行列地址時,先寫行地址再寫兩字節(jié)列地址。寫顯示內(nèi)容,每寫一字節(jié)為一像素點,寫后列地址自動加1,如果同一行從左到右寫數(shù)據(jù)可以連續(xù)寫不用重新寫行列地址。七、注意事項:控制板在安裝時禁止受力擠壓,更不要變形彎曲,以免造成工作不正?;蚩刂瓢鍝p壞??刂瓢宓陌惭b和與其連接線的安裝要盡量遠離強電、高壓(交流220V、逆變器)、大功率接觸器、繼電器、變壓器等對外有干擾的器件。控制板電源要做好抗干擾濾波,這樣會避免控制模塊受到干擾,造成顯示不正常的現(xiàn)象。使用時禁止用手直接觸摸模塊電路,以避免靜電對板上器件造成損害。如果第18管腳“RD\”不用時,接上拉電阻八、模塊尺寸Nhc_36液晶模塊例程:ASM51格式:;立即數(shù)blackequ0;顏色字節(jié)0,1位是藍色4級灰度;2,3,4位是綠色8級灰度blueequ03hgreenequ1ch;5,6,7位是紅色8級灰度bluenessequ1fh;三位表示灰度由低到高分別為000,001,010,011,100,101,110,111redequ0e0hpinkequ0e3hyellowequ0fchwhiteequ0ffh;以上表示8種顏色的最高灰度 89C51的P0口為8位數(shù)據(jù)口;P2.0,P2.1為A0,A1;P2.7為CS\;P3.6為WR\;P3.7為RD\addr_wda equ 0000h ;寫數(shù)據(jù)到地址addr_wcol equ 0200h ;寫列號地址addr_wrow equ 0100h ;寫行號地址addr_wop equ0300h ;寫操作碼地址,選擇顯示頁和操作頁;標志位flag_cir equ 01h ;畫圓時用位標志區(qū)第二個字節(jié)radw_0equ 08hradw_1 equ 09hradw_2 equ 0ahradw_3 equ 0bhradw_4 equ 0chradw_5 equ 0dhradw_6 equ 0ehradw_7 equ 0fh;寄存器bit_byteequ22h;操作象素點時的標志位xstal equ 24h ;x起始坐標低字節(jié)xstah equ 25h ;x起始坐標高字節(jié)ystal equ 26h ;y起始坐標低字節(jié)ystah equ 27h ;y起始坐標高字節(jié)xendl equ 28h ;x終止坐標低字節(jié)xendh equ 29h ;x終止坐標高字節(jié)yendl equ 2ah ;y終止坐標低字節(jié)yendh equ 2bh ;y終止坐標高字節(jié)d_xl equ 2ch ;x差值低字節(jié)d_xh equ 2dh ;x差值高字節(jié)d_yl equ 2eh ;y差值低字節(jié)d_yh equ 2fh ;y差值高字節(jié);errl equ 30h ;誤差值低字節(jié);errh equ 31h ;誤差值高字節(jié)cirxl equ 30hcirxh equ 31hciryl equ 32hciryh equ 33hrad equ 34hradw equ 21hradf equ 20harcx1 equ 35harcy1 equ 36harcx2 equ 37harcy2 equ 38herrl equ 39herrh equ 3ahcolorequ3bh ;暫存顏色值char_byte equ 3ch ;寫漢字時暫存要寫入的單字節(jié)字模char_num equ 3dh ;一個漢字要寫入char_byte32次(16*16)char_num1 equ 3ehbak_char_numequ3fhnum_byte equ 46h ;一次操作LCD的數(shù)據(jù)12字節(jié)記數(shù)器1.設(shè)定顯示頁為第0頁,操作頁為第一頁。 Mov dptr,#addr_wop Mov a,#10h Movx @dptr,a2.用某顏色清全屏clr_lcd:movr6,#0 ;入口:color=顏色,r6=行數(shù)clr_lcd1:movdptr,#addr_wrow ;用到r6,r7,dptr,psw,amova,r6movx@dptr,amovdptr,#addr_wcolmova,#0h ;設(shè)為0列movx@dptr,amovx@dptr,amovr7,#240 mova,colormovdptr,#addr_wdaclr_lcd2:movx@dptr,a movx @dptr,a ;一個循環(huán)寫兩個點,共240個循環(huán)djnzr7,clr_lcd2 ;共寫了480個點incr6mova,r6cjnea,#234,clr_lcd1ret例如:用紅色清全屏 Mov color,#red Call clr_lcd3.在坐標xsta,ysta位置畫一點。dotw:movdptr,#addr_wrow ;入口ysta=y坐標地址,xsta=x坐標地址,color=顏色 mov a,ystal ;資源:dptr,a,pswmovx@dptr,amovdptr,#addr_wcol mov a,xstahmovx@dptr,a mov a,xstalmovx@dptr,amovdptr,#addr_wdamova,colormovx@dptr,aret從起始坐標到中止坐標,以某顏色畫線。line: clrcmova,#233subba,ystalmovystal,aclrcmova,#233subba,yendlmovyendl,aline01:mov errl,#0 ;入口:起始坐標雙字節(jié)(xsta,ysta),終止坐標雙字節(jié)(xend,yend) mov errh,#0 ;color=顏色 mov a,yendl ;資源:xstah,xstal起始X坐標 clr c ; ystah,ystal起始Y坐標 subb a,ystal ; xendh,xendl中止X坐標 mov d_yl,a ; yendh,yendl中止Y坐標 mov a,yendh ; d_xh,d_xl x差值 subb a,ystah ; d_yh,d_yl y差值 mov d_yh,a ; errh,errl 誤差值 jnc line1 ; a,pswline0: mov a,yendl xch a,ystal mov yendl,a mov a,yendh xch a,ystah mov yendh,a mov a,xendl xch a,xstal mov xendl,a mov a,xendh xch a,xstah mov xendh,a sjmp line01line1: call dotw ;畫一點 mov a,xendl clr c subb a,xstal mov d_xl,a mov a,xendh subb a,xstah mov d_xh,a jc line3 mov a,d_yh cjne a,d_xh,line2 mov a,d_yl cjne a,d_xl,line2 sjmp rate1line2: jnc line21 sjmp rate1line21: jmp rate2line3: mov a,xstal clr c subb a,xendl mov d_xl,a mov a,xstah subb a,xendh mov d_xh,a cjne a,d_yh,line4 mov a,d_xl cjne a,d_yl,line4line4: jc line5 jmp rate3line5: jmp rate4;**********************************k=0-1即d_y<=d_x時rate1: mov a,ystah cjne a,yendh,rate10 mov a,ystal cjne a,yendl,rate10 sjmp rate11rate10: mov a,errh jb acc.7,rate12 mov a,ystal add a,#1 mov ystal,a mov a,ystah addc a,#0 mov ystah,arate11: mov a,xstal add a,#1 mov xstal,a mov a,xstah addc a,#0 mov xstah,a mov a,errl add a,d_yl mov errl,a mov a,errh addc a,d_yh mov errh,a clr c mov a,errl subb a,d_xl mov errl,a mov a,errh subb a,d_xh mov errh,a sjmp rate13rate12: mov a,xstal add a,#1 mov xstal,a mov a,xstah addc a,#0 mov xstah,a mov a,errl add a,d_yl mov errl,a mov a,errh addc a,d_yh mov errh,arate13: call dotw mov a,xstal cjne a,xendl,rate10 mov a,xstah cjne a,xendh,rate10 ret;*************************************k>1即d_y>d_x時rate2: mov a,errh jb acc.7,rate21 mov a,ystal add a,#1 mov ystal,a mov a,ystah addc a,#0 mov ystah,a clr c mov a,errl subb a,d_xl mov errl,a mov a,errh subb a,d_xh mov errh,a sjmp rate22rate21: mov a,ystal add a,#1 mov ystal,a mov a,ystah addc a,#0 mov ystah,a mov a,xstal add a,#1 mov xstal,a mov a,xstah addc a,#0 mov xstah,a mov a,errl add a,d_yl mov errl,a mov a,errh addc a,d_yh mov errh,a clr c mov a,errl subb a,d_xl mov errl,a mov a,errh subb a,d_xh mov errh,arate22: call dotw mov a,ystal cjne a,yendl,rate2 mov a,ystah cjne a,yendh,rate2 ret;************************************k=-1--0即d_x>=d_y時rate3: mov a,ystal cjne a,yendl,rate30 mov a,ystah cjne a,yendh,rate30 sjmp rate31rate30: mov a,errh jb acc.7,rate32 mov a,ystal add a,#1 mov ystal,a mov a,ystah addc a,#0 mov ystah,arate31: mov a,xstal subb a,#1 mov xstal,a mov a,xstah subb a,#0 mov xstah,a mov a,errl add a,d_yl mov errl,a mov a,errh addc a,d_yh mov errh,a clr c mov a,errl subb a,d_xl mov errl,a mov a,errh subb a,d_xh mov errh,a sjmp rate33rate32: mov a,xstal clr c subb a,#1 mov xstal,a mov a,xstah subb a,#0 mov xstah,a mov a,errl add a,d_yl mov errl,a mov a,errh addc a,d_yh mov errh,arate33: call dotw mov a,xstal cjne a,xendl,rate30 mov a,xstah cjne a,xendh,rate30 ret;*************************************k<-1即d_x>d_yrate4: mov a,errh jb acc.7,rate41 mov a,ystal add a,#1 mov ystal,a mov a,ystah addc a,#0 mov ystah,a clr c mov a,errl subb a,d_xl mov errl,a mov a,errh subb a,d_xh mov errh,a sjmp rate42rate41: clr c mov a,xstal subb a,#1 mov xstal,a mov a,xstah subb a,#0 mov xstah,a mov a,ystal add a,#1 mov ystal,a mov a,ystah addc a,#0 mov ystah,a mov a,errl add a,d_yl mov errl,a mov a,errh addc a,d_yh mov errh,a clr c mov a,errl subb a,d_xl mov errl,a mov a,errh subb a,d_xh mov errh,arate42: call dotw mov a,ystal cjne a,yendl,rate4 mov a,ystah cjne a,yendh,rate4 ret例如:從坐標(16,16)到坐標(200,150)畫一跟黃線。 Mov xstah,#0 mov xstal,#10hmovystah,#0 mov ystal,#10h mov xendh,#0 mov xendl,#200movyendh,#0 mov yendl,#150 mov color,#yellow call line5.以某坐標(cirx,ciry)為圓心,以rad為半徑,以color為顏色畫圓。circle:mova,#234 ;入口:cirxh,cirxl=圓心X坐標subba,ciryl ; ciryh,ciryl=圓心Y坐標movciryl,a ; rad=半徑,color=顏色clr a ;使用資源:cirxh,cirxl,ciryh,ciryl,a,psw,flag_cir clr flag_cir ;arcx1,arcy1,arcx2,arcy2,errl,errh,color,dptr mov arcx1,a ;xstah,xstal,ystahystal mov arcy2,a mov a,rad mov arcy1,a mov arcx2,acir1: call amp call squ mov a,arcx1 cjne a,arcx2,cir3cir2: call amp retcir3: xch a,arcx2 mov arcx1,a mov a,arcy1 xch a,arcy2 mov arcy1,a cpl flag_cir call amp mov a,arcx1 xch a,arcy1 mov arcx1,a call squ mov a,arcx1 xch a,arcy1 mov arcx1,a cpl flag_cir cjne a,arcx2,cir4 sjmp cir2cir4: xch a,arcx2 mov arcx1,a mov a,arcy1 xch a,arcy2 mov arcy1,a sjmp cir1;***********************************方差計算程序;***********************************@=(a+1)^2+b^2-r^2-ba=arcx1b=arcy1squ: mov a,arcx1 inc a mov b,a mul ab mov errl,a mov errh,b mov a,arcy1 mov b,a mul ab add a,errl mov errl,a mov a,b addc a,errh mov errh,a mov a,rad mov b,a mul ab clr c xch a,errl subb a,errl mov errl,a mov a,b xch a,errh subb a,errh mov errh,a jc squ1 mov a,errl subb a,arcy1 mov errl,a mov a,errh subb a,#0 mov errh,a jc squ1 dec arcy1squ1: inc arcx1 ret;******************************圓弧擴展子程序;***************輸入:坐標值x=arcx1,y=arcy1,圓心坐標值(cirx,ciry);***************x為x1和x2之一,y為y1和y2之一amp: mov a,cirxl add a,arcx1 mov xstal,a mov a,cirxh addc a,#0 mov xstah,a mov a,ciryl add a,arcy1 mov ystal,a mov a,ciryh addc a,#0 mov ystah,a jb flag_cir,amp1 jb radw_6,amp2 sjmp amp3amp1: jb radw_7,amp2 sjmp amp3amp2: call dotwamp3: mov a,cirxl clr c subb a,arcx1 mov xstal,a mov a,cirxh subb a,#0 mov xstah,a jb flag_cir,amp4 jb radw_5,amp5 sjmp amp6amp4: jb radw_4,amp5 sjmp amp6amp5: call dotwamp6: mov a,ciryl clr c subb a,arcy1 mov ystal,a mov a,ciryh subb a,#0 mov ystah,a jb flag_cir,amp7 jb radw_2,amp8 sjmp amp9amp7: jb radw_3,amp8 sjmp amp9amp8: call dotwamp9: mov a,cirxl add a,arcx1 mov xstal,a mov a,cirxh addc a,#0 mov xstah,a jb flag_cir,ampa jb radw_1,ampb sjmp ampcampa: jb radw_0,ampb sjmp ampcampb: call dotwampc: ret例如:在坐標(160,117)為圓心,以110位半徑畫一白色圓。 mov color,#white mov cirxl,#160 mov cirxh,#0 mov ciryl,#117 mov ciryh,#0 mov rad,#110 mov radw,#0ffh call circle5.顯示一行漢字子程序disp_hanzi: mov a,bak_char_num ;顯示漢字子程序 mov char_num,a ;xsta和ysta是顯示漢字的左上角起始位置(以象素點為單位)disp_hanzi1: clr a ;dptr是指向字模表首地址的指針,字模表寫在程序中 movc a,@a+dptr ;char_num1顯示漢字需要的行數(shù),bak_char_num顯示漢字一行需要的象素點除以8 inc dptr ;color是顏色 mov char_byte,a mov a,dph ;暫存dptr mov ciryh,a mov a,dpl mov ciryl,a mov r7,#8disp_hanzi2: mov a,char_byte rlc a mov char_byte,a jnc disp_hanzi3 push 07h call dotw pop 07hdisp_hanzi3: mov a,xstal add a,#1 mov xstal,a mov a,xstah addc a,#0 mov xstah,a djnz r7,disp_hanzi2 ;暫存dptr mov a,ciryhmovdph,a mov a,ciryl mov dpl,a djnz char_num,disp_hanzi1 mov a,bak_char_num mov b,#8 mul ab mov r0,a mov a,xstal clr c subb a,r0 mov xstal,a mov a,xstah subb a,b mov xstah,a inc ystal djnz char_num1,disp_hanzi ret例如:在坐標(80,177)位置用綠色顯示一行漢字 mov xstah,#0 mov xstal,#80 mov ystal,#177 mov color,#green mov dptr,#bairi6 mov char_num1,#16 mov bak_char_num,#20 ;xsta和ysta是顯示漢字的左上角起始位置;color是顏色call disp_hanzi;--白日依山盡黃河入海流--**楷體_GB2312,12**下劃線小四;當前所選字體下一個漢字對應(yīng)的點陣為:寬度x高度=160x16。bairi6:DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000HDB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,004HDB000H,000H,000H,000H,000H,008H,000H,004H,000H,030H,000H,000H,001H,00CH,000H,030HDB000H,0FEH,000H,044H,001H,080H,000H,000H,000H,018H,000H,004H,000H,020H,000H,03EHDB001H,000H,000H,030H,000H,088H,000H,04EH,000H,081H,0C0H,000H,003H,01EH,003H,003HDB000H,040H,001H,0C4H,002H,003H,000H,020H,001H,010H,001H,0F8H,000H,0FEH,000H,080HDB001H,060H,001H,03CH,001H,09EH,001H,004H,004H,0FCH,000H,020H,001H,0E0H,000H,091HDB088H,002H,000H,040H,000H,084H,000H,010H,007H,0E2H,001H,008H,004H,030H,000H,020HDB002H,040H,001H,0FEH,004H,012H,000H,040H,008H,07AH,008H,024H,004H,006H,003H,0E8HDB01CH,066H,000H,041H,002H,020H,01EH,040H,000H,0F4H,000H,0A0H,000H,054H,008H,078HDB004H,024H,002H,008H,024H,0A8H,008H,043H,004H,010H,003H,0FCH,002H,0A4H,001H,020HDB004H,09FH,082H,088H,00FH,0C4H,002H,010H,009H,090H,008H,042H,009H,01CH,002H,0A8HDB004H,0C4H,002H,020H,00BH,064H,005H,028H,008H,008H,004H,010H,00EH,088H,008H,082HDB011H,08FH,085H,0D0H,008H,004H,004H,010H,009H,028H,009H,050H,008H,008H,007H,0D0HDB009H,00CH,008H,0FCH,020H,000H,004H,0F0H,008H,008H,008H,018H,012H,008H,009H,051HDB00FH,0F0H,000H,020H,011H,047H,01FH,004H,000H,000H,007H,000H,030H,008H,030H,01CHDB027H,0F4H,032H,051H,000H,010H,000H,020H,011H,080H,000H,008H,003H,000H,002H,030HDB000H,038H,0C0H,00FH,020H,010H,024H,00FH,000H,020H,000H,000H,002H,000H,000H,000HDB001H,000H,00CH,010H,000H,010H,000H,000H,000H,060H,008H,000H,0FFH,0FFH,0FFH,0FFHDB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFHC51格式:uchar*p,*p1,*p2;/*建立數(shù)組指針*/uchardatal1;uchardatal2;uchardatapage; /*行地址*/uchardatacol1; /*列地址高字節(jié)*/uchardatacol=0x00; /*列地址低字節(jié)*/uchardatayanse1; /*背景色*/uchardatayanse2; /*前景色—顯示字符顏色*/#definedlcdXBYTE[0x0000]/*定義送數(shù)據(jù)的地址*/#defineclcd1XBYTE[0x0100]/*定義送指令的地址*/#defineclcd2XBYTE[0x0200]/*定義送指令的地址*/#defineclcd3XBYTE[0x0300]/*定義送指令的地址*/1.用某顏色清屏voidClearlcd() /*入口:yanse=清屏顏色*/{uchardatai,j;uchardatak=0x00;clcd3=0x00; /*設(shè)定顯示頁和操作頁*/for(i=0;i<234;i++){clcd1=k; /*設(shè)定行地址*/clcd2=0x00;clcd2=0x00; /*設(shè)定列地址*/for(j=0;j<160;j++) ;寫入一行顏色{dlcd=yanse1; /*寫顯示數(shù)據(jù)*/dlcd=yanse1;dlcd=yanse1;dlcd=yanse1;}k=k+0x01;}}2.顯示一行漢字子程序,漢字字模表在程序中voidHanz() /*入口:*p=漢字字模16位首地址*/{ /*page=漢字顯示位置左上角坐標行地址*/uchardatai,j,col2; /*col,col1=漢字顯示位置左上角坐標列地址*/for(i=0;i<l1;i++) /*yanse1=漢字顯示背景色,yanse=漢字顯示顏色*/{ /*l1=字模表中顯示一行字節(jié)數(shù)*/clcd3=0x00; /*l2=顯示漢字行數(shù)*/clcd1=page;clcd2=col;clcd2=col1;page=page+0x01;for(j=0;j<l2;j++){Hanz1();}col2=col1;col2=col2+0x01;if((col2|0x00)!=0x00){}else{col=0x01;}}}voidHanz1(){uchardatai,wbyte,wbyte1;wbyte=*p;for(i=0;i<8;i++){wbyte1=wbyte;if((wbyte1&0x80)!=0x80){wbyte=wbyte<<1;dlcd=yanse1;}else{wbyte=wbyte<<1;dlcd=yanse2;}}p=p+1;}例如:在第16行16列顯示一行蘭底黃字l1=33;l2=25page=0x10;col1=0x00;col=0x10;yanse1=0x03; /*藍色*/yanse2=0xfc; /*黃色*/p=hanzi;hanz();charcodehanzi[25][33]={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,0x03,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x38,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xE0,0x00,0x00,0x07,0xFE,0xF8,0x00,0x00,0x38,0x70,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0xE0,0x00,0x00,0x03,0xE0,0xE0,0x00,0x00,0x3C,0x70,0x00,0x00,0x00,0x7F,0xFE,0x00,0xC0,0x01,0xFC,0x00,0x1F,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x1C,0x70,0x00,0x00,0x3F,0xFC,0x00,0x00,0xC7,0xFF,0xFE,0x00,0xF3,0x80,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x1C,0x70,0x00,0x3F,0xFE,0x00,0x00,0x01,0xFF,0x00,0x3F,0x00,0x03,0x80,0x00,0x00,0x00,0xE7,0xE0,0x00,0x00,0x07,0x00,0x00,0x00,0x18,0x60,0xC0,0x0F,0x00,0x00,0x00,0x01,0xC0,0x00,0x38,0x00,0x03,0x80,0x00,0x00,0x03,0xFF,0xF8,0x00,0x00,0x1E,0x00,0x00,0x00,0x18,0x61,0xE0,0x00,0x00,0x0C,0x00,0x03,0xC0,0x00,0x60,0x00,0x03,0x80,0x00,0x00,0xFF,0xE0,0xF0,0x00,0x00,0x0E,0x00,0x00,0x00,0x18,0x61,0xE0,0x00,0x00,0xFF,0x00,0x07,0x80,0x00,0x00,0x00,0x03,0xF8,0x07,0x00,0x70,0xE0,0xF0,0x00,0x00,0x0E,0x1F,0xC0,0x00,0x38,0x67,0x80,0x00,0x7F,0x8F,0x80,0x03,0x80,0x00,0x00,0x00,0x3F,0x80,0x7F,0xC0,0x70,0xE0,0xE0,0x00,0x00,0x0F,0xFF,0xF0,0x0F,0xF8,0x6E,0x00,0x00,0x38,0x0E,0x00,0x00,0x00,0x1F,0xF0,0x07,0xFF,0x0F,0xE7,0xC0,0x30,0xFE,0xE0,0x00,0x01,0xFF,0xC0,0x00,0x07,0x18,0x78,0x00,0x00,0x18,0x0C,0x00,0x00,0x07,0xFF,0xF0,0x07,0x8F,0x0E,0x03,0x80,0x3F,0xF8,0xE0,0x01,0xFF,0xE7,0x00,0x00,0x00,0x18,0x60,0x00,0x00,0x18,0x1C,0x00,0x00,0x7F,0xE0,0x00,0x00,0x0F,0x06,0x07,0x8

溫馨提示

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

評論

0/150

提交評論