新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 51單片機(jī)16×16點(diǎn)陣(滾動(dòng)顯示)

51單片機(jī)16×16點(diǎn)陣(滾動(dòng)顯示)

作者: 時(shí)間:2016-11-28 來(lái)源:網(wǎng)絡(luò) 收藏
#include

本文引用地址:http://m.butianyuan.cn/article/201611/322632.htm

typedefunsigned char int8 ;

typedefunsignedint int16 ;

typededunsigned long int32 ;

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},

{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},

{0x00,0x01,0x04,0x02,0x1C,0x0C,0xC0,0x3F,0x1C,0xC0,0x02,0x09,0x02,0x16,0x92,0x60,0x4A,0x20,0x82,0x2F,0x02,0x20,0x0E,0x24,0x00,0x22,0x90,0x31,0x0C,0x20,0x00,0x00},

{0x44,0x10,0x44,0x14,0x88,0x54,0x88,0x54,0xD0,0x5F,0x30,0x50,0x60,0x50,0xFE,0x7F,0x40,0x50,0x20,0x90,0xB0,0x9F,0x98,0x92,0x8C,0x94,0x88,0x34,0x80,0x11,0x00,0x00},

{0x82,0x00,0x02,0x01,0x22,0x06,0x22,0x38,0x22,0x04,0x22,0x03,0x22,0x00,0xFE,0xFF,0xA2,0x00,0x22,0x01,0x22,0x02,0x22,0x3C,0x22,0x02,0x02,0x01,0x02,0x00,0x00,0x00},

{0x02,0x00,0x0C,0x00,0xF0,0x3F,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0xA0,0x00,0x60,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00},

{0x80,0x00,0x01,0x07,0x06,0x00,0x18,0x00,0xE0,0xFF,0x00,0x04,0x00,0x03,0x00,0x00,0xFE,0x7F,0x00,0x08,0x00,0x06,0x80,0x01,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00},

{0x00,0x00,0x04,0x20,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x21,0x04,0x20,0x04,0x00,0x00,0x00},

{0x20,0x08,0x20,0x86,0x7F,0x60,0x80,0x0F,0x00,0x04,0x00,0x1A,0x00,0xEA,0x00,0x2A,0x00,0x2A,0x00,0x2A,0x00,0x2A,0xF0,0x2B,0x0C,0x28,0x02,0x20,0x0F,0x00,0x00,0x00},

{0x00,0x00,0x80,0x00,0x04,0x01,0x0E,0x02,0x14,0x0C,0x24,0x70,0xC4,0x21,0x8C,0x00,0x08,0x00,0x08,0x70,0x28,0x08,0x1E,0x06,0x0C,0x03,0x80,0x01,0x00,0x01,0x00,0x00},

{0x00,0x00,0x00,0x08,0xF8,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0xF0,0x49,0x00,0x48,0x04,0x40,0x02,0x40,0xFC,0x7F,0x00,0x00,0x00,0x00},

{0x00,0x00,0x80,0x00,0x04,0x01,0x0E,0x02,0x14,0x0C,0x24,0x70,0xC4,0x21,0x8C,0x00,0x08,0x00,0x08,0x70,0x28,0x08,0x1E,0x06,0x0C,0x03,0x80,0x01,0x00,0x01,0x00,0x00},

{0x40,0x00,0x40,0x08,0x41,0x08,0x42,0x08,0x4C,0x08,0xF8,0x7F,0x50,0x08,0x40,0x08,0x40,0x08,0x60,0x08,0xD0,0x7F,0x4C,0x08,0x47,0x08,0x42,0x08,0x40,0x00,0x00,0x00},

{0x20,0x08,0x20,0x86,0x7F,0x60,0x80,0x0F,0x00,0x04,0x00,0x1A,0x00,0xEA,0x00,0x2A,0x00,0x2A,0x00,0x2A,0x00,0x2A,0xF0,0x2B,0x0C,0x28,0x02,0x20,0x0F,0x00,0x00,0x00},

{0x20,0x00,0x20,0x20,0x20,0x21,0x20,0x23,0x20,0x25,0x20,0x39,0x20,0xE1,0x20,0x21,0xFF,0x2F,0x20,0x21,0x20,0x21,0x20,0x21,0x20,0x21,0x20,0x21,0x20,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x1A,0x00,0x1C,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,0x01,0x04,0x02,0x04,0x04,0x04,0x08,0x04,0x30,0x04,0xC0,0x05,0x00,0xFE,0x80,0x05,0x60,0x04,0x10,0x04,0x0C,0x04,0x06,0x04,0x03,0x04,0x02,0x04,0x00,0x00},

{0x00,0x02,0x40,0x0C,0x40,0x08,0x40,0x48,0x40,0x3A,0x40,0x2A,0x42,0x0A,0x41,0x8A,0xFE,0x7A,0x40,0x2B,0x40,0x0A,0x40,0x18,0x40,0xEA,0x40,0x4C,0x40,0x08,0x00,0x00},

