當(dāng)前位置:首頁(yè) > 單片機(jī) > 單片機(jī)
[導(dǎo)讀]//SMG240128A標(biāo)準(zhǔn)圖形點(diǎn)陣型液晶顯示模塊的擴(kuò)展演示程序[C51編程語(yǔ)言][MCS51總線接口方式]//應(yīng)用產(chǎn)品: SMG240128A標(biāo)準(zhǔn)圖形點(diǎn)陣型液晶顯示模塊// 本演示程序適用于SMG240128A液晶顯示模塊與MCS51系列單片機(jī)采用MCS51總

//SMG240128A標(biāo)準(zhǔn)圖形點(diǎn)陣型液晶顯示模塊的擴(kuò)展演示程序[C51編程語(yǔ)言][MCS51總線接口方式]
//應(yīng)用產(chǎn)品: SMG240128A標(biāo)準(zhǔn)圖形點(diǎn)陣型液晶顯示模塊
// 本演示程序適用于SMG240128A液晶顯示模塊與MCS51系列單片機(jī)采用MCS51總線接口的
//硬件連線方式。
// 本演示程序包括T6963C兼容芯片的MCS51總線接口方式子程序集,T6963C兼容芯片的240128
//液晶顯示模塊的基本子程序,240128系列繪圖子程序集,240128系列圖形子程序集,240128系
//列精簡(jiǎn)中英文字庫(kù)子程序集,以及SMG240128系列標(biāo)準(zhǔn)圖形點(diǎn)陣型液晶顯示的擴(kuò)展演示子程序.
// 本演示的內(nèi)容為,在240列X128行的點(diǎn)陣液晶顯示屏上清屏,圖片演示,英文字符串演示,中文
//字符串演示,反白顯示字符串,繪制矩形,寫(xiě)點(diǎn),繪制直線,全屏顯示.
//-------------------------------------------------------------------------------
//軟件環(huán)境: VW For Windows
//硬件環(huán)境: AT89C52 MCU,MCS-51系列 MCU,etc.
//-------------------------------------------------------------------------------
#include
#include
//以下為演示程序的函數(shù)定義
void exsample(void); //演示程序
void exdelay(void); //演示延時(shí)子程序
void putchar(unsigned int c); //定位寫(xiě)字符子程序
void putstr(unsigned char code *s); //顯示字符串子程序,字符碼為0時(shí)退出
unsigned char code *getchinesecodepos(unsigned int ac);
unsigned char code *getenglishcodepos(unsigned char ac);
void putimage(unsigned char code *s); //顯示圖形子程序
void putsizeimage(unsigned char XSIZE,unsigned char YSIZE,unsigned char code *s);
//顯示指定大小的圖形子程序
void point(bit b);
void line(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,bit b);
void lineto(unsigned char x1,unsigned char y1,bit b);//繪制(XPOS,YPOS)-(X1,Y1)的直線
void rect(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,bit b);
void lcdfill(unsigned char d); //整屏顯示d代表的字節(jié)數(shù)據(jù)子程序
void lcdpos(void); //設(shè)置坐標(biāo)點(diǎn)(XPOS,YPOS)內(nèi)部RAM地址的子程序
void lcdreset(void); //液晶顯示控制器初始化子程序
void lcdwd(unsigned char d); //送圖形數(shù)據(jù)子程序
unsigned char lcdrd(void); //讀圖形數(shù)據(jù)子程序
void lcdwc(unsigned char c); //送指令子程序
void lcdwc2(unsigned char c,unsigned char d);//送2字節(jié)指令子程序
void lcdwc3(unsigned char c,unsigned char d1,unsigned char d2);//送3字節(jié)指令子程序
unsigned char lcdrdata(void); //讀數(shù)據(jù)子程序
void lcdwdata(unsigned char d); //送數(shù)據(jù)子程序
void lcdwaitidle(void); //忙檢測(cè)子程序
//-------------------------------------------------------------------------------
//SMG240128A產(chǎn)品引腳說(shuō)明及演示連線
//PIN1: FG [構(gòu)造地]-------------------VSS
//PIN2: VSS [電源地]-------------------VSS
//PIN3: VDD [電源正極]-----------------VDD(+5V)
//PIN4: Vo [LCD 偏壓輸入]-------------接10K的可調(diào)電阻2K電阻到VSS及VEE
// Vo=VEE時(shí)為顯示最深
//PIN5: WR [寫(xiě)信號(hào) 低有效]------------P3.6
//PIN6: RD [讀信號(hào) 低有效]------------P3.7
//PIN7: CE [使能信號(hào) 低有效]----------P2.1
//PIN8: CD [數(shù)據(jù)/命令選擇端(H/L)]---P2.0
//PIN9: NC [空腳]---------------------不連線
//PIN10:RST [復(fù)位端 低有效]------------VDD
//PIN11:D0 [Data I/O]-----------------P0.0
//PIN12:D1 [Data I/O]-----------------P0.1
//PIN13:D2 [Data I/O]-----------------P0.2
//PIN14:D3 [Data I/O]-----------------P0.3
//PIN15:D4 [Data I/O]-----------------P0.4
//PIN16:D5 [Data I/O]-----------------P0.5
//PIN17:D6 [Data I/O]-----------------P0.6
//PIN18:D7 [Data I/O]-----------------P0.7
//PIN19:FS [字體點(diǎn)陣]-----------------VSS
//PIN20:VEE [LCD負(fù)壓輸出]--------------提供液晶負(fù)電壓.
//PIN21:BLA [背光源正極]---------------見(jiàn)使用說(shuō)明書(shū).
//PIN22:BLK [背光源負(fù)極]---------------VSS
//注:8031的晶振頻率為12MHz.
//-------------------------------------------------------------------------------
//以下為外部地址在演示程序中的預(yù)定義
//用戶在編寫(xiě)應(yīng)用程序時(shí),需按自己的實(shí)際硬件連線來(lái)重新定義
unsigned char xdata LCDCREG _at_ 0x0100;//指令地址CE(P2.1)=0,C/D(P2.0)=1
unsigned char xdata LCDDREG _at_ 0x0000;//數(shù)據(jù)地址CE(P2.1)=0,C/D(P2.0)=0
//-------------------------------------------------------------------------------
//以下XPOS,YPOS變量用于指示當(dāng)前操作點(diǎn)的位置的預(yù)定義
//用戶在編寫(xiě)應(yīng)用程序時(shí),需按自己的實(shí)際軟件程序需要來(lái)重新定義
unsigned char XPOS; //列方向LCD點(diǎn)陣位置指針
unsigned char YPOS; //行方向LCD點(diǎn)陣位置指針
bit CharImageReverse; //字符及圖形的反顯控制,0(正常顯示),1(反顯)

