📄 +
字号:
/*******************************************************************/
/* */
/* ME单片机学习/开发系统演示程序 - 8*8 LED 点阵 */
/* */
/* MCU:STC89C52 ,晶体频率:11.0592MHz */
/* */
/* Email:920200246@QQ.COM */
/* */
/* QQ:920200246 */
/* */
/* */
/* */
/*******************************************************************/
#include <reg52.H>
#define uchar unsigned char
#define uint unsigned int
//0-9字模
unsigned char disp[][8]={
{0x0c,0x12,0x22,0x44,0x22,0x12,0x0c,0x00},
{0x00,0x00,0x3e,0x41,0x41,0x3e,0x00,0x00},//0
{0x00,0x40,0x44,0x7e,0x7f,0x40,0x40,0x00},//1
{0x00,0x00,0x66,0x51,0x49,0x46,0x00,0x00},//2
{0x00,0x00,0x22,0x41,0x49,0x36,0x00,0x00},//3
{0x00,0x10,0x1c,0x13,0x7c,0x7c,0x10,0x00},//4
{0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00},//5
{0x00,0x00,0x3e,0x49,0x49,0x32,0x00,0x00},//6
{0x00,0x03,0x01,0x71,0x79,0x07,0x03,0x00},//7
{0x00,0x00,0x36,0x49,0x49,0x36,0x00,0x00},//8
{0x00,0x00,0x26,0x49,0x49,0x3e,0x00,0x00},//9
};
#define rowp P0
#define colp P2
uchar speed=60; //显示速度
//延时函数
void delay1ms(uchar x)
{
int i,j;
for(i=0;i<x;i++)
for (j=0;j<120;j++);
}
//主程序
void main()
{
uchar i,j,k,scan;P2=0xef;
while(1)
{
for(i=0;i<11;i++)
for (k=0;k<speed;k++)
{
scan=0x01;
for(j=0;j<8;j++)
{
rowp=0x00;
colp=~scan;
rowp=disp[i][j];
delay1ms(2);
scan<<=1;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -