734 views|4 replies

1456

Posts

1

Resources
The OP
 

[STM32F4-discovery development board evaluation] Driver of serial digital tube display module [Copy link]

I wanted to use the I2C interface to drive a 0.96-inch OLED display, but the result was not ideal. The brightness of the display was very low, as shown in Figure 1.

Figure 1 OLED display

For this reason, we had to abandon this display solution and test the serial digital tube display module instead.

The digital tube module uses MAX7219 as the processing chip, which can convert serial data into parallel signal output, thus effectively saving the number of GPIO ports.

The connection relationship between the digital tube module and the development board is:

CLK---PF7

DIN---PF8

CS---PF9

The statement to realize the high and low level output of the pins used is defined as:

#define CLK_SetHigh() HAL_GPIO_WritePin(GPIOF, GPIO_PIN_7, GPIO_PIN_SET)

#define CLK_SetLow() HAL_GPIO_WritePin(GPIOF, GPIO_PIN_7, GPIO_PIN_RESET)

#define DIN_SetHigh() HAL_GPIO_WritePin(GPIOF, GPIO_PIN_8, GPIO_PIN_SET)

#define DIN_SetLow() HAL_GPIO_WritePin(GPIOF, GPIO_PIN_8, GPIO_PIN_RESET)

#define CS_SetHigh() HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9, GPIO_PIN_SET)

#define CS_SetLow() HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9, GPIO_PIN_RESET)

The function for configuring the working mode of the used pins is:

void DZMK_Init(void)
{
   GPIO_InitTypeDef  GPIO_InitStruct;
   __HAL_RCC_GPIOF_CLK_ENABLE();
   GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
   GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
   HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
}

The function that implements Max7219 sending data to the specified address is:

void Write_Max7219(char address,char dat)
{
     CS_SetLow();
     Write_Max7219_byte(address);
     Write_Max7219_byte(dat);
     CS_SetHigh();
}

The function to initialize Max7219 is:

void Init_MAX7219(void)
{
   Write_Max7219(0x09, 0xff);
   Write_Max7219(0x0a, 0x02);
   Write_Max7219(0x0b, 0x07);
   Write_Max7219(0x0c, 0x01);
   Write_Max7219(0x0f, 0x00);
}

The main program to implement the display test is:

int main(void)
{
  SystemClock_Config();
  DZMK _Init();
  Init_MAX7219();
  Write_Max7219(1,1);
  Write_Max7219(2,2);
  Write_Max7219(3,3);
  Write_Max7219(4,4);
  Write_Max7219(5,5);
  Write_Max7219(6,6);
  Write_Max7219(7,7);
  Write_Max7219(8,8);
  while(1);
}

After the program is compiled and downloaded, the display effect is shown in Figure 2. In this way, if there is a need for data display, it can be completed through this display module.

Figure 2 Display effect

This post is from stm32/stm8

Latest reply

OLED has a command to set contrast. Did you forget to set it?   Details Published on 2023-9-24 13:18
 

6827

Posts

11

Resources
2
 

This module of the teacher is very useful, thank you for sharing!

This post is from stm32/stm8

Comments

Haha, it is quite effective to use it to do drive testing.  Details Published on 2023-9-24 18:21
 
 

1w

Posts

25

Resources
3
 

OLED has a command to set contrast. Did you forget to set it?

This post is from stm32/stm8

Comments

It has been set to the brightest, which may be related to the driving capability of the chip.  Details Published on 2023-9-24 18:19
 
 

1456

Posts

1

Resources
4
 
dcexpert posted on 2023-9-24 13:18 OLED has a command to set the contrast. Did you forget to set it?

It has been set to the brightest, which may be related to the driving capability of the chip.

This post is from stm32/stm8
 
 
 

1456

Posts

1

Resources
5
 
lugl4313820 posted on 2023-9-23 21:41 This module of the teacher is very useful, thank you for sharing!

Haha, it is quite effective to use it to do drive testing.

This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list