#define XDOTS 240 //圖形空間X方向大小
#define YDOTS 128 //圖形空間X方向大小
//-------------------------------------------------------------------------------
//以下為精簡(jiǎn)版中英文字庫(kù)
//實(shí)際使用時(shí)請(qǐng)包含由Sunman精簡(jiǎn)版中英文字符庫(kù)代碼生成器.exe自動(dòng)生成的charlib.c文
//文件來(lái)替換該部分
//精簡(jiǎn)版中英文字符庫(kù)常量定義
#define ENGLISHCHARNUMBER 8 //精簡(jiǎn)版英文字符庫(kù)中的英文字符的個(gè)數(shù)
#define CHINESECHARNUMBER 11 //精簡(jiǎn)版中文字符庫(kù)中的中文字符的個(gè)數(shù)
#define ENGLISHCHARSIZE 8 //英文字符X方向顯示點(diǎn)的個(gè)數(shù)
#define CHINESECHARSIZE 16 //中文字符X方向及中英文字符Y方向顯示點(diǎn)的個(gè)數(shù)
#define ENGLISHCHARDOTSIZE 16 //單個(gè)英文字符點(diǎn)陣的字節(jié)數(shù)
#define CHINESECHARDOTSIZE 32 //單個(gè)中文字符點(diǎn)陣的字節(jié)數(shù)

