基于單片機的點陣式LED滾動漢字顯示屏仿真設計
利用單片機C語言實現(xiàn)“2008北京歡迎您!”10個字的滾動顯示,阿拉伯數(shù)字和標點符號按16×8點陣編碼,漢字按16×16點陣編碼, “2008北京歡迎您!”字型碼表如下:
{0x00,0x00,0x0C,0x1C,0x10,0x24,0x10,0x24,0x10,0x44,0x10,0x84,0x0F,0x0E,0x00,0x00},
{0x00,0x00,0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},
{0x00,0x00,0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00},
{0x00,0x00,0x0E,0x38,0x11,0x44,0x10,0x84,0x10,0x84,0x11,0x44,0x0E,0x38,0x00,0x00},
{0x00,0x00,0x0E,0x04,0x08,0x0C,0x08,0x0C,0x08,0x08,0x08,0x10,0xFF,0xFE,0x00,0x00},
{0x00,0x00,0x3F,0xFC,0x41,0x02,0x42,0x02,0x06,0x02,0x0E,0x06,0x0C,0x0C,0x00,0x00},
{0x00,0x00,0x20,0x04,0x20,0x08,0x27,0x98,0x24,0xB0,0x24,0x82,0xA4,0x81,0x64,0xFE},
{0x24,0x80,0x24,0x80,0x24,0xA0,0x27,0xB0,0x60,0x1C,0x20,0x08,0x00,0x00,0x00,0x00},
{0x28,0x04,0x24,0x08,0x22,0x32,0x21,0xC2,0x26,0xC2,0x38,0x34,0x04,0x04,0x18,0x08},
{0xF0,0x30,0x17,0xC0,0x10,0x60,0x10,0x18,0x14,0x0C,0x18,0x06,0x10,0x04,0x00,0x00},
{0x02,0x02,0x82,0x04,0x73,0xF8,0x20,0x04,0x00,0x02,0x3F,0xE2,0x20,0x42,0x40,0x82},
{0x40,0x02,0x3F,0xFA,0x20,0x02,0x20,0x42,0x20,0x22,0x3F,0xC2,0x00,0x02,0x00,0x00},
{0x01,0x00,0x02,0x04,0x0C,0x1C,0x3F,0xC0,0xC0,0x1C,0x09,0x02,0x16,0x02,0x60,0x92},
{0x20,0x4A,0x2F,0x82,0x20,0x02,0x24,0x0E,0x22,0x00,0x31,0x90,0x20,0x0C,0x00,0x00},
{0x00,0x00,0x00,0x08,0x1F,0xDC,0x3F,0x08,0x3C,0x00,0x30,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}。
(a)主程序流程圖 (b)中斷服務程序流程圖
圖3. 程序流程圖
動態(tài)掃描顯示程序代碼如下:
while (1)
{for (i=0;i8;i++) //顯示左半邊屏幕
{ P0=*(p+offset+2*i);
P2=i|0x90; //P2.4=1,P2.3=0 選中U3, 輸出掃描碼給U7
delay();
P0=*(p+offset+2*i+1);
P2=i|0x08; //P2.4=0,P2.3=1 選中U2, 輸出掃描碼給U6
delay(); }
for (i=8;i16;i++) //顯示右半邊屏幕
{ P0=*(p+offset+2*i);
P2=(i-8)|0xC0; //P2.6=1 P2.5=0, P2.4=0 選中U5,輸出掃描碼U9
delay();
P0=*(p+offset+2*i+1);
P2=(i-8)|0x20; //P2.5=1 P2.4=0, P2.3=0 選中U4,輸出掃描碼U8
delay();
} }
led顯示器相關文章:led顯示器原理
上拉電阻相關文章:上拉電阻原理
評論