[Diao Ye learns programming] Arduino hands-on (99) --- 8X32 LED dot matrix screen module 2

The reference to 37 sensors and actuators has been widely circulated on the Internet. In fact, there must be more than 37 sensor modules compatible with Arduino. In view of the fact that I have accumulated some sensor and actuator modules on hand, according to the concept of practicing true knowledge (must be done), for the purpose of learning and communication, I am going to try a series of experiments one by one, regardless of success (the program goes through) or not, They will be recorded - small progress or unsolvable problems, hoping to inspire others.

[Arduino] 168 kinds of sensor module series experiments (data code + simulation programming + graphics programming)
Experiment 99: 8X32 LED dot matrix display module MAX7219 output common cathode 5V four-bit dot matrix module

insert image description here

Knowledge points: MAX7219
is a multi-digit LED display driver launched by MAXIM Company in the United States. It uses a 3-wire serial interface to transmit data and can be directly connected to the single-chip interface. Users can easily modify its internal parameters to realize multi-digit LED display. It contains hardware dynamic scanning circuit, BCD decoder, segment driver and bit driver. In addition, it also contains 8X8-bit static RAM inside, which is used to store the display data of 8 figures. Obviously, it can directly drive a 64-segment LED dot matrix display. When multiple MAX7219s are cascaded, more LED dot-matrix displays can be controlled. The displayed data is sent to MAX7219 for display after being processed by the single-chip microcomputer.

The MAX7219/MAX7221 are integrated serial input/output common-cathode display drivers that connect a microprocessor to an 8-digit 7-segment LED display, as well as a bar graph display or 64 individual LEDs. It includes an on-chip B-type BCD encoder, multi-channel scanning circuit, segment driver, and an 8*8 static RAM to store each data. Only one external register is used to set the segment current for each LED. The MAX7221 is compatible with SPI™, QSPI™, and MICROWIRE™, and it has a segment drive that limits the slew current to reduce EMI (electromagnetic interference). A convenient four-wire serial interface can interface with all common microprocessors. Each data address can be updated without rewriting all displays. The MAX7219/MAX7221 also allow the user to choose to encode or not encode each data. The entire device includes a 150µA low-power shutdown mode, analog and digital brightness controls, a scan limit register allowing the user to display 1-8 bits of data, and a detection mode that makes all LEDs illuminate.

insert image description here
8X32 LED dot matrix display module MAX7219 output common cathode 5V four bit dot matrix module

8X32 LED dot matrix display cascade module, MAX7219 is an integrated serial input/output common-cathode display driver, which connects the microprocessor and 8-digit 7-segment digital LED display, and can also be connected to a bar graph display or 64 individual LEDs. It includes an on-chip B-type BCD encoder, multi-channel scanning circuit, segment driver, and an 8*8 static RAM to store each data. Only one external register is used to set the segment current for each LED. A convenient four-wire serial interface can interface with all common microprocessors. Each data address can be updated without rewriting all displays. The MAX7219 also allows the user to choose to encode or not encode each data. The entire device includes a 150µA low-power shutdown mode, analog and digital brightness controls, a scan limit register allowing the user to display 1-8 bits of data, and a detection mode that makes all LEDs illuminate. Only 3 IO ports are needed to drive 1 dot matrix! No flickering when the dot matrix display! Cascading is supported!

insert image description here
8X32 LED dot matrix display module reference circuit schematic diagram

insert image description here
insert image description here
Wiring diagram of Arduino experiment

insert image description here

[Arduino] 168 kinds of sensor module series experiment (data code + simulation programming + graphic programming)
Experiment 99: 8X32 LED dot matrix display cascade module MAX7219 output common cathode 5V module
1. Download and install library:
GitHub | riyas-org /max7219 https://github.com/riyas-org/max7219
2. Project: Create a letter library, vertical scrolling text display
3. Connection:
VCC → 5V
GND → GND
DIN to D11 (MOSI)
CS to D10 (SS )
CLK to D13 (SCK)

/*
【Arduino】108种传感器模块系列实验(资料+代码+图形+仿真)
实验一百零三: 8X32 LED点阵显示级联模块 MAX7219 输出 共阴 5V 模组
1、下载安装库:
GitHub | riyas-org/max7219  https://github.com/riyas-org/max7219
2、项目:建立字母库,立式滚动文本显示
3、连线:
VCC  →  5V
GND  →  GND
DIN 接 D11 (MOSI)
CS  接 D10 (SS)
CLK 接 D13 (SCK)
*/