unsigned char code EnglishCode[]={
0x2e, //字符001:[.]
0x41, //字符002:[A]
0x43, //字符003:[C]
0x4d, //字符004:[M]
0x4e, //字符005:[N]
0x53, //字符006:[S]
0x55, //字符007:[U]
0x57 //字符003:[W]
};

unsigned int code ChineseCode[]={
0xb3a4, //字符001:[長(zhǎng)]
0xb5e7, //字符002:[電]
0xb9ab, //字符003:[公]
0xc8cb, //字符004:[人]
0xc9b3, //字符005:[沙]
0xcbbe, //字符006:[司]
0xccab, //字符007:[太]
0xcfde, //字符008:[限]
0xd1f4, //字符009:[陽(yáng)]
0xd3d0, //字符010:[有]
0xd7d3 //字符011:[子]
};

unsigned char code EnglishCharDot[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //字符001:[.]
0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,
0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28, //字符002:[A]
0x24,0x3c,0x44,0x42,0x42,0xe7,0x00,0x00,
0x00,0x00,0x00,0x3e,0x42,0x42,0x80,0x80, //字符003:[C]
0x80,0x80,0x80,0x42,0x44,0x38,0x00,0x00,
0x00,0x00,0x00,0xee,0x6c,0x6c,0x6c,0x6c, //字符004:[M]
0x54,0x54,0x54,0x54,0x54,0xd6,0x00,0x00,
0x00,0x00,0x00,0xc7,0x62,0x62,0x52,0x52, //字符005:[N]
0x4a,0x4a,0x4a,0x46,0x46,0xe2,0x00,0x00,
0x00,0x00,0x00,0x3e,0x42,0x42,0x40,0x20, //字符006:[S]
0x18,0x04,0x02,0x42,0x42,0x7c,0x00,0x00,
0x00,0x00,0x00,0xe7,0x42,0x42,0x42,0x42, //字符007:[U]
0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,
0x00,0x00,0x00,0xd6,0x92,0x92,0x92,0x92, //字符003:[W]
0xaa,0xaa,0x6c,0x44,0x44,0x44,0x00,0x00
};

