Pages: [1] 2   Go Down
Author Topic: max7219, tutorial mistake?  (Read 3070 times)
0 Members and 1 Guest are viewing this topic.
q
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

i've read this tutorial about arduino and max7219 but i've a little problem(doubt)
http://www.arduino.cc/playground/LEDMatrix/Max7219

in this tutorial columns are from A-G(0..6) to DP(7) but A column don't match to the first matrix column, is the same for the third and fourth column.

i tried to modify the circuit and it work perfectly.

COLUMN ...... MAX7219 PIN
1...................pin G
2...................pin F
3...................pin E
4...................pin D
5...................pin C
6...................pin B
7...................pin A
8...................pin DP

I don't understood the tutorial or there is an error ?

first prototype 3x3
« Last Edit: November 29, 2007, 05:51:21 pm by q » Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi q,
you are right, it's a mistake in the tutorial.
The columns are in this order:
DP A B C D E F G

The piece of math presented in the pdf
is wrong too, because the author got the order of the segments wrong.

Here is the relationship between the bits and segments :
DP -> 128
A -> 64
B -> 32
C -> 16
D -> 8
E -> 4
F -> 2
G -> 1

Eberhard
Logged

q
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yeah  ;D

i hope that someone will edit pdf.

thanks to confirm it
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi q,
Quote
i hope that someone will edit pdf.
...until that day there is now a waring sign on the playground article.

Thanks for reporting the error !
Eberhard
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...and if these are your first steps with the MAX72XX here is an article you might be interested in :
http://www.arduino.cc/playground/Main/MAX72XXHardware
I have uploaded it just two hours ago,so if you find any mistakes,  :'( please let me know.

Eberhard
Logged

q
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there is an error again in the wiring.



rows are inverted and columns dosen't match.

that's the correct columns wiring
COLUMN ...... MAX7219 PIN  
1...................pin G  
2...................pin F
3...................pin E
4...................pin D
5...................pin C
6...................pin B
7...................pin A
8...................pin DP
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi q,
Well its not really an error, it simply depends how you define the correct order of rows and columns.

Lets start with the columns:
The leds in a single row are turned on by sending a byte to the MAX72XX. The each of the 8 bits in the data resemble a single Led in this row.
The highest bit (bit7) in the data-byte will drive pin SegDP, bit6 will drive SegA, this goes on in the order seen in the schematic above.
Please have a look at the Max7221 datasheet, Table 6 on the bottom of Page 8 which is the same thing in tabular form.
The nice thing about this layout is that you can write down the data in binary encoding and it is obvious which Led is switched on.
Example:
The databyte
B10001000
will switch the Led SegDP and SegD on, all others off. You know it from siomply looking at the value.
The pins in the schematic are layed out so that they are the best match for binary encoded and even hex-encoded values.

I find this layout much more natural than the one used in the example-code you are refering to.

The same is true for the rows. In my schematic I choose a layout where row Dig0 is at the top. If you rather have this row at the bottom thats fine. The only thing that counts is, when I send the command Dig0 to the MAX7221 it will change the Leds in row Dig0. That's all. A schematic says nothing about the physical layout of the Leds.

I drew the schematic so that it matches the code from my own (LedControl) library. The code-example you seem to be using might drive different leds instead, This is a code- not a hardware-issue.

Eberhard
Logged

q
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, but the other tutorial,the library and code use dig 0 for the first(bottom) rows, is the same for the columns.

i don't say that's is an error but someone can be confused with this ambiguity.

my wiring
   maxSingle(1,1);                       //  + - - - - - - -
   maxSingle(2,2);                       //  - + - - - - - -
   maxSingle(3,4);                       //  - - + - - - - -
   maxSingle(4,8);                       //  - - - + - - - -
   maxSingle(5,16);                     //  - - - - + - - -
   maxSingle(6,32);                     //  - - - - - + - -
   maxSingle(7,64);                     //  - - - - - - + -
   maxSingle(8,128);                   //  - - - - - - - +


