熱門: 51單片機(jī) | 24小時(shí)必答區(qū) | 單片機(jī)教程 | 單片機(jī)DIY制作 | STM32 | Cortex M3 | 模數(shù)電子 | 電子DIY制作 | 音響/功放 | 拆機(jī)樂園 | Arduino | 嵌入式OS | 程序設(shè)計(jì)
![]() |
發(fā)布時(shí)間: 2020-10-2 21:02
正文摘要:芯片:AT89S52 實(shí)驗(yàn)臺(tái):亞龍YL-236型單片機(jī)控制功能實(shí)訓(xùn)考核裝置 (剛開始學(xué).師傅也不會(huì)) 部分顯示亂碼. 我是按照書上的程序弄的.然后在之前也是同一個(gè)程序但只能顯示字模里面的前十個(gè)漢字. 超這個(gè)范圍 ... |
LCD12864都不會(huì)用,看不懂 |
void disp1(uchar x,y,x1,y1,line,rom,uchar *str) { uchar a,b,c,d,e; wr_lcd(0,0x3f); for(a=0;a<line;a++) { for(b=0;b<rom;b++) { for(c=0;c<x1;c++) { wr_lcd(0,0xb8+x+a*x1+c); wr_lcd(0,0xc0); wr_lcd(0,0x40+y+b*y1); d=a*x1*y1*rom+b*x1*y1+c*y1; for(e=0;e<y1;e++) { wr_lcd(1,~str[d+e]); } } } } } 打臉!程序有點(diǎn)小問題,把上面那個(gè)void disp(---)改成這個(gè) |
void wr_lcd(uchar a,b) { rs=a; rw=0; en=1; P0=b; en=0; } void disp(uchar x,y,x1,y1,line,rom,uchar *str) { uchar a,b,c,d,e; wr_lcd(0,0x3f); for(a=0;a<line;a++) { for(b=0;b<rom;b++) { for(c=0;c<x1;c++) { wr_lcd(0,0xb8+x+a*x1+c); wr_lcd(0,0xc0); wr_lcd(0,0x40+y+b*y1); d=a*x1*y1*rom+b*x1*y1+c*y1; for(e=0;e<y1;e++) { wr_lcd(1,str[d+e]); } } } } } void qpin() { static uchar a,b; for(a=0;a<8;a++) { for(b=0;b<64;b++) { cs1=cs2=1; disp(a,b,1,1,1,1,0x00); } } } void tpxsh() { cs1=1;cs2=0; disp1(0,0,1,64,1,1,tp1); disp1(1,0,1,64,1,1,tp1+64*2); disp1(2,0,1,64,1,1,tp1+64*4); disp1(3,0,1,64,1,1,tp1+64*6); disp1(4,0,1,64,1,1,tp1+64*8); disp1(5,0,1,64,1,1,tp1+64*10); disp1(6,0,1,64,1,1,tp1+64*12); disp1(7,0,1,64,1,1,tp1+64*14); cs1=0;cs2=1; disp1(0,0,1,64,1,1,tp1+64); disp1(1,0,1,64,1,1,tp1+64*3); disp1(2,0,1,64,1,1,tp1+64*5); disp1(3,0,1,64,1,1,tp1+64*7); disp1(4,0,1,64,1,1,tp1+64*9); disp1(5,0,1,64,1,1,tp1+64*11); disp1(6,0,1,64,1,1,tp1+64*13); disp1(7,0,1,64,1,1,tp1+64*15); } uchar code tp1[]={ 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,0xC0,0xE0,0xF0,0xF8, 0xFC,0xFC,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFC,0xFC,0xF8,0xF0,0x60,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, 0x40,0xE0,0xF0,0xF8,0xFC,0xFC,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFC,0xFC,0xF8, 0xF0,0xE0,0x80,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,0x00,0x7E,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x0F,0x07,0x03,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,0x01,0x03,0x07,0x0F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0x3E,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,0x00,0x01,0x07,0x0F,0x1F, 0x3F,0x7F,0xFF,0x7F,0x1F,0x07,0x01,0x00,0x00,0x00,0x00,0x60,0x62,0x34,0x1C,0x1C, 0x9C,0xBC,0xF8,0x78,0x70,0x70,0x60,0x20,0x08,0x00,0x30,0x38,0x30,0x30,0x78,0xF8, 0xFC,0x1C,0x1C,0x1C,0x14,0x36,0x76,0x66,0x66,0x64,0x64,0xE8,0x68,0x60,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x1F,0xFF,0xFF,0x7F,0x3F,0x1F, 0x0F,0x07,0x01,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,0x00,0x00,0x00,0x00,0x00,0x00, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0x83, 0x41,0x21,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x61,0x43,0xC3,0x82,0x02,0x02,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,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,0x80,0xC0,0xE0,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x59,0x9D,0x0C,0x04, 0x82,0x83,0x82,0x82,0x86,0x86,0x84,0x84,0x84,0x8C,0xBC,0x94,0x86,0x86,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0xC3,0x42,0x6E,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xC0,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,0x00,0x00,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x1F,0x1F,0x00, 0x00,0x08,0x19,0x31,0x61,0x61,0x61,0x60,0x60,0x60,0x61,0x21,0x10,0x00,0x00,0x0C, 0x0C,0x04,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,0x80,0xFE,0xFF,0xFF, 0xFE,0xF8,0xF0,0xE0,0x80,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,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0xC0,0x80,0x80,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,0x80,0x80,0xC0,0xE0,0xF0,0xF8,0xFE,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,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,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xFC, 0xF8,0xF8,0xF8,0xF8,0xF0,0xF0,0xF0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0, 0xE0,0xE0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xF8,0xF8,0xF8,0xFC,0xFC, 0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; 自己去定義端口,我寫得有點(diǎn)簡單 |
參與人數(shù) 1 | 黑幣 +20 | 收起 理由 |
---|---|---|
![]() | + 20 | 回帖助人的獎(jiǎng)勵(lì)! |
樓組,亂碼的問題解決了嗎 |
樓主,12864亂碼的問題解決了嗎 |
根據(jù)12864型號(hào)查找相應(yīng)資料,并根據(jù)真值表查找相應(yīng)錯(cuò)誤 |
嗯哼哼? 發(fā)表于 2020-10-8 20:02 先把資料找出來啊 |
hhdsdy 發(fā)表于 2020-10-4 21:37 不行啊..你有qq嘛.我加一下. |
嗯哼哼? 發(fā)表于 2020-10-3 15:25 試得怎么樣?有這款12864的資料嗎? |
hhdsdy 發(fā)表于 2020-10-2 22:37 好的我在試試 |
angmall 發(fā)表于 2020-10-3 09:27 鐵子.不顯示了.沒圖象遼 |
給你改了一下試試。
|
從畫面來看,不是你說的“只能顯示字模里面的前十個(gè)漢字.超這個(gè)范圍就亂碼”,畫面上比較正常顯示的只有“一二三四”,也就是說只有左半屏是正常顯示的,同一個(gè)字符串里的“五”無法正常顯示,說明左右半屏的處理不對(duì),你得看你用的12864具體型號(hào)并找到資料,看看里面左右半屏的片選CS1、CS2是怎樣使用的,然后更改第169行if(right)cs1=0,cs2=1;以及第178行cs1=0,cs2=1;里的片選試試。 |
Powered by 單片機(jī)教程網(wǎng)