16x16LED点阵测试程序+Proteus仿真,有学LED点阵可以参考一下。
- /*************************************************************************
- 16x16 LED点阵显示测试程序
- 说明:由于取模方式,数据传输时按位取反,
- P0 P2行选,P1 P3列选.
- **************************************************************************/
- #include <reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- uchar code table[]=
- {
- 0x00,0x80,0x60,0xF8,0x07,0x40,0x20,0x18,0x0F,0x08,0xC8,0x08,0x08,0x28,0x18,0x00,
- 0x01,0x00,0x00,0xFF,0x00,0x10,0x0C,0x03,0x40,0x80,0x7F,0x00,0x01,0x06,0x18,0x00,
- };//16x16 "你" 纵向字节正序
- uchar table1[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,};
- void delay(uint z)
- {
- uint x,y;
- for(x=z;x>0;x--)
- for(y=110;y>0;y--);
- }
- void display();
- void main()
- {
- while(1)
- {
- display();
- }
- }
- void display()
- {
- uchar i;
- for(i=0;i<8;i++)
- {
- P3=0x00;//关闭高8位列选
- P1=table1[i];
- P0=~table[i];
- P2=~table[i+16];
- delay(2);
- P1=0x00;//关闭低8位列选
- P3=table1[i];
- P0=~table[i+8];
- P2=~table[i+24];
- delay(2);
- }
- }
-
复制代码
下载:
16x16LED点阵测试程序.rar
(15.62 KB, 下载次数: 54)
|