您还计划买落伍的单色点阵屏?还是用双基色的吧(实际可显示三种基本颜色)!
不过提示一下,若您要亲手焊接那么光16*32就需要纵横跨接众多线、需要很多时间和一定毅力,管脚要了解清楚哦、还只能显示2个字,不过感到欣慰的是下面是高亮双色的,呵呵...
(自己呆在家里看就行了,挂到外面展示只能出洋相... 以下是一个简单的程序演示此图片的)
用8*8制作点阵是一件很兴奋而辛苦的事,3.75mm以上点阵还须加中功率三极管或场效应管(推荐)驱动,16*32动态显示电流实测300多~600MA之间,全显近1A(电脑USB线电源掉到4.4~4.6V,最好采用外电源求稳定,避免电脑负荷吃不消)。2个74138输出采用场效应管驱动,8个595列。
驱动电路(仅供参考):
微控实验网已推出双基色高亮点阵模块、性价比很高>> http://www.mcusy.cn/Product_Show.asp?id=28
参考程序:
//*********************************************************************
//程序说明:16*32双基色8*8点阵屏演示程序01
// E-mail : mcusy_cn@126.com /Sidney
//电路说明:采用STC89C52单片机,24M晶体;16*32双基色点阵屏需要用154或2个138输出16行,8个595列。
//效果说明:显示8个汉字,每2个轮换显示:“欢迎使用双色点阵”,红、绿、橙色三色轮流变化。
//********************************************************************
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
//---------------------------------------------------------------------------------
sbit SI=P3^0;
sbit SCK=P3^1;
sbit STR=P3^3;
sbit STG=P3^2;
sbit EN=P1^4;
uchar j,i,g;
//---------------------------------------------------------------------------------
uchar code table0[][32]={
/*-- 文字: 欢 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x80,0x00,0x80,0xFC,0x80,0x05,0xFE,0x85,0x04,0x4A,0x48,0x28,0x40,0x10,0x40,
0x18,0x40,0x18,0x60,0x24,0xA0,0x24,0x90,0x41,0x18,0x86,0x0E,0x38,0x04,0x00,0x00,
/*-- 文字: 迎 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x00,0x21,0x80,0x36,0x7C,0x24,0x44,0x04,0x44,0x04,0x44,0xE4,0x44,0x24,0x44,
0x25,0x44,0x26,0x54,0x24,0x48,0x20,0x40,0x20,0x40,0x50,0x00,0x8F,0xFE,0x00,0x00,
};
uchar code table1[][32]={
/*-- 文字: 使 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x08,0x40,0x0C,0x40,0x1B,0xFE,0x10,0x40,0x37,0xFC,0x64,0x44,0xA4,0x44,0x27,0xFC,
0x24,0x44,0x22,0x40,0x21,0x80,0x20,0x80,0x21,0x70,0x22,0x1E,0x2C,0x04,0x00,0x00,
/*-- 文字: 用 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x1F,0xFC,0x10,0x84,0x10,0x84,0x10,0x84,0x1F,0xFC,0x10,0x84,0x10,0x84,
0x10,0x84,0x1F,0xFC,0x10,0x84,0x10,0x84,0x20,0x84,0x20,0x94,0x40,0x8C,0x00,0x00,
};
uchar code table2[][32]={
/*-- 文字: 双 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x00,0x00,0x00,0x30,0x0C,0xD0,0x74,0x10,0x25,0x10,0x14,0xA0,0x08,0x40,
0x08,0x40,0x14,0xA0,0x25,0x18,0xC2,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: 色 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x02,0x00,0x02,0x00,0x07,0xC0,0x08,0x80,0x11,0x00,0x03,0xE0,0x1E,0x20,0x12,0x40,
0x13,0xC0,0x1C,0x00,0x10,0x04,0x10,0x04,0x10,0x04,0x0F,0xF8,0x00,0x00,0x00,0x00,
};
uchar code table3[][32]={
/*-- 文字: 点 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x02,0x00,0x02,0x60,0x03,0x80,0x02,0x00,0x02,0x00,0x03,0xE0,0x0C,0x20,
0x08,0x20,0x0F,0xC0,0x00,0x00,0x48,0x90,0x44,0x4C,0x80,0x04,0x00,0x00,0x00,0x00,
/*-- 文字: 阵 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x18,0x40,0x68,0x70,0x4B,0x80,0x50,0x80,0x49,0x40,0x6A,0x78,0x5B,0xC0,
0x40,0x40,0x40,0x7E,0x4F,0xC0,0x40,0x40,0x40,0x40,0x00,0x40,0x00,0x40,0x00,0x00,
};
uchar code table4[][32]={
/*-- 文字: 点 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x02,0x00,0x02,0x60,0x03,0x80,0x02,0x00,0x02,0x00,0x03,0xE0,0x0C,0x20,
0x08,0x20,0x0F,0xC0,0x00,0x00,0x48,0x90,0x44,0x4C,0x80,0x04,0x00,0x00,0x00,0x00,
/*-- 文字: 阵 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x18,0x40,0x68,0x70,0x4B,0x80,0x50,0x80,0x49,0x40,0x6A,0x78,0x5B,0xC0,
0x40,0x40,0x40,0x7E,0x4F,0xC0,0x40,0x40,0x40,0x40,0x00,0x40,0x00,0x40,0x00,0x00,
};
//------------------------------------------------------------------------------
void delay(uint g)
{
uint m,s;
for(m=0;m<g;m++)
for(s=0;s<30;s++);
}
//------------------------------------------------------------------------------
void send_dat(uchar temp)//发送
{
uchar j;
for(j=0;j<8;j++)
{
SI=~temp&0x01; //~temp显示不反白,把0x01改成0X80字体将反白
SCK=0;SCK=1;
temp=temp>>1;
}
}
void dis_red(void)//------锁存函数
{
EN=1; //关显示
STR=1;STG=0; //开红色、关绿色
P1=i;
STR=0;STG=0;
EN=0; //开显示
}
void dis_green(void)
{
EN=1;
STR=0;STG=1; //开绿色、关红色
P1=i;
STR=0;STG=0;
EN=0;
}
void dis_orange(void)
{
EN=1;
STR=1;STG=1; //开红+绿色=橙色
P1=i;
STR=0;STG=0;
EN=0;
}
//------------------------------------------------------------------------------
void display(uchar *data1,uchar *data2)
{
uchar num;
for(num=0;num<30;num++)
{
for(i=0;i<16;i++)
{
send_dat(data2[2*i+1]);send_dat(data2[2*i]);//字体的位置,可调整
send_dat(data1[2*i+1]);send_dat(data1[2*i]);
dis_red();
delay(5);
}
}
for(num=0;num<30;num++)
{
for(i=0;i<16;i++)
{
send_dat(data2[2*i+1]);send_dat(data2[2*i]);
send_dat(data1[2*i+1]);send_dat(data1[2*i]);
dis_green();
delay(5);
}
}
for(num=0;num<30;num++)
{
for(i=0;i<16;i++)
{
send_dat(data2[2*i+1]);send_dat(data2[2*i]);
send_dat(data1[2*i+1]);send_dat(data1[2*i]);
dis_orange();
delay(5);
EN=0;
}
}
}
//===========================主函数==========================//
void main()
{
while(1)//-----以下是调用显示函数
{
display(table0[0],table0[1]);delay(5000);
display(table1[0],table1[1]);delay(5000);
display(table2[0],table2[1]);delay(5000);
display(table3[0],table3[1]);delay(20000);
}
}