74ls245和8*8点阵仿电梯原理图如下图1,现在要用max7219点阵原理图驱动点阵,数据串行输入,

单片机8 8点阵设计_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
单片机8 8点阵设计
上传于||暂无简介
阅读已结束,如果下载本文需要使用5下载券
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩15页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢8X8_LED点阵显示的设计_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
8X8_LED点阵显示的设计
上传于||文档简介
&&有​关​单​片​机​的
阅读已结束,如果下载本文需要使用0下载券
想免费下载更多文档?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩19页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢查看: 7776|回复: 20
MAX7219控制8*8点阵,求大神指导!
本人新手,最近刚刚开始上手arduino,在一本教材上看到有一个max7219控制8*8点阵实现滚动消息的教程。
连接图如下:
111111.jpg (138.93 KB, 下载次数: 35)
23:38 上传
代码如下:
[pre lang=&arduino& line=&1&]#include &avr/pgmspace.h&
#include &TimerOne.h&
int DataPin = 2; // Pin 1 on MAX
int LoadPin = 3; // Pin 12 on MAX
int ClockPin = 4; // Pin 13 on MAX
byte buffer[8];
static byte font[][8] PROGMEM = {
// The printable ASCII characters only (32-126)
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B},
{B, B, B, B, B, B, B, B}
void clearDisplay() {
for (byte x=0; x&8; x++) {
buffer[x] = B;
screenUpdate();
void initMAX7219() {
pinMode(DataPin, OUTPUT);
pinMode(LoadPin, OUTPUT);
pinMode(ClockPin, OUTPUT);
clearDisplay();
writeData(B, B); // scan limit set to 0:7
writeData(B, B); // decode mode off
writeData(B, B); // Set shutdown register to normal operation
writeData(B, B); // Values 0 to 15 only (4 bit)
void writeData(byte MSB, byte LSB) {
digitalWrite(LoadPin, LOW); // set loadpin ready to receive data
// Send out MSB
for (mask = B; mask&0; mask&&=1) { //iterate through bit mask
digitalWrite(ClockPin, LOW);
if (MSB & mask){ // if bitwise AND resolves to true
digitalWrite(DataPin,HIGH); // send 1
else{ //if bitwise and resolves to false
digitalWrite(DataPin,LOW); // send 0
digitalWrite(ClockPin, HIGH); // clock high, data gets input
// send out LSB for data
for (mask = B; mask&0; mask&&=1) { //iterate through bit mask
digitalWrite(ClockPin, LOW);
if (LSB & mask){ // if bitwise AND resolves to true
digitalWrite(DataPin,HIGH); // send 1
else{ //if bitwise and resolves to false
digitalWrite(DataPin,LOW); // send 0
digitalWrite(ClockPin, HIGH); // clock high, data gets input
digitalWrite(LoadPin, HIGH); // latch the data
digitalWrite(ClockPin, LOW);
void scroll(char myString[], int spd) {
byte firstChrRow, secondChrR
byte chrPointer = 0; // Initialise the string position pointer
byte Char1, Char2; // the two characters that will be displayed
byte scrollBit = 0;
byte strLength = 0;
// Increment count till we reach the string
while (myString[strLength]) {strLength++;}
counter = millis();
while (chrPointer & (strLength-1)) {
time = millis();
if (time & (counter + spd)) {
Char1 = myString[chrPointer];
Char2 = myString[chrPointer+1];
for (byte y= 0; y&8; y++) {
firstChrRow = pgm_read_byte(&font[Char1 - 32][y]);
secondChrRow = (pgm_read_byte(&font[Char2 - 32][y])) && 1;
ledOutput = (firstChrRow && scrollBit) | (secondChrRow &&(8 - scrollBit) );
buffer[y] = ledO
scrollBit++;
if (scrollBit & 6) {
scrollBit = 0;
chrPointer++;
counter = millis();
void screenUpdate() {
for (byte row = 0; row & 8; row++) {
writeData(row+1, buffer[row]);
void setup() {
initMAX7219();
Timer1.initialize(10000); // initialize timer1 and set interrupt period
Timer1.attachInterrupt(screenUpdate);
void loop() {
clearDisplay();
scroll(&ABCDEFG &, 45);
上传之后发现整个点阵全部亮了,对着datasheet把连线和代码检查了半天也觉得没什么问题,于是乎就卡在这里了。跪求各路大神指点迷津
1.建议直接用 arduino拉点阵的几个脚,确定点阵是OK的
2.读取max7219的寄存器看看,个人感觉有可能是你使用的时序除了问题
仅供参考........
zoologist 发表于
1.建议直接用 arduino拉点阵的几个脚,确定点阵是OK的
2.读取max7219的寄存器看看,个人感觉有可能是你使用 ...
点阵没问题,我一个一个试了。
奇怪的是我后来简化了代码,没有用TimerOne库函数,而且先只寻址到7219的DIG0,连的是点阵上的第一列(点阵是共阴极),然后只送了第一列的电平高低进去,比如,结果第一列还是全部亮。
而且更奇怪的是我在整个点阵全亮的时候去调scan limit和intensity,发现根本没有效果,实在是觉得有点诡异。。。。
zoologist 发表于
1.建议直接用 arduino拉点阵的几个脚,确定点阵是OK的
2.读取max7219的寄存器看看,个人感觉有可能是你使用 ...
而且现在突然有点想不通代码,因为7219上dig0~dig7都是是连的共阴点阵上的各列,共阴点阵上的各行又都是接地,而且共阴点阵的阳极是接在一起的,那只要从dig送一个数进去肯定整列的反应都是一样的啊,比如1就是整列亮,0就是整列灭。送一个byte的数进去应该没法控制一列里面某些行亮某些行亮啊,因为它们的阳极都接在一起。
不知道我的思维哪里出了问题。。。。越想越把自己绕进去了
zxyy15717 发表于
而且现在突然有点想不通代码,因为7219上dig0~dig7都是是连的共阴点阵上的各列,共阴点阵上的各行又都是接 ...
建议你画一下电路图吧......没准画着画着就恍然大悟了~
或者就在纸上画,手机拍照传上来大家看看
zoologist 发表于
建议你画一下电路图吧......没准画着画着就恍然大悟了~
或者就在纸上画,手机拍照传上来大家看看
电路图就是传上来这个图片
zxyy15717 发表于
而且现在突然有点想不通代码,因为7219上dig0~dig7都是是连的共阴点阵上的各列,共阴点阵上的各行又都是接 ...
同学,我猜你看的书是《Arduino从基础到实践》,我最近也看到了那部分,不过我没有动手做,无论是数码管还是点阵都是利用了管脚复用,比如说4位一体的数码管,我们一般只能一次点亮一个数码管,但是如果加快点亮的速度,那么由于人的视觉暂留,(一般是1/25秒),我们所看到的就是4个数码管都亮了。。。希望能够帮到你理解
糯米基 发表于
同学,我猜你看的书是《Arduino从基础到实践》,我最近也看到了那部分,不过我没有动手做,无论是数码管还 ...
这个我知道,就是TimerOne库的作用嘛,但是我是64个管同时亮,但是我在送电平的时候是有些管高电平有些管低电平的。后来我把代码简化了,没有任何变化就固定显示一个大写的A,还是64个管全部亮了,所以这个让我有点不理解。
还有就是我看论坛里其他人写的7219的帖子,他们都没有用TimerOne库多路复用。而且他们给的接线图是dig0~dig7连共阴极点阵的行,各seg的引脚连的列。这么连的话岂不是什么反应都不会有??
糯米基 发表于
同学,我猜你看的书是《Arduino从基础到实践》,我最近也看到了那部分,不过我没有动手做,无论是数码管还 ...
不如你也用7219试着做一做,看看有什么问题?可以接着讨论~ :)
自顶,没有做过7219驱动点阵的朋友吗??
Powered by}

我要回帖

更多关于 7219怎么控制点阵 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信