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

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10232|回复: 5

8*8点阵显示简单汉字

[复制链接]
发表于 2017-8-3 22:06 | 显示全部楼层 |阅读模式
8*8点阵显示简单汉字
有朋友说,一块8*8点阵无法显示汉字,要4块点阵组合才能显示汉字。对于显示所有常用汉字来说,也许他是对的。但对于笔画较多的汉字,4块8*8点阵的显示效果也未必好吧?我觉得对于笔画简单的汉字,一块点阵就够了!
接线如下:
file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg
file:///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_shang0x01,0x01,0x01,0xFF,0x21,0x21,0x21,0x01 //
#define data_ascii_xia 0x80,0x80,0x80,0xFF,0xC0,0xA0,0x90,0x80//
#define data_ascii_zuo0x49,0x51,0x69,0x49,0xCF,0x49,0x49,0x41 //
byte data_ascii[][display_array_size] = {
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 ROW
const int row1 = 2; // the number of therow pin 24
const int row2 = 3; // the number of therow pin 23
const int row3 = 4; // the number of therow pin 22
const int row4 = 5; // the number of therow pin 21
const int row5 = 17; // the number of therow pin 4
const int row6 = 16; // the number of therow pin 3
const int row7 = 15; // the number of therow pin 2
const int row8 = 14; // the number of therow pin 1
//the pin to control COl
const int col1 = 6; // the number of thecol pin 20
const int col2 = 7; // the number of thecol pin 19
const int col3 = 8; // the number of thecol pin 18
const int col4 = 9; // the number of thecol pin 17
const int col5 = 10; // the number of thecol pin 16
const int col6 = 11; // the number of thecol pin 15
const int col7 = 12; // the number of thecol pin 14
const int col8 = 13; // the number of thecol pin 13
void 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[arrage][t1],(t1+1));
}
}
}
}
话说回来,我真是很佩服当年制作汉字字库的前辈们!

发表于 2017-8-3 22:14 | 显示全部楼层
图片看不到唉
 楼主| 发表于 2017-8-4 08:39 | 显示全部楼层
file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg
 楼主| 发表于 2017-8-4 09:38 | 显示全部楼层

我已经将图片压缩到100多K了,但就是上传不了
发表于 2017-8-4 11:04 | 显示全部楼层
无限创意 发表于 2017-8-4 09:38
我已经将图片压缩到100多K了,但就是上传不了

呃  那是很奇怪了,一般500K以内的都没问题
 楼主| 发表于 2017-8-5 11:20 | 显示全部楼层
Zoologist 发表于 2017-8-4 11:04
呃  那是很奇怪了,一般500K以内的都没问题

我重新发了,现在有图片了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 13:50 , Processed in 0.077571 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表