本帖最后由 wodenishi 于 2016-7-6 15:21 编辑
include <reg52.h>
#define int8 unsigned char
#define int16 unsigned int
#define int32 unsigned long
int8 flag;
int8 n;
int8 code table[][32]={
{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,0x1F,0xE0,0x12,0x40,0x12,0x40,
0x12,0x40,0x12,0x40,0xFF,0xFC,0x12,0x42,
0x12,0x42,0x12,0x42,0x12,0x42,0x3F,0xE2,
0x10,0x02,0x00,0x0E,0x00,0x00,0x00,0x00},/*"电",1*/
{0x24,0x08,0x24,0x10,0x24,0x60,0x25,0x80,
0x7F,0xFF,0xC5,0x00,0x44,0x80,0x00,0x40,
0x24,0x40,0x12,0x40,0x00,0x40,0xFF,0xFF,
0x00,0x80,0x01,0x80,0x00,0x80,0x00,0x00},/*"科",2*/
{0x21,0x04,0x21,0x06,0x3F,0xFC,0x21,0x08,
0x60,0x49,0x2F,0x82,0x00,0x1C,0xFF,0xE0,
0x00,0x02,0x21,0x02,0x21,0x02,0x3F,0xFE,
0x21,0x02,0x61,0x06,0x20,0x02,0x00,0x00},/*"班",3*/
{0x02,0x20,0x0C,0x20,0x88,0x20,0x69,0x20,
0x09,0x20,0x09,0x22,0x89,0x21,0x69,0x7E,
0x09,0x60,0x09,0xA0,0x19,0x20,0x28,0x20,
0xC8,0x20,0x0A,0x60,0x0C,0x20,0x00,0x00},/*"学",4*/
{0x00,0x82,0x03,0x02,0x0C,0x42,0x78,0x42,
0x08,0x42,0x08,0x42,0x08,0x42,0xFF,0xFE,
0x08,0x42,0x08,0x42,0x08,0x42,0x08,0xC2,
0x18,0x42,0x08,0x06,0x00,0x02,0x00,0x00},/*"生",5*/
{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}/* " " */
};
void delay(void);
int16 offset;
void main(void)
{
int8 i;
int8 *p;
flag=0x10;
n=0;
TMOD=0x01;
TH0=0xb1;
TL0=0xe0;
ET0=1;
EA=1;
TR0=1;
p=&table[0][0];
while (1)
{
for (i=0;i<8;i++) //显示左半边屏幕
{
P0=*(p+offset+2*i);
P2=i|0x08; //P2.4=0,P2.3=1 选中U2, 输出扫描码给U6
delay();
P0=*(p+offset+2*i+1);
P2=i|0x10; //P2.4=1,P2.3=0 选中U3, 输出扫描码给U7
delay();
}
for (i=8;i<16;i++) //显示右半边屏幕
{
P0=*(p+offset+2*i);
P2=(i-8)|0x20; //P2.5=1 P2.4=0, P2.3=0 选中U4,输出扫描码U8
delay();
P0=*(p+offset+2*i+1);
P2=(i-8)|0x40; //P2.6=1 P2.5=0, P2.4=0 选中U5,输出扫描码U9
delay();
}
}
}
void delay(void)
{
int16 i;
for (i=0;i<50;i++)
;
}
void
timer0() interrupt 1 using 3
{
TF0=0;
TH0=0xb1;
TL0=0xe0;
if (n<10)
{
n++;
}
else
{
offset+=2;
if (offset>250)
offset=0;
n=0;
}
}
求大神指点,怎么用按键控制,我的这个程序知识信息全部流动显示,不会用按键控制,求大神指点
用事件
一周热门 更多>