中科因仑“3+1”工程特种兵精英论坛
标题:
点阵显示多位汉字
[打印本页]
作者:
SDC158477392
时间:
2014-8-11 09:44
标题:
点阵显示多位汉字
本帖最后由 SDC158477392 于 2014-8-11 11:20 编辑
#include<stc15f2k60s2.h>
#define uchar unsigned char
#define uint unsigned int
uint code Data[]={
0x0440, 0x0E50, 0x7848, 0x0848, 0x0840, 0xFFFE, 0x0840, 0x0844,
0x0A44, 0x0C48, 0x1830, 0x6822, 0x0852, 0x088A, 0x2B06, 0x0000, //我
0x1FF0, 0x1010, 0x1010, 0x1FF0, 0x1010, 0x1010, 0x1FF0, 0x0000,
0xFFFE, 0x0180, 0x1100, 0x11F8, 0x1100, 0x2900, 0x4500, 0x83FE, //是
0x0000, 0x7ffc, 0x4104, 0x4104, 0x4104, 0x5ff4, 0x4104, 0x4304,
0x4284, 0x4644, 0x4424, 0x4834, 0x5024, 0x4004, 0x7ffc, 0x4004, //因
0x0000, 0x0100, 0x0280, 0x0440, 0x0830, 0x101c, 0x6808, 0x0840,
0x08e0, 0x0980, 0x0e00, 0x0808, 0x0808, 0x080c, 0x07f8, 0x0000, //仑
0x0000, 0x0000, 0x7FFC, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0xFFFE, 0x0000, 0x0000, //工
0x0800, 0x1DFC, 0xF104, 0x1104, 0x1104, 0xFDFC, 0x1000, 0x3000,
0x39FE, 0x5420, 0x5420, 0x91FC, 0x1020, 0x1020, 0x13FE, 0x1000, //程
0x0000, 0x1040, 0x53fc, 0x5040, 0x7c40, 0x97fe, 0x1010, 0x1c10,
0x33fe, 0xd010, 0x1110, 0x1090, 0x1090, 0x1010, 0x1050, 0x1020, //特
0x0820, 0x1C20, 0xF020, 0x1020, 0x11FC, 0xFD24, 0x1124, 0x3124,
0x3924, 0x55FC, 0x5524, 0x9020, 0x1020, 0x1020, 0x1020, 0x1020, //种
0x0000, 0x00F0, 0x1F00, 0x1000, 0x1000, 0x1FF8, 0x1080, 0x1080,
0x1080, 0x1080, 0xFFFE, 0x0000, 0x0840, 0x1020, 0x2010, 0x4008 //兵
};
uint Wei[]={ 0x7fff, 0xbfff, 0xdfff, 0xefff,
0xf7ff, 0xfbff, 0xfdff, 0xfeff,
0xff7f, 0xffbf, 0xffdf, 0xffef,
0xfff7, 0xfffb, 0xfffd, 0xfffe};[hide=d2] uchar j=0,k=0,m=0;
void Init_timer()
{
TMOD=0x00;
TL1=65535-1300;
TH1=(65535-1300)>>8;
ET1=1;
TR1=1;
EA=1; //定时器1
}
void Send_Data(uint data1) //送段选
{ uchar i=0;
for(i=0;i<16;i++)
{
P01=0;//SRCLK初始化
P02=data1&0x0001;//SER1赋值
P01=1;; //SRCLK上升沿
data1=data1>>1;
}
}
void Send_WEI(uint wei1) //送位选
{
uchar i=0;
for(i=0;i<16;i++)
{
P04=0; //SRCLK初始化
P05=wei1&0x0001;//SER2赋值
P04=1;; //SRCLK上升沿
wei1=wei1>>1;
}
}
void display()
{ P00=0;//RCLK1初始化
Send_Data(Data[(j+k)%144]);
P00=1; //RCLK1 上升沿
P03=0; //RCLK2 初始化
Send_WEI(Wei[j]);
P03=1; //RCLK2 上升沿
}
void timer1() interrupt 3
{
display();
j++; //每次显示一行数据
if(j==16)
j=0;
m++;
}
void main()
{
Init_timer();
while(1)
{
if(m==200)
{
m=0;
k++;
if(k==128)k=0;
}
}
}
[/hide]
作者:
还你一世界
时间:
2014-8-11 09:50
本帖最后由 SDC158477392 于 2014-8-11 11:26 编辑
买
作者:
杨玉玺
时间:
2014-8-11 09:53
本帖最后由 SDC158477392 于 2014-8-11 11:26 编辑
楼主好样的{:soso_e179:}
欢迎光临 中科因仑“3+1”工程特种兵精英论坛 (http://bbs.enlern.com/)
Powered by Discuz! X3.4