Arduino与Proteus仿真实例-MAX7219单个8x8LED点阵驱动仿真

MAX7219单个8x8LED点阵驱动仿真

LED 矩阵或 LED 显示器是一种大型、低分辨率形式的点阵显示器,可用于工业和商业信息显示以及业余爱好者的人机界面。 它由一个二维二极管矩阵组成,其阴极按行连接,阳极按列连接(反之亦然)。

在这里插入图片描述

MAX7219/MAX7221是紧凑型串行输入/输出共阴极显示驱动器,可将微处理器(μPs)连接到多达8位的7段数字LED显示器、条形图显示器或64个独立LED。

Max7219与LED点阵的接线如下:

在这里插入图片描述

在前面的文章中已经对7段数码管和MAX7219做了详细的介绍,请参考:

2、仿真电路原理图

在这里插入图片描述

4、仿真代码实现

本次仿真代码使用到如下开源库:

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
//We always have to include the library
#include "LedControl.h"
/\*
Now we need a LedControl to work with.
\*\*\*\*\* These pin numbers will probably not work with your hardware \*\*\*\*\*
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
\*/
LedControl lc=LedControl(12,10,11,1);

/\* we always wait a bit between updates of the display \*/
unsigned long delaytime=300;

void setup() {
/\*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
\*/
lc.shutdown(0,false);
/\* Set the brightness to a medium values \*/
lc.setIntensity(0,10);
/\* and clear the display \*/
lc.clearDisplay(0);
}

void displayImage(const byte\* image) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
lc.setLed(0, i, j, bitRead(image[i], 7 - j));
}
}
}
void display\_digis(){
int i = 0;
do{
displayImage(DIGIS[i]);
i++;
delay(delaytime);
}while(i < DIGIS_LEN);
}

void loop() {
display\_digis();
}


数字的点阵数据如下:

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const byte DIGIS[][8] = {
{ // 1
B00010000,
B00110000,
B00010000,
B00010000,
B00010000,
B00010000,
B00010000,
B00111000
},{ // 2
B00111000,
B01000100,
B00000100,
B00000100,
B00001000,
B00010000,
B00100000,
B01111100
},{ // 3
B00111000,
B01000100,
B00000100,
B00011000,
B00000100,
B00000100,
B01000100,
B00111000
},{ // 4
B00000100,
B00001100,
B00010100,
B00100100,
B01000100,
B01111110,
B00000100,
B00000100
},{ // 5
B01111100,
B01000000,
B01000000,
B01111000,
B00000100,
B00000100,
B01000100,
B00111000
},{ // 6
B00111000,
B01000100,
B01000000,
B01111000,
B01000100,
B01000100,
B01000100,
B00111000
},{ // 7
B01111100,
B00000100,
B00000100,
B00001000,
B00010000,
B00100000,
B00100000,
B00100000
},{ // 8
B00111000,
B01000100,
B01000100,
B00111000,
B01000100,
B01000100,
B01000100,
B00111000
},{ // 9
B00111000,
B01000100,
B01000100,
B01000100,
B00111100,
B00000100,
B01000100,
B00111000
},{ // 0
B00111000,
B01000100,
B01000100,
B01000100,
B01000100,
B01000100,
B01000100,
B00111000
}};
const int DIGIS_LEN = sizeof(DIGIS)/8;

3、仿真结果

在这里插入图片描述

文章来源: https://iotsmart.blog.csdn.net/article/details/120929860