#include #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},/* " " */ {0x04,0x28,0x08,0x24,0x32,0x22,0xC2,0x21,0xC2,0x26,0x34,0x38,0x04,0x04,0x08,0x18,0x30,0xF0,0xC0,0x17,0x60,0x10,0x18,0x10,0x0C, 0x14,0x06,0x18,0x04,0x10,0x00,0x00},/*"欢",0*/ {0x02,0x02,0x04,0x82,0xF8,0x73,0x04,0x20,0x02,0x00,0xE2,0x3F,0x42,0x20,0x82,0x40,0x02,0x40,0xFA, 0x3F,0x02,0x20,0x42,0x20,0x22,0x20,0xC2,0x3F,0x02,0x00,0x00,0x00},/*"迎",1*/ {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>1100) offset=0; n=0; } }
|
|
2016-6-16 10:01:33
评论
举报
|
|
|