{0x20,0x08,0x30,0x08,0xE0,0xFF,0x42,0x08,0x4C,0x08,0xF0,0x1F,0x10,0x12,0x1A,0x12,0xF2,0x13,0x04,0x10,0xC8,0xFF,0x30,0x10,0xCC,0x50,0x02,0x37,0x1C,0x12,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0E,0x14,0x10,0x24,0x10,0x44,0x10,0x84,0x11,0x0C,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x04,0x02,0x44,0x06,0xC4,0x1A,0x48,0xE3,0x48,0x46,0x48,0x00,0x04,0x09,0x04,0x09,0x08,0x09,0xC8,0xFF,0x30,0x09,0x28,0x49,0x44,0x39,0x02,0x29,0x1F,0x01,0x00,0x00},

{0x00,0x02,0x02,0x42,0x04,0x42,0x08,0x42,0x30,0x42,0xC0,0x7F,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x42,0xFE,0x7F,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x00},

{0x40,0x04,0x80,0x08,0x00,0x11,0xFF,0xEF,0x00,0x44,0x02,0x10,0x82,0x10,0x82,0x10,0x82,0x90,0xFE,0x7F,0x82,0x50,0x82,0x10,0x82,0x10,0x82,0x10,0x02,0x10,0x00,0x00},

{0x00,0x04,0x01,0x04,0x02,0x04,0x04,0x04,0x08,0x04,0x30,0x04,0xC0,0x05,0x00,0xFE,0x80,0x05,0x60,0x04,0x10,0x04,0x0C,0x04,0x06,0x04,0x03,0x04,0x02,0x04,0x00,0x00},

{0x00,0x02,0x40,0x0C,0x40,0x08,0x40,0x48,0x40,0x3A,0x40,0x2A,0x42,0x0A,0x41,0x8A,0xFE,0x7A,0x40,0x2B,0x40,0x0A,0x40,0x18,0x40,0xEA,0x40,0x4C,0x40,0x08,0x00,0x00},

{0x20,0x08,0x30,0x08,0xE0,0xFF,0x42,0x08,0x4C,0x08,0xF0,0x1F,0x10,0x12,0x1A,0x12,0xF2,0x13,0x04,0x10,0xC8,0xFF,0x30,0x10,0xCC,0x50,0x02,0x37,0x1C,0x12,0x00,0x00},

{0x00,0x00,0x00,0x00,0x1A,0x00,0x1C,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,0x02,0x00,0x42,0x00,0x32,0xFE,0x23,0x04,0x00,0x08,0x44,0xFF,0x55,0x50,0x55,0x50,0x55,0x50,0xFD,0x52,0x55,0x51,0x55,0xFE,0x55,0x00,0x44,0x00,0x04,0x00,0x00},

{0x00,0x01,0x04,0x02,0x1C,0x0C,0xC0,0x3F,0x1C,0xC0,0x02,0x09,0x02,0x16,0x92,0x60,0x4A,0x20,0x82,0x2F,0x02,0x20,0x0E,0x24,0x00,0x22,0x90,0x31,0x0C,0x20,0x00,0x00},

{0x82,0x00,0x02,0x01,0x22,0x06,0x22,0x38,0x22,0x04,0x22,0x03,0x22,0x00,0xFE,0xFF,0xA2,0x00,0x22,0x01,0x22,0x02,0x22,0x3C,0x22,0x02,0x02,0x01,0x02,0x00,0x00,0x00},

{0x01,0x08,0xC2,0x08,0x44,0x0F,0x28,0xF8,0x30,0x08,0xCE,0x0F,0x04,0x01,0x00,0x41,0x02,0x41,0x01,0x41,0xFE,0x4F,0x00,0x51,0x00,0x61,0x00,0x41,0x00,0x01,0x00,0x00},

{0x42,0x08,0x81,0x08,0xFE,0xFF,0x00,0x09,0x01,0x0A,0x01,0x01,0x02,0x11,0x0C,0x11,0x30,0x11,0xC0,0xFF,0x30,0x11,0x08,0x11,0x06,0x11,0x03,0x11,0x02,0x01,0x00,0x00},

{0x20,0x08,0xC0,0x48,0x00,0x4B,0xFF,0x7F,0x00,0x89,0x9C,0x88,0x00,0x10,0xBC,0x2A,0x82,0xCA,0xC2,0x4A,0xB2,0x5A,0x82,0x6A,0xAE,0x0A,0x90,0x0F,0x0C,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0xFA,0x0F,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}

};

voiddelay(void);

int16 offset;

voidmain(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();

}

}

}

voiddelay(void)

{

int16 i;

for(i=0;i<50;i++)

;

}

voidtimer0() interrupt 1using3

{

TF0=0;

TH0=0xb1;

TL0=0xe0;

if(n<10)

{

n++;

}

else

{

offset+=2;

if(offset>1100)

offset=0;

n=0;

}

}



評(píng)論


技術(shù)專區(qū)

關(guān)閉