8*8点阵屏显示数字0-9
一、实验目的
学习掌握点阵显示原理 了解视觉暂留原理及其效果 二、实验原理图
RP1RESPACK-81U119XTAL1P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617C0C1C2C3C4C5C6C72345678919123456789U2A0A1A2A3A4A5A6A7CEAB/BA74LS245B0B1B2B3B4B5B6B71817161514131211R0R1R2R3R4R5R6R718XTAL29RSTAT89C51net=R9C0C1C2C3C4C5C6C712345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7R7R6R5R4R3R2R1R0293031PSENALEEA 三、实验内容
用8*8LED点阵屏循环显示数字 0-9。 四、实验参考程序
#include
#define uchar unsigned char #define uint unsigned int uchar code table_of_digits[]= {
0x00,0x3e,0x41,0x41,0x41,0x3e,0x00,0x00, 0x00,0x00,0x00,0x21,0x7f,0x01,0x00,0x00, 0x00,0x4f,0x89,0x89,0x89,0x71,0x00,0x00, 0x00,0x22,0x49,0x49,0x49,0x36,0x00,0x00, 0x00,0x0c,0x14,0x24,0x7f,0x04,0x00,0x00, 0x00,0x72,0x51,0x51,0x51,0x4e,0x00,0x00,
0x00,0x3e,0x49,0x49,0x49,0x26,0x00,0x00, 0x00,0x40,0x40,0x40,0x4f,0x70,0x00,0x00, 0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00, 0x00,0x32,0x49,0x49,0x49,0x3e,0x00,0x00, };
uchar i=0,t=0,num_index=0;
void main() {
P3=0x80; num_index=0; TMOD=0X00;
TH0=(8192-2000)/32; TL0=(8192-2000)2; TR0=1; IE=0X82; while(1); }
void LED_screen_display() interrupt 1 {
TH0=(8192-2000)/32; TL0=(8192-2000)2; P3=_crol_(P3,1);
P0=~table_of_digits[num_index*8+i]; if(++i==8)i=0; if(++t==250) {
t=0x00;
if(++num_index==10)num_index=0; } }