Display Driver for 8×8 Dot Matrix Display Module

The 8×8 dot matrix display module is a device based on the MAX7219 control chip. In a single-level usage scenario, one MAX7219 can control a single 8×8 dot matrix display. If cascading is used, multiple dot matrix displays can be driven simultaneously to achieve the display effect of a dot matrix information screen.
Using the MC3172 to drive this display module can achieve the effect shown in Figure 1.
Display Driver for 8x8 Dot Matrix Display Module
Figure 1 Display Effect
In this display circuit, the pin connection relationships are:
CLK– PA2
DIN– PA1
CS –PA0
Display Driver for 8x8 Dot Matrix Display Module
Figure 2 Pin Distribution
The dot matrix character patterns are stored in the following way:
unsigned char disp[38][8]={  {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0  {0x10,0x30,0x50,0x10,0x10,0x10,0x10,0x10},//1  {0x7E,0x02,0x02,0x7E,0x40,0x40,0x40,0x7E},//2  ...  {0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A  {0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B  {0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C  ...  {0x8,0x7F,0x49,0x49,0x7F,0x08,0x08,0x08},//中  {0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//国};
The configured delay function is:
void delay(int16_t del){for (uint32_t i = 0; i < del; ++i) {for (uint32_t var = 0; var < 5000; ++var) {NOP();}}}
The function to send byte data to Max7219 is:
void Write_Max7219_byte(unsigned char DATA){unsigned char i;GPIO_SET_OUTPUT_PIN_TO_0(GPIOA_BASE_ADDR,GPIO_PIN0);for(i=8;i>=1;i--){GPIO_SET_OUTPUT_PIN_TO_0(GPIOA_BASE_ADDR,GPIO_PIN2);if(DATA&0x80) GPIO_SET_OUTPUT_PIN_TO_1(GPIOA_BASE_ADDR,GPIO_PIN1);else GPIO_SET_OUTPUT_PIN_TO_0(GPIOA_BASE_ADDR,GPIO_PIN1);delay(1);DATA=DATA<<1;GPIO_SET_OUTPUT_PIN_TO_1(GPIOA_BASE_ADDR,GPIO_PIN2);delay(1);}}
The function to specify register data for Max7219 is:
void Write_Max7219(char address,char dat){GPIO_SET_OUTPUT_PIN_TO_0(GPIOA_BASE_ADDR,GPIO_PIN0);Write_Max7219_byte(address);Write_Max7219_byte(dat);GPIO_SET_OUTPUT_PIN_TO_1(GPIOA_BASE_ADDR,GPIO_PIN0);}
The initialization function for MAX7219 is:
void Init_MAX7219(void){Write_Max7219(0x0b, 0x07);Write_Max7219(0x0c, 0x01);Write_Max7219(0x0f, 0x00);}
To drive the dot matrix module for display, the display program is placed in thread 0, which includes setting the used pins to output mode and continuously displaying the content from the character library in a loop. The program content is as follows:
void thread0_main(void){//Enable the clock for GPIOAINTDEV_SET_CLK_RST(GPIOA_BASE_ADDR,(INTDEV_RUN|INTDEV_IS_GROUP0|INTDEV_CLK_IS_CORECLK_DIV2));//Set PA0 to output modeGPIO_SET_OUTPUT_EN_VALUE(GPIOA_BASE_ADDR,(GPIO_PIN0),GPIO_SET_ENABLE);GPIO_SET_OUTPUT_EN_VALUE(GPIOA_BASE_ADDR,(GPIO_PIN1),GPIO_SET_ENABLE);GPIO_SET_OUTPUT_EN_VALUE(GPIOA_BASE_ADDR,(GPIO_PIN2),GPIO_SET_ENABLE);Init_MAX7219();delay(100);while(1){for(uint32_t j=0;j<38;j++){for(uint32_t i=1;i<9;i++)Write_Max7219(i,disp[j][i-1]);delay(100);}}thread_end();}
After compilation and download, the display effects are shown in Figures 3 to 5.
Display Driver for 8x8 Dot Matrix Display Module
Figure 3 Displaying Numbers
Display Driver for 8x8 Dot Matrix Display Module
Figure 4 Displaying Characters
Display Driver for 8x8 Dot Matrix Display Module
Figure 5 Displaying Chinese
In use, a major inconvenience is that the power supply pins are too few, lacking output for 3.3V, and the power supply seems to be insufficient, requiring assistance from an external power source.

Author: jinglixixi_457498010

Source: Breadboard Community

Link: https://mbb.eet-china.com/blog/467667-436229.html

Copyright Statement: This article is original by the author, and reproduction is prohibited without permission!

END
Review Center Free Application

Display Driver for 8x8 Dot Matrix Display Module

Display Driver for 8x8 Dot Matrix Display Module

☝Long press the image to scan the code to apply☝

Leave a Comment

×