your wiring
   maxSingle(1,1);                       //  - - - - - - - +
   maxSingle(2,2);                       //  - - - - - - + -
   maxSingle(3,4);                       //  - - - - - + - -
   maxSingle(4,8);                       //  - - - - + - - -
   maxSingle(5,16);                     //  - - - + - - - -
   maxSingle(6,32);                     //  - - + - - - - -
   maxSingle(7,64);                     //  - + - - - - - -
   maxSingle(8,128);                   //  + - - - - - - -


also i prefer to have a matrix like real xy axis with bottom left origin.
I think that's is much correct but i'm absolutely new about this than i can wrong.
However is much better if we have a wiring code and consistency in all of turoial, you can add other wiring like an options.

tell me what do you think?
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Quote
yes, but the other tutorial,the library and code use dig 0 for the first(bottom) rows, is the same for the columns.
I decided to put the origin of the matrix into the top left corner because:
  • If you speak of rows and colmuns everybody imagines some like a spreadsheet
  • In the mathematical matrix the origin is top,left
  • All basic computer graphics programming uses the top/left origin,
From there I think the top/left origin is a bit more natural
You had this example
Quote
my wiring
   maxSingle(1,1);                       //  + - - - - - - -
   maxSingle(2,2);                       //  - + - - - - - -
   maxSingle(3,4);                       //  - - + - - - - -
   maxSingle(4,8);                       //  - - - + - - - -
   maxSingle(5,16);                     //  - - - - + - - -
   maxSingle(6,32);                     //  - - - - - + - -
   maxSingle(7,64);                     //  - - - - - - + -
   maxSingle(8,128);                   //  - - - - - - - +

With only one Led on, there is no real gain from my wiring, but what if you want something more complicated like a filled triangle pointing right?
This is my wiring:
maxSingle(1, B10000000);
maxSingle(2, B11000000);
maxSingle(3, B11100000);
maxSingle(4, B11110000);
maxSingle(5, B11100000);
maxSingle(6, B11000000);
maxSingle(7, B10000000);
maxSingle(8, B00000000);

You can't do that with your wiring since only decimal values make sense
maxSingle(1,128);
maxSingle(2,192);
maxSingle(3,224);
maxSingle(4,240);
maxSingle(5,224);
maxSingle(6,192);
maxSingle(7,128);
maxSingle(8,0);

With my wiring you need to type more and think less :-)
This whole thing is really is up to personal preferences.

Quote
However is much better if we have a wiring code and consistency in all of turoial, you can add other wiring like an options.
tell me what do you think?
I had a look at the Matrix-library this morning and was surprised that it doesn't even work on a MAX7221 without some minor modifications.
I have not yet found out how they organize their rows/columns thing.
There is no wiring information at at all and it seems they programming is for a specific Ledmatrix product since I found this comment in the sources
Code:
 // wrap shift relative x for nexus module layout
  if (x == 0){
    x = 8;
  }
  --x;
This quirk isn't even documented.