unsigned char code ChineseCharDot[]={
0x08,0x00,0x08,0x10,0x08,0x20,0x08,0x40, //字符001:[長(zhǎng)]
0x09,0x80,0x0e,0x00,0x08,0x00,0xff,0xfe,
0x0a,0x00,0x09,0x00,0x08,0x80,0x08,0x40,
0x09,0x30,0x0a,0x1c,0x0c,0x08,0x08,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x3f,0xf8, //字符002:[電]
0x21,0x08,0x21,0x08,0x3f,0xf8,0x21,0x08,
0x21,0x08,0x21,0x08,0x3f,0xf8,0x21,0x08,
0x01,0x02,0x01,0x02,0x00,0xfe,0x00,0x00,
0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40, //字符003:[公]
0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0e,
0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,
0x11,0xf8,0x3f,0x18,0x10,0x10,0x00,0x00,
0x01,0x00,0x01,0x80,0x01,0x00,0x01,0x00, //字符004:[人]
0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,
0x04,0x80,0x04,0x40,0x08,0x60,0x08,0x30,
0x10,0x18,0x20,0x0e,0x40,0x04,0x00,0x00,
0x20,0x40,0x10,0x40,0x10,0x40,0x01,0x50, //字符005:[沙]
0x41,0x48,0x2a,0x44,0x0a,0x42,0x14,0x40,
0x10,0x44,0x20,0x44,0xe0,0x08,0x20,0x10,
0x20,0x20,0x20,0xc0,0x23,0x00,0x2c,0x00,
0x00,0x00,0x3f,0xfc,0x00,0x04,0x00,0x04, //字符006:[司]
0x7f,0xe4,0x00,0x04,0x00,0x04,0x3f,0xc4,
0x20,0x44,0x20,0x44,0x3f,0xc4,0x20,0x44,
0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00, //字符007:[太]
0x7f,0xfe,0x01,0x00,0x01,0x00,0x01,0x00,
0x02,0x80,0x02,0x40,0x04,0x20,0x05,0x10,
0x08,0x98,0x10,0xcc,0x20,0x86,0x40,0x04,
0x00,0x00,0xfb,0xf8,0x92,0x08,0x93,0xf8, //字符008:[限]
0xa2,0x08,0xa2,0x08,0x93,0xf8,0x8a,0x80,
0x8a,0x48,0xaa,0x50,0x92,0x20,0x82,0x20,
0x82,0x10,0x82,0x8e,0x83,0x04,0x82,0x00,
0x00,0x00,0x7d,0xfc,0x45,0x04,0x49,0x04, //字符009:[陽(yáng)]
0x49,0x04,0x51,0x04,0x49,0xfc,0x45,0x04,
0x45,0x04,0x45,0x04,0x69,0x04,0x51,0x04,
0x41,0xfc,0x41,0x04,0x40,0x00,0x40,0x00,
0x01,0x00,0x01,0x00,0x7f,0xfe,0x02,0x00, //字符010:[有]
0x04,0x00,0x0f,0xf0,0x18,0x10,0x28,0x10,
0x4f,0xf0,0x88,0x10,0x08,0x10,0x0f,0xf0,
0x08,0x10,0x08,0x90,0x08,0x70,0x08,0x20,
0x00,0x00,0x3f,0xf0,0x00,0x20,0x00,0x40, //字符011:[子]
0x00,0x80,0x01,0x00,0x01,0x00,0x01,0x04,
0xff,0xfe,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00
};
//-------------------------------------------------------------------------------
//以下為圖片庫(kù)點(diǎn)陣代碼
//實(shí)際使用時(shí)請(qǐng)包含由SUNMAN圖形點(diǎn)陣代碼生成器.EXE自動(dòng)生成的imagelib.c文件來(lái)替換該
//部分
unsigned char code Img_sunman_32[]={32,32,
0x00,0x0f,0xf0,0x00,
0x00,0x7f,0xfe,0x00,
0x01,0xf0,0x0f,0x80,
0x03,0xc0,0x03,0xc0,
0x07,0x0f,0xf0,0xe0,
0x0e,0x3f,0xfc,0x70,
0x1c,0xfe,0x7f,0x38,
0x39,0xfc,0x3f,0x9c,
0x33,0xfc,0x3f,0xcc,
0x73,0xfe,0x7f,0xce,
0x67,0xff,0xff,0xe6,
0x67,0xe7,0xe7,0xe6,
0xcf,0xe3,0xc7,0xf3,
0xcf,0xe1,0x87,0xff,
0xcf,0xe4,0x27,0xff,
0xc0,0x06,0x60,0x03,
0xc0,0x07,0xe0,0x03,
0xff,0xe7,0xe7,0xf3,
0xff,0xe7,0xe7,0xf3,
0xcf,0xe7,0xe7,0xf3,
0x67,0xe7,0xe7,0xe6,
0x67,0xff,0xff,0xe6,
0x73,0xff,0xff,0xce,
0x33,0xff,0xff,0xcc,
0x39,0xff,0xff,0x9c,
0x1c,0xff,0xff,0x38,
0x0e,0x3f,0xfc,0x70,
0x07,0x0f,0xf0,0xe0,
0x03,0xc0,0x03,0xc0,
0x01,0xf0,0x0f,0x80,
0x00,0x7f,0xfe,0x00,
0x00,0x0f,0xf0,0x00
};
//-------------------------------------------------------------------------------

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

9月2日消息,不造車的華為或?qū)⒋呱龈蟮莫?dú)角獸公司,隨著阿維塔和賽力斯的入局,華為引望愈發(fā)顯得引人矚目。

