Skip to content

botchlet/maxx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino MAX7219/7221 Library

Written by Eberhard Fahle in 2007
Refactoring, cosmetic changes and hardware SPI by Radu - Eosif Mihailescu <radu.mihailescu@linux360.ro> 2012-04-13
Bug spotting in 7-Segment example by John Williams <mrjtwill at yahoo.com> 2012-06-27
AS1100/1106/1107 support by Radu - Eosif Mihailescu <radu.mihailescu@linux360.ro> 2012-07-19

To the furthest extent that this is legally possible, the fork maintained by 
Radu - Eosif Mihailescu and published here https://github.com/csdexter/MAX7219
is hereby released under the LGPL version 3.
To the furthest extent that this is legally enforceable, the copyright remains
with the authors listed above.

See the example sketches to learn how to use the library in your code.

HARDWARE NOTES:
 * The AS1100/1106/1107 is pin-for-pin compatible with the MAX7219/7221. They do
   have a bit of extra functionality in register 0xE which can also be accessed
   with this library. Apart from that, they behave identically to the MAX7219 so
   everything explained here and in the examples about the former, equally
   applies to the AS1100/1106/1107.
 * The MAX7219/7221 are 5V I/O driver chips that power their loads from the
   digital 5V rail. This means you will need to find another power supply to
   feed the MAX if you plan to use more than one of them (the power regulator
   on the Uno/Mega can take 1 MAX + a 64 LED matrix, but not more). This also
   means a lot of noise will be induced in the digital domain of your project
   if you don't take appropriate measures by installing the two filtering
   capacitors shown in the datasheet. 
 * This also means level shifters will be needed if you want to talk to the
   MAX from a 3.3V I/O Arduino. As the MAX7219/7221 is a SPI device which you
   may want to drive fast, you may find the majority of level shifters on the
   market inappropriate because they are designed for I2C which doesn't go
   faster than 100kHz in most cases. A quick and dirty solution is to use a
   74HCT125 quad-buffer instead (which adds quick-disconnect as a bonus). The
   datasheet specifies its minimum Vhigh voltage as 2V which is more than
   enough when using 3.3V logic and its maximum speed is above 25MHz so it's
   well suited for solving the problem at hand.
 * Quick connection reference:
   MAX7219/7221 -> Arduino:
     DIN       -> MOSI    (Arduino output)
     CLK       -> SCK     (Arduino output)
     LOAD/#CS  -> SS      (Arduino output)
   MAX7219/7221 -> LEDs:
     for 7 segment  -> digit 0 is the leftmost one (MSB) and digit 7 is the
                       rightmost (LSB)
     for 16 segment -> digit 0 on chips 0 and 1 is the leftmost display (MSB),
                       digit 7 on chips 0 and 1 is the rightmost display (LSB)
     for 14 segment -> as for 16-segment, above
     for bar graph  -> column 0 is the leftmost one, dot 1 (the one that lights
                       up when you write a value of 1 or when you call
                       zeroDisplay()) is the bottom one (wired to SEGG)
     for matrix     -> pixel (0, 0) (the one that lights up when you write a
                       value of {0x01, 0x00, ...} or when you call
                       zeroDisplay()) is the top right one (wired to DIG0,
                       SEGG). Directly under it we have (0, 1) (accessed by
                       writing {0x00, 0x01, 0x00, ...}), wired to DIG1, SEGG;
                       directly to its left we have (1, 0) (accessed by writing
                       {0x02, 0x00, ...}), wired to DIG0, SEGF.
   For chaining MAX7219/7221s:
     DOUT(n)     -> DIN(n+1)  (MAX7219 output to MAX7219 input)
     DIN(1)      -> MOSI      (Arduino output)
     CLK(*)      -> SCK       (Arduino outputs, may require a buffer if you go
     LOAD/#CS(*) -> SS         past the sinking capability of the Arduino)
     addressing  -> chip 0 is the one closest to the Arduino

LIBRARY NOTES:
 * Due to the fact that we usually work with displays made up of a collection
   of MAX7219 digits as opposed to single digits, this library uses the
   concept of topology elements. All data display methods operate on said
   topology elements instead of single digits. Of course, controlling each
   individual segment of each individual digit (while at the same time being
   able to refer to each discrete digit) is still possible if you declare your
   topology to be a collection of matrices, each one spanning a single digit.
   In so doing, each topology element gets mapped to a MAX7219 digit and
   offers direct access to its component segments.
 * The topology pointer passed to begin() is only being read from and thus
   declared and treated as const.
 * The default topology consists of a single element: one 8-digit 7-segment
   display.
 * All topology elements can span chips (i.e. you could have a 4-digit
   7-segment display made up of the last two digits of chip 2 and the first
   two digits of chip 3); with the sole exception of MAX7219_MODE_NC which
   must also end on a chip boundary due to the way scanning limit is
   implemented in the chip. All topology elements must be contiguous (i.e. you
   can't have the first and the last digit on chip 0 make up a 2-digit
   7-segment display).
 * All data display functions take a pointer to the data to be displayed as a
   parameter. The length of data read from that pointer depends on the size in
   MAX7219 digits of the target topology element; for example a set7Segment()
   call targeting a 4-digit topology element will attempt to read 4 bytes.

For general questions and updates on this library please contact the fork
maintainer at <radu.mihailescu@linux360.ro>.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published