-
Notifications
You must be signed in to change notification settings - Fork 0
/
3.3.c
57 lines (55 loc) · 1.46 KB
/
3.3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/********************************************************************
* 文件名 : 点阵显示.c
* 描述 : 这个代码在点阵上显示相应的图形。
***********************************************************************/
#include <reg52.H>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
//心形显示
unsigned char code tabP0[6][8]={
{0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00},
{0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00},
{0x00,0x00,0x10,0x38,0x38,0x10,0x00,0x00},
{0x00,0x00,0x38,0x7C,0x7C,0x38,0x00,0x00},
{0x00,0x38,0x7C,0x7C,0x7C,0x7C,0x38,0x00},
{0x3C,0x7E,0xFF,0xFF,0xFF,0xFF,0x7E,0x3C}};
unsigned char code tabP2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};
/********************************************************************
* 名称 : Delay_1ms()
* 功能 : 延时子程序,延时时间为 1ms * x
* 输入 : x (延时一毫秒的个数)
* 输出 : 无
***********************************************************************/
void Delay_1ms(uchar i)//1ms延时
{
uchar x,j;
for(j=0;j<i;j++)
for(x=0;x<=148;x++);
}
/********************************************************************
* 名称 : Main()
* 功能 : 主函数
* 输入 : 无
* 输出 : 无
***********************************************************************/
void main()
{
int i,j,k;
while(1)
{
for(j=0;j<6;j++)
{
for(k=0;k<25;k++)
{
for(i=0;i<8;i++)
{
P0=0;
P2=tabP2[i];
P0=tabP0[j][i];
Delay_1ms(2);
}
}
}
}
}