一块8*8点阵显示简单汉字-Arduino中文社区 - Powered by Discuz! Archiver

无限创意 发表于 2017-8-5 11:18

一块8*8点阵显示简单汉字

有朋友说,一块8*8点阵无法显示汉字,要4块点阵组合才能显示汉字。对于显示所有常用汉字来说,也许他是对的。但对于笔画较多的汉字,4块8*8点阵的显示效果也未必好吧?我觉得对于笔画简单的汉字,一块点阵就够了!接线如下:file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpgfile:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image004.jpg file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image006.jpg 显示汉字:人口手刀弓车上下左 8乘8点阵显示简单汉字—在线播放—优酷网,视频高清在线观看file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image008.gifhttp://v.youku.com/v_show/id_XMjk0MDY0MjgwNA==.html?spm=a2h0k.8191407.0.0&from=s1.8-1-1.2 源代码:#define display_array_size 8 #define data_null 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00 #define data_ascii_ren0x01,0x02,0x04,0x08,0xF8,0x04,0x02,0x01 //人#define data_ascii_kou0x7E,0x42,0x42,0x42,0x42,0x42,0x7E,0x00 //口#define data_ascii_shou0x08,0x28,0x6A,0x69,0xFF,0xA8,0x28,0x08 //手#define data_ascii_dao0x42,0x44,0x48,0x50,0x60,0x44,0x42,0x7F //刀#define data_ascii_gong0x80,0xB8,0xA8,0xA8,0xA9,0xA9,0xA9,0xEF //弓#define data_ascii_che0x0A,0x4A,0x5A,0x6A,0xFF,0x4A,0x4A,0x0A //车#define data_ascii_shang 0x01,0x01,0x01,0xFF,0x21,0x21,0x21,0x01//上#define data_ascii_xia0x80,0x80,0x80,0xFF,0xC0,0xA0,0x90,0x80 //下#define data_ascii_zuo0x49,0x51,0x69,0x49,0xCF,0x49,0x49,0x41 //左 byte data_ascii[] = {data_null,data_ascii_ren,data_ascii_kou,data_ascii_shou,data_ascii_dao,data_ascii_gong,data_ascii_che,data_ascii_shang,data_ascii_xia,data_ascii_zuo,};//the pin to control ROWconst int row1 = 2; // the number of therow pin 24const int row2 = 3; // the number of therow pin 23const int row3 = 4; // the number of therow pin 22const int row4 = 5; // the number of therow pin 21const int row5 = 17; // the number of therow pin 4const int row6 = 16; // the number of therow pin 3const int row7 = 15; // the number of therow pin 2const int row8 = 14; // the number of therow pin 1//the pin to control COlconst int col1 = 6; // the number of thecol pin 20const int col2 = 7; // the number of thecol pin 19const int col3 = 8; // the number of thecol pin 18const int col4 = 9; // the number of thecol pin 17const int col5 = 10; // the number of thecol pin 16const int col6 = 11; // the number of thecol pin 15const int col7 = 12; // the number of thecol pin 14const int col8 = 13; // the number of thecol pin 13void displayNum(byte rowNum,int colNum){int j;byte temp = rowNum;for(j=2;j<6;j++){digitalWrite(j, LOW);}digitalWrite(row5, LOW);digitalWrite(row6, LOW);digitalWrite(row7, LOW);digitalWrite(row8, LOW);for(j=6;j<14;j++){digitalWrite(j, HIGH); }switch(colNum){case 1: digitalWrite(col1, LOW); break;case 2: digitalWrite(col2, LOW); break;case 3: digitalWrite(col3, LOW); break;case 4: digitalWrite(col4, LOW); break;case 5: digitalWrite(col5, LOW); break;case 6: digitalWrite(col6, LOW); break;case 7: digitalWrite(col7, LOW); break;case 8: digitalWrite(col8, LOW); break;default: break;}for(j = 1 ;j < 9; j++){temp = (0x80)&(temp) ;if(temp==0){temp = rowNum<<j;continue;}switch(j){case 1: digitalWrite(row1, HIGH); break;case 2: digitalWrite(row2, HIGH); break;case 3: digitalWrite(row3, HIGH); break;case 4: digitalWrite(row4, HIGH); break;case 5: digitalWrite(row5, HIGH); break;case 6: digitalWrite(row6, HIGH); break;case 7: digitalWrite(row7, HIGH); break;case 8: digitalWrite(row8, HIGH); break;default: break;}temp = rowNum<<j;}}void setup(){int i = 0 ;for(i=2;i<18;i++){pinMode(i, OUTPUT);}for(i=2;i<18;i++) {digitalWrite(i, LOW);}}void loop(){int t1;int l;int arrage;for(arrage=0;arrage<10;arrage++){for(l=0;l<512;l++){for(t1=0;t1<8;t1++){displayNum(data_ascii,(t1+1));}}}} 话说回来,我真是很佩服当年制作汉字字库的前辈们!

shifeng3705 发表于 2017-8-9 09:06

点整的程序虽然看起来好写,但是写起来都比较麻烦的,所以,一般写点阵的程序都是用上位机去写,自动生成程序后,修改几个参数调试一下就可以了

shifeng3705 发表于 2017-8-12 21:48

有上拉电阻吗?可以试一下

Anson.Chow 发表于 2017-8-13 20:33

shifeng3705 发表于 2017-8-12 21:48
有上拉电阻吗?可以试一下

当然要电阻啦,你见过8*8点阵不用电阻的吗
页: [1]
查看完整版本: 一块8*8点阵显示简单汉字