Author | Rob Hamerling, Copyright © 2014..2014, all rights reserved. |
Adapted-by | |
Compiler | 2.4q3 |
There are several variants of this library: - A library for cascaded MAX7219 modules each with an 8x8 LED matrix. Most procedures of this library require the specification of the module (sequence number in the chain). Some other procedures apply to all modules (clear, blink, etc) and need no sequence number. - A subset of this library for a single MAX7219 module with an 8x8 LED matrix. Because there is only one module no sequence number is needed in the procedures, thus this library is somewhat more efficient in terms of code memory and speed. - A library for a single MAX7219 module with 8 7-segment displays with a functionality similar to the TM1638 library. This description applies to all variants, unless otherwise indicated. . For multi-module variants you need to specify how many modules are cascaded: const MAX7219_NUM =-- size of the chain . For the 8x8 matrix variants of these libraries: When you want to control LEDs individually while retaining the state of the other LEDs a cache must be used. This is a builtin feature of the libraries, but you have to indicate if you need it. By default the cache is not active and some functions will not be available. To activate the cache declare: const bit MAX7219_DISPLAY_CACHE = TRUE The cache takes 8 bytes of data memory per MAX7219 module. . To initialize the max7219 module(s) call procedure max7219_init(). . These libraries use either the software SPI library (spi_master_sw, default) or the hardware SPI library (spi_master_hw). The advantage of using hardware SPI over software SPI (bit-banging) is higher efficiency (less CPU cycles and possibly higher speed). A disadvantage is that it can only be used with PICs with an MSSP module and that 2 of the 3 leads must be connected to specific pins of the PIC. . With software SPI the following needs be declared in the user program before including the max7219 library: const bit MAX7219_SPI_HW = FALSE -- (optional, FALSE is default) alias max7219_din is pin_?? -- pin for data signal (din) alias max7219_clk is pin_?? -- pin for clock signal (clk) alias max7219_cs is pin_?? -- pin for chip select signal (cs) Any pins configurable for digital output can be used for these signals. . With hardware SPI the following needs be declared in the user program before including the max7219[n] library: const bit MAX7219_SPI_HW = TRUE -- mandatory alias max7219_cs is pin_?? -- pin for chip select signal (cs) pin_SDO of the PIC needs be connected to the 'din' pin of the max7219 pin_SCK of the PIC needs be connected to the 'clk' pin of the max7219 Any pin configurable for digital output can be used for max7219_cs and must be connected to the 'cs' pin of the max7219. . Regardless the selected SPI method all 3 used pins must be configured for output by the user program.
-
const byte MAX7219_DISPLAY_PWM27 = 0b_0000_1101
const byte MAX7219_DISPLAY_PWM29 = 0b_0000_1110
const byte MAX7219_COL_6 = 0b_0000_0111
const byte MAX7219_DISPLAY_PWM11 = 0b_0000_0101
const byte MAX7219_SHUTDOWN = 0b_0000_1100
const byte MAX7219_COL_5 = 0b_0000_0110
const byte MAX7219_COL_1 = 0b_0000_0010
const byte MAX7219_DISPLAY_PWM31 = 0b_0000_1111
const byte MAX7219_DISPLAY_PWM19 = 0b_0000_1001
const byte MAX7219_DECODE = 0b_0000_1001
const byte MAX7219_COL_7 = 0b_0000_1000
const byte MAX7219_DISPLAY_PWM9 = 0b_0000_0100
const byte MAX7219_COL_4 = 0b_0000_0101
const byte MAX7219_DISPLAY_PWM17 = 0b_0000_1000
const byte MAX7219_DISPLAY_PWM21 = 0b_0000_1010
const byte MAX7219_DISPLAY_PWM7 = 0b_0000_0011
const byte MAX7219_DISPLAY_PWM1 = 0b_0000_0000
const byte MAX7219_DISPLAY_PWM13 = 0b_0000_0110
const byte MAX7219_DISPLAY_PWM25 = 0b_0000_1100
const byte MAX7219_DISPLAY_PWM15 = 0b_0000_0111
const byte MAX7219_COL_0 = 0b_0000_0001
const byte MAX7219_INTENSITY = 0b_0000_1010
const byte MAX7219_SCANLIMIT = 0b_0000_1011
const byte MAX7219_NO_OP = 0b_0000_0000
const byte MAX7219_DISPLAY_PWM3 = 0b_0000_0001
const byte MAX7219_DISPLAY_PWM23 = 0b_0000_1011
const byte MAX7219_DP = 0b_1000_0000
const byte MAX7219_DISPLAY_PWM5 = 0b_0000_0010
const byte MAX7219_COL_3 = 0b_0000_0100
const byte MAX7219_COL_2 = 0b_0000_0011
const byte MAX7219_TEST = 0b_0000_1111
const byte MAX7219_DISPLAY_PWM27 = 0b_0000_1101
No documentation found
const byte MAX7219_DISPLAY_PWM29 = 0b_0000_1110
No documentation found
const byte MAX7219_COL_6 = 0b_0000_0111
No documentation found
const byte MAX7219_DISPLAY_PWM11 = 0b_0000_0101
PWM dutycycle for LEDs
const byte MAX7219_SHUTDOWN = 0b_0000_1100
No documentation found
const byte MAX7219_COL_5 = 0b_0000_0110
No documentation found
const byte MAX7219_COL_1 = 0b_0000_0010
No documentation found
const byte MAX7219_DISPLAY_PWM31 = 0b_0000_1111
No documentation found
const byte MAX7219_DISPLAY_PWM19 = 0b_0000_1001
No documentation found
const byte MAX7219_DECODE = 0b_0000_1001
No documentation found
const byte MAX7219_COL_7 = 0b_0000_1000
No documentation found
const byte MAX7219_DISPLAY_PWM9 = 0b_0000_0100
No documentation found
const byte MAX7219_COL_4 = 0b_0000_0101
No documentation found
const byte MAX7219_DISPLAY_PWM17 = 0b_0000_1000
No documentation found
const byte MAX7219_DISPLAY_PWM21 = 0b_0000_1010
No documentation found
const byte MAX7219_DISPLAY_PWM7 = 0b_0000_0011
No documentation found
const byte MAX7219_DISPLAY_PWM1 = 0b_0000_0000
intensity register format -------------
const byte MAX7219_DISPLAY_PWM13 = 0b_0000_0110
No documentation found
const byte MAX7219_DISPLAY_PWM25 = 0b_0000_1100
No documentation found
const byte MAX7219_DISPLAY_PWM15 = 0b_0000_0111
No documentation found
const byte MAX7219_COL_0 = 0b_0000_0001
No documentation found
const byte MAX7219_INTENSITY = 0b_0000_1010
No documentation found
const byte MAX7219_SCANLIMIT = 0b_0000_1011
No documentation found
const byte MAX7219_NO_OP = 0b_0000_0000
register address map ------------------
const byte MAX7219_DISPLAY_PWM3 = 0b_0000_0001
No documentation found
const byte MAX7219_DISPLAY_PWM23 = 0b_0000_1011
No documentation found
const byte MAX7219_DP = 0b_1000_0000
segment of decimal point
const byte MAX7219_DISPLAY_PWM5 = 0b_0000_0010
No documentation found
const byte MAX7219_COL_3 = 0b_0000_0100
No documentation found
const byte MAX7219_COL_2 = 0b_0000_0011
No documentation found
const byte MAX7219_TEST = 0b_0000_1111
No documentation found