The docs from the other playground article has a mistake in the wiring, (otherwise we wouldn't discuss this topic here).

So what is the  correct wiring?I don't know!
I think I will update my playground article with some notice on alternative wiring options and explain that this really is a software thing.

And one more on the row-issue:
The Matrix-Lib uses the index value 0..7 for addressing the rows
The playground article uses 1..8
You see 3 pieces of code 3 different solutions and all of them correct.

Eberhard
Logged

q
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 :o

i understand, but now i'm confused ...

i must use the matrix to understand what wiring is better than.

also, i don't know how can i manipulate the matrix in real time but i will open another post for this question.

Q
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Quote
:o
i understand, but now i'm confused ...
sorry about that, but the confusion will quickly go away once you see the first led's light up :-)

This is really only a theoretical problem. As long as you use a common cathode led-matrix, every type of wiring can
be made to work with just a little bit of software.  
Quote
i must use the matrix to understand what wiring is better than.
Yes.

Quote
also, i don't know how can i manipulate the matrix in real time but i will open another post for this question.
This really depends on the software again.
The Matrix-lib that is shipped with the arduino-ide and the LedControl-lib
both have a function that allows you to control each Led individually.
The playground-code doesn't have that feature, you can only set the status of complete rows.
This is about the major difference, apart from the 7-segment display support that is only available in the LedControl-lib.
I think it might be a bit easier to use one of the libraries. If you go for the playground code you will start from scratch.

When you decided on the Led-matrix product and have a link to the datasheet I can probably have a look what would be the perfect wiring for that product.

Eberhard
Logged

q
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
sorry about that, but the confusion will quickly go away once you see the first led's light up Smiley

really not, i understood all of things but i need to start and interact with it.
Now i have a 3x3 matrix prototype, i'm waiting for leds(shipped from honk kong). however it work correctly, now i want to learn how can i interact with this prototype in real time.

i think that i must use software like processing or pure data but i have not idea about how can i do this, can you suggest me some stuff like code tutorial, or topic overview?

Thabnk for all.
« Last Edit: December 01, 2007, 01:01:22 pm by q » Logged

malmö / berlin
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
fhp>--vs--<k3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


hej kompis,

i'm little bit late for this discussion, but anyway, the tutorial is related to the code and they work togehter, at least for me, and some other people which tryed it from time to time.

but thanks for your notes, i guess i have to work on this for a little while, but unfortunally i will not be able to try the stuff on a real ship or matrix, because i'm not "home" for the next 5 month, but i tryed the old one several times, maybe i didn't used the best way to explain it or maybe a stupid way of name the things etc.

on the otherhand i'm a little bit sad, because i don't think it was necessary to delete the link to the tutorial from the main wiki page, it would be great if it could return.
At some point i was spending a lot time on this and it is always sad if stuff you made just disapera in to the dark....


all the best
tomek

Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, Tomek
Quote

hej kompis,

i'm little bit late for this discussion, but anyway, the tutorial is related to the code and they work togehter, at least for me, and some other people which tryed it from time to time.
I checked the pdf again, and I am still convinced that the wiring in the second picture is wrong.
The MAX72XX datasheet has a table that matches the segments to the bit-positions in the data
Seg DP -> 128
SegA -> 64
SegB -> 32
SegC -> 16
SegD -> 8
SegE -> 4
SegF -> 2
SegG -> 1

From your picture headline
Column (segA-G, DP)
the reader will get the impression that bit-values are organized this way
Seg DP -> 128
SegG -> 64
SegF -> 32
SegE -> 16
SegD -> 8
SegC -> 4
SegB -> 2
SegA -> 1

which is simply wrong. If it would have been a normal playground article I could simply update it, But since its a pdf, there is no other chance than to put that bug-report at the top of the article. Could you check your pdf again and maybe correct that error?

Quote
...on the otherhand i'm a little bit sad, because i don't think it was necessary to delete the link to the tutorial from the main wiki page, it would be great if it could return.
At some point i was spending a lot time on this and it is always sad if stuff you made just disapera in to the dark....
The reason the link was moved, is that there are attempts to get the organization of the playground into a better shape.
The link to your page is now located on a specifc index that covers all the articles concerning the Max7221 or MAX7219.
There are already 5 links on this subpage, too many for the major hardware-directory.
If someone is looking for a  way to drive a MAX7219 he will find your article in the
top-score position right after some hardware-related info.
Quote
At some point i was spending a lot time on this and it is always sad if stuff you made just disapera in to the dark....
This is true for everybody who wrote an article, but since your code is the first one the potential user will find this is nowhere near dark sorry..

Cheers
Eberhard
Logged

malmö / berlin
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
fhp>--vs--<k3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset



jup, i notcied that i don't explained the order of the collums and you are right that the reader can get confused, i will add some sentenc about this, thx

all the best
tomek
Logged

Pages: [1] 2   Go Up
Jump to: