帮忙看下怎么修改啊 ,我修改了一点,但是添加的屏还是显示不出字,而且仿真图上出现完郭雪培会出现一段乱码再循环,我也不明白为什么??
#include <AT892051.H>
#define uchar unsigned char
#define uint unsigned int
#define SPEED 1 //移动数度快慢值
uchar col,disrow;
uint word;
uchar code HZ[];
uchar BUFF[12]; //buff[]为要显示的数字*2+2
void loadoneline(void);
void sendoneline(void);
/*******根据列指针,由双字节合并为单字节的子程序模块************/
uchar two_onebyte(uchar h1,uchar h2)
{
uchar temp,tempcol;
if(col<8) tempcol=col;
else tempcol=col-8;
temp=(h1<<tempcol)|(h2>>(8-tempcol));
temp=255-temp;
return temp;
}
/****************************主函数***************************/
void main(void)
{
uchar i;
col=0;word=0;
while(1)
{
while(col<16)// 循环16次,点亮并移动一个汉字
{
for(i=0;i<SPEED;i++)//汉字在屏幕上的停留时间(即移动速度快慢)
{
for(disrow=0;disrow<16;disrow++)//扫描16行
{
loadoneline();//装载一线点阵数据
sendoneline();//发送一线点阵数据
P1_4=1; //消影。 E接在P2_4 ,=1;
P1=0x10+disrow;// 点亮屏幕
P1=0x20+disrow;
}
}
col++; //列指针递增
}
col=0;word=word+32;// 一个汉字移动后,指向下一个汉字
if(word>=175)word=0;// 移动50个汉字后,重新开始
}
}
/**************装载一线点阵数据****************/
void loadoneline(void)
{
uchar s;
for(s=0;s<6;s++) //s为要显示的数字+1
{
BUFF[2*s]=HZ[word+32*s+2*disrow];
BUFF[2*s+1]=HZ[word+1+32*s+2*disrow];
}
}
/***************发送一线点阵数据*******************/
void sendoneline(void)
{
char s;uchar inc;
if(col<8)inc=0;else inc=1;
for(s=11+inc;s>=0+inc;s--) //s*2为要显示的数字+1
{
SBUF=two_onebyte(BUFF,BUFF[s+1]);
while(!ti);TI=0;
}
}
/***********************汉字点阵码*************************/
uchar code HZ[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//=============================================================================
//**************************************************************************
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/****************************************************************************/
0x10,0x00,0x08,0x7C,0xFF,0x44,0x00,0x48,0x7E,0x48,0x42,0x50,0x7E,0x48,0x00,0x48,
0x7E,0x44,0x04,0x44,0x08,0x44,0x0F,0x68,0xF8,0x50,0x08,0x40,0x28,0x40,0x10,0x40,/*"郭",0*/
0x3F,0xF8,0x01,0x00,0x7F,0xFE,0x41,0x02,0x9D,0x74,0x01,0x00,0x1D,0x70,0x00,0x00,
0x3F,0xF8,0x00,0x08,0x00,0x08,0x1F,0xF8,0x00,0x08,0x00,0x08,0x3F,0xF8,0x00,0x08,/*"雪",1*/
0x10,0x40,0x10,0x20,0x11,0xFC,0x10,0x00,0x11,0x08,0xFC,0x90,0x10,0x00,0x13,0xFE,
0x10,0x00,0x10,0x00,0x11,0xFC,0x1D,0x04,0xE1,0x04,0x41,0x04,0x01,0xFC,0x01,0x04,/*"培",2*/
0x04,0x40,0x0E,0x50,0x78,0x48,0x08,0x48,0x08,0x40,0xFF,0xFE,0x08,0x40,0x08,0x44,
//============================================================================
};
-
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>