这个程序很容易移植更改增加或减少位数
24X24点阵仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)
24X24点阵单片机源码:
- #include<reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- uchar m,n,i,b;
- sbit hang1=P0^5; //上三行
- sbit hang2=P0^6; //中三行
- sbit hang3=P0^7; //下三行
- //选择列
- uchar code lie[24]={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x9f,0x8f,0x1f,0x2f,0x3f,0x4f,0x5f,0x6f,0x7f};
- //楷体
- uchar code hang[8][72]={
- {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xDF,0xFF,0xFF,0xDF,0xEF,0xFF,0xDF,0xF7,0xDF,0xCD,0xFB,0x9F,0xED,0xFC,0xBF,0x00,0xFF,
- 0xFF,0xA2,0xFF,0xBF,0x6E,0xFF,0xCB,0x76,0xFE,0xE7,0xF6,0xFC,0xF7,0xF7,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x80,0x7F,0xFF,0xFF,
- 0x7F,0xFF,0xFF,0xBF,0x7B,0xFF,0xBF,0xF4,0xFE,0x1F,0xCF,0xFC,0xBF,0x1F,0xF8,0xFF,0x7F,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},/*"郑",0*/
- {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC7,0xEF,0xFF,0xE1,0xF7,0xFF,0xFF,0xF9,0x8F,0x07,0xFE,0x1F,0xE0,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xF1,0xFF,0xFF,0xFF,0xFF,0xEF,0xFF,0xFE,0x1F,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF9,0xFF,
- 0xFF,0xF3,0xFF,0xFB,0xFF,0xFF,0x03,0x00,0x80,0xF7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF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xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,},/*"空的",7*/
- };
- void delayms(uint tms)
- {
- uint x,y;
- for(x=tms;x>0;x--)
- for(y=110;y>0;y--);
- }
- main()
- {
- while(1)
- {
- for(m=0;m<7;m++)
- for(b=0;b<24;b++)
- for(n=0;n<2;n++) //n越大走的越慢,可以自行更改
- for(i=0;i<24;i++) //每个字由24X3个字符组成
- {
- hang1=1;
- P2=lie[i];
- P1=hang[m][3*(i+b)];
- hang1=0;
- P1=0xff;
- hang2=1;
- P2=lie[i];
- P1=hang[m][3*(i+b)+1];
- hang2=0;
- P1=0xff;
- hang3=1;
- P2=lie[i];
- P1=hang[m][3*(i+b)+2];
- hang3=0;
- delayms(1);
- P1=0xff;
- }
- }
- }
复制代码
所有资料51hei提供下载:
24X24点阵.rar
(67.03 KB, 下载次数: 97)
|