關(guān)鍵字: 阿維塔 塞力斯 華為

倫敦2024年8月29日 /美通社/ -- 英國(guó)汽車技術(shù)公司SODA.Auto推出其旗艦產(chǎn)品SODA V,這是全球首款涵蓋汽車工程師從創(chuàng)意到認(rèn)證的所有需求的工具,可用于創(chuàng)建軟件定義汽車。 SODA V工具的開(kāi)發(fā)耗時(shí)1.5...

關(guān)鍵字: 汽車 人工智能 智能驅(qū)動(dòng) BSP

北京2024年8月28日 /美通社/ -- 越來(lái)越多用戶希望企業(yè)業(yè)務(wù)能7×24不間斷運(yùn)行,同時(shí)企業(yè)卻面臨越來(lái)越多業(yè)務(wù)中斷的風(fēng)險(xiǎn),如企業(yè)系統(tǒng)復(fù)雜性的增加,頻繁的功能更新和發(fā)布等。如何確保業(yè)務(wù)連續(xù)性,提升韌性,成...

關(guān)鍵字: 亞馬遜 解密 控制平面 BSP

8月30日消息,據(jù)媒體報(bào)道,騰訊和網(wǎng)易近期正在縮減他們對(duì)日本游戲市場(chǎng)的投資。

關(guān)鍵字: 騰訊 編碼器 CPU

8月28日消息,今天上午,2024中國(guó)國(guó)際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)開(kāi)幕式在貴陽(yáng)舉行,華為董事、質(zhì)量流程IT總裁陶景文發(fā)表了演講。

關(guān)鍵字: 華為 12nm EDA 半導(dǎo)體

8月28日消息,在2024中國(guó)國(guó)際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)上,華為常務(wù)董事、華為云CEO張平安發(fā)表演講稱,數(shù)字世界的話語(yǔ)權(quán)最終是由生態(tài)的繁榮決定的。

關(guān)鍵字: 華為 12nm 手機(jī) 衛(wèi)星通信

要點(diǎn): 有效應(yīng)對(duì)環(huán)境變化,經(jīng)營(yíng)業(yè)績(jī)穩(wěn)中有升 落實(shí)提質(zhì)增效舉措,毛利潤(rùn)率延續(xù)升勢(shì) 戰(zhàn)略布局成效顯著,戰(zhàn)新業(yè)務(wù)引領(lǐng)增長(zhǎng) 以科技創(chuàng)新為引領(lǐng),提升企業(yè)核心競(jìng)爭(zhēng)力 堅(jiān)持高質(zhì)量發(fā)展策略,塑強(qiáng)核心競(jìng)爭(zhēng)優(yōu)勢(shì)...

關(guān)鍵字: 通信 BSP 電信運(yùn)營(yíng)商 數(shù)字經(jīng)濟(jì)

北京2024年8月27日 /美通社/ -- 8月21日,由中央廣播電視總臺(tái)與中國(guó)電影電視技術(shù)學(xué)會(huì)聯(lián)合牽頭組建的NVI技術(shù)創(chuàng)新聯(lián)盟在BIRTV2024超高清全產(chǎn)業(yè)鏈發(fā)展研討會(huì)上宣布正式成立。 活動(dòng)現(xiàn)場(chǎng) NVI技術(shù)創(chuàng)新聯(lián)...

關(guān)鍵字: VI 傳輸協(xié)議 音頻 BSP

北京2024年8月27日 /美通社/ -- 在8月23日舉辦的2024年長(zhǎng)三角生態(tài)綠色一體化發(fā)展示范區(qū)聯(lián)合招商會(huì)上,軟通動(dòng)力信息技術(shù)(集團(tuán))股份有限公司(以下簡(jiǎn)稱"軟通動(dòng)力")與長(zhǎng)三角投資(上海)有限...

關(guān)鍵字: BSP 信息技術(shù)
關(guān)閉
關(guān)閉