|
这是我51单片机的课程作业,基于51单片机最小系统板设计的8x8点阵;
附件包括用AD绘制的最小系统板的主板、245/595的连接板、显示板三块板的原理图及PCB图;主板采用USB接口,显示板包括三个部分——8个LED显示、数码管显示、8x8LED灯;
8x8点阵的源程序(keil编写)。
- #include "STC_NEW_8051.H"
- #include<intrins.h>
- #define timeinms 1
- unsigned char scan[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
- unsigned char numcode[]={0x00,0x7e,0x81,0x81,0x81,0x7e,0x00,0x00,
- 0x00,0x00,0x80,0xff,0x82,0x00,0x00,0x00,
- 0x00,0x4f,0x49,0x49,0x49,0x79,0x00,0x00,
- 0x00,0x7f,0x49,0x49,0x49,0x49,0x00,0x00,
- 0x00,0x10,0x10,0x7e,0x10,0x12,0x1c,0x00,
- 0x00,0x00,0x7a,0x4a,0x4a,0x4f,0x00,0x00,
- 0x00,0x60,0x92,0x92,0x92,0x7c,0x00,0x00,
- 0x00,0x3e,0x02,0x02,0x02,0x00,0x00,0x00,
- 0x00,0x6c,0x92,0x92,0x92,0x6c,0x00,0x00,
- 0x00,0x6c,0x92,0x92,0x92,0x8c,0x00,0x00,
- };
- void delayms(unsigned int);
- unsigned char Getpixel(unsigned char,unsigned char);
- void main()
- {
- unsigned char i=0;
- unsigned char k=0;
- unsigned char c=0;
- while(1)
- {
- for(i=0;i<8;i++)
- {
-
- P2 = scan[i];
- P0=Getpixel(c,i);
- delayms(timeinms);
- }
- k++;
- if(k>200)
- {
- k=0;
- c++; }
- if(c==10)
- {
- c=0;}
- }
- }
- unsigned char Getpixel(unsigned char k,unsigned char col)
- { return numcode[k*8+col];
- }
- void delayms(unsigned int t)
- {
- unsigned int i,j;
- for(i=0;i<t;i++)
- {
- for(j=0;j<2150;j++);
- }
- }
复制代码
|
-
-
245 595.7z
7.44 MB, 下载次数: 69, 下载积分: 黑币 -5
连接板
-
-
STC USB.7z
7.14 MB, 下载次数: 74, 下载积分: 黑币 -5
最小系统板
-
-
显示.7z
8.25 MB, 下载次数: 77, 下载积分: 黑币 -5
显示板
评分
-
查看全部评分
|