#include <MaxMatrix.h>
#include <avr/pgmspace.h>
PROGMEM const unsigned char CH[] = {
    
    
  3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
  1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
  3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // "
  5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
  4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
  5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
  5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
  1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // '
  3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
  3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
  5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
  5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
  2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
  4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // -
  2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
  4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
  4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
  3, 8, B01000010, B01111111, B01000000, B00000000, B00000000, // 1
  4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
  4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
  4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
  4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
  4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
  4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
  4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
  4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
  2, 8, B01010000, B00000000, B00000000, B00000000, B00000000, // :
  2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
  3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // <
  3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // =
  3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
  4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
  5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
  4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
  4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
  4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
  4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
  4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
  4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
  4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
  4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
  3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
  4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
  4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
  4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
  5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
  5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
  4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
  4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
  4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
  4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
  4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
  5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
  4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
  5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
  5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
  5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
  5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
  4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
  2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
  4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
  2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
  3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
  4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
  2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
  4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
  4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
  4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
  4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
  4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
  3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
  4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
  4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
  3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
  4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
  4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
  3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
  5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
  4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
  4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
  4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
  4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
  4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
  4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
  3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
  4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
  5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
  5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
  5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
  4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
  3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
  3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
    
    
  1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
  3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
  4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
};
int DIN = 11;   // DIN pin of MAX7219 module
int CLK = 13;   // CLK pin of MAX7219 module
int CS = 10;    // CS pin of MAX7219 module
int maxInUse = 4;
MaxMatrix m(DIN, CS, CLK, maxInUse);
byte buffer[10];
char text[]= "Hello Eagler8"; // Scrolling text
void setup() {
    
    
  m.init(); // module initialize
  m.setIntensity(0); // dot matix intensity 0-15
}
void loop() {
    
    
  printStringWithShift(text, 100); // (text, scrolling speed)
}
// Display=the extracted characters with scrolling
void printCharWithShift(char c, int shift_speed) {
    
    
  if (c < 32) return;
  c -= 32;
  memcpy_P(buffer, CH + 7 * c, 7);
  m.writeSprite(32, 0, buffer);
  m.setColumn(32 + buffer[0], 0);
  for (int i = 0; i < buffer[0] + 1; i++)
  {
    
    
    delay(shift_speed);
    m.shiftLeft(false, false);
  }
}
// Extract the characters from the text string
void printStringWithShift(char* s, int shift_speed) {
    
    
  while (*s != 0) {
    
    
    printCharWithShift(*s, shift_speed);
    s++;
  }
}

[Arduino] 168 kinds of sensor module series experiments (data code + simulation programming + graphics programming)
Experiment 99: 8X32 LED dot matrix display cascade module MAX7219 output common cathode 5V module
1, download library https://www.pjrc .com/teensy/arduino_libraries/Matrix_Sprite.zip
2. Project: display letters
3. Connection:
VCC → 5V
GND → GND
DIN to D11 (MOSI)
CS to D10 (SS)
CLK to D13 (SCK)

/*
【Arduino】108种传感器模块系列实验(资料+代码+图形+仿真)
实验一百零三: 8X32 LED点阵显示级联模块 MAX7219 输出 共阴 5V 模组
1、下载库 https://www.pjrc.com/teensy/arduino_libraries/Matrix_Sprite.zip
2、项目:显示字母
3、连线:
VCC  →  5V
GND  →  GND
DIN 接 D11 (MOSI)
CS  接 D10 (SS)
CLK 接 D13 (SCK)
*/

#include <Sprite.h>  // Sprite before Matrix
#include <Matrix.h>

//DIN, CLK, CS, #chips
Matrix myLeds = Matrix(11, 13, 10, 3);

Sprite letter_L = Sprite(5, 8,
  B11000,
  B11000,
  B11000,
  B11000,
  B11000,
  B11000,
  B11111,
  B11111
);
Sprite letter_E = Sprite(5, 8,
  B11111,
  B11111,
  B11000,
  B11110,
  B11110,
  B11000,
  B11111,
  B11111
);
Sprite letter_D = Sprite(6, 8,
  B111100,
  B111110,
  B110111,
  B110011,
  B110011,
  B110111,
  B111110,
  B111100
);
Sprite letter_S = Sprite(5, 8,
  B01110,
  B11111,
  B11000,
  B11110,
  B01111,
  B00011,
  B11111,
  B01110
);

void setup() {
    
    
  myLeds.clear();
  myLeds.setBrightness(0);
  myLeds.write(3, 0, letter_L);
  myLeds.write(10, 0, letter_E);
  myLeds.write(18, 0, letter_D);
  myLeds.write(26, 0, letter_S);
}

void loop() {
    
    
}

Several functions of the Matrix library

Basic usage, pixels only
Matrix myLeds = Matrix(DIN, CLK, LOAD, numChips);
Creates an instance of a Matrix object with a name of your choice. DIN, CLK and LOAD are the pin numbers to which these signals are connected. Multiple objects can be created if multiple individually connected MAX7219 chips are connected.

myLeds. clear();
Clears the entire display.

myLeds. setBrightness(15);
Set the display brightness, from 0 to 15 (the brightest).

myLeds. write(x, y, value);
Changes a single pixel. For off, the value should be LOW, for on, the value should be HIGH.

Basic usage, use Sprite
Sprite myIcon = Sprite(width, height, B11000, B11000, B11111, B11111);
to create a sprite object. You can create as many sprites as you want, each with a unique name. The width should match the number of bits in each data value, and the height should match the number of data values.

myLeds. write(x, y, myIcon);
Draws a blinking sprite on the display.

The Sprite library allows the creation of image sprites for use with the Matrix library

Sprite
starts the LCD library.

width()
returns the width of the sprite in pixels.

height()
returns the height of the sprite in pixels.

write()
writes data to the sprite's x,y position.

read()
returns the data stored at the sprite's x,y position.

Arduino experiment scene diagram

insert image description here

Experimental open source graphics programming (Mind+, programming while learning)

insert image description here
insert image description here
insert image description here

Experimental open source simulation programming (Linkboy V5.33)

insert image description here
insert image description here

Arduino experiment scene diagram

insert image description here

Guess you like

Origin blog.csdn.net/weixin_41659040/article/details/131990499