2003 views|5 replies

1455

Posts

1

Resources
The OP
 

[AT32F421 Review] + Digital tube module and automatic counting display [Copy link]

 This post was last edited by jinglixixi on 2021-4-17 11:59

Digital tubes are often used to display data in industrial sites. The main reason is that they have high display brightness, low cost and are relatively durable.

Usually for ease of use, you can directly purchase the functional modules of the digital tube. Such modules can be divided into two categories, one is a parallel data transmission method, and the other is a serial data transmission method.

Here we introduce a digital tube module with parallel transmission mode, as shown in Figure 1. This module has been configured with current limiting resistors and drivers for each display bit, so when using it, it can be directly connected to the relevant pins of the development board.

What is more interesting is that the module only provides a power supply VCC pin, but no GND pin. Among them, D1~D4 are position control pins, and A~DP are segment control pins.

https://12.eewimg.cn/bbs/data/attachment/forum/202104/06/185132pjcf0kgtiveqcghz.png.thumb.jpg

Figure 1 Digital tube module

Taking the automatic counting display of a 2-digit value as an example, the display effect is shown in Figure 2.

Figure 2 Counting display effect

Since the module transmits data in parallel and the pin arrangement of the development board is scattered, the traditional data output method of occupying a certain port is not adopted when driving the digital tube display. Instead, it is implemented directly in a bit control manner according to the connection relationship of the pins.

The correspondence between the module pins and the MCU is as follows:

A---PA5

B---PA6

C---PA7

D---PA15

E---PB7

F---PA9

G---PB10

DP---PA8

D1---PB3

D2---PB4

D3—-NC

D4---NC

The statements that define the high and low levels of the related pin outputs are:

#define SMG_A_L GPIOA->BRE = GPIO_Pins_5

#define SMG_A_H GPIOA->BSRE = GPIO_Pins_5

#define SMG_B_L GPIOA->BRE = GPIO_Pins_6

#define SMG_B_H GPIOA->BSRE = GPIO_Pins_6

#define SMG_C_L GPIOA->BRE = GPIO_Pins_7

#define SMG_C_H GPIOA->BSRE = GPIO_Pins_7

#define SMG_D_L GPIOA->BRE = GPIO_Pins_15

#define SMG_D_H GPIOA->BSRE = GPIO_Pins_15

#define SMG_E_L GPIOB->BRE = GPIO_Pins_7

#define SMG_E_H GPIOB->BSRE = GPIO_Pins_7

#define SMG_F_L GPIOA->BRE = GPIO_Pins_9

#define SMG_F_H GPIOA->BSRE = GPIO_Pins_9

#define SMG_G_L GPIOB->BRE = GPIO_Pins_10

#define SMG_G_H GPIOB->BSRE = GPIO_Pins_10

#define SMG_P_L GPIOA->BRE = GPIO_Pins_8

#define SMG_P_H GPIOA->BSRE = GPIO_Pins_8

#define SMG_1L GPIOB->BRE = GPIO_Pins_3

#define SMG_1H GPIOB->BSRE = GPIO_Pins_3

#define SMG_2L GPIOB->BRE = GPIO_Pins_4

#define SMG_2H GPIOB->BSRE = GPIO_Pins_4

The function to display the value 0~9 is:

void smg_disp(char n)
{
 if(n==0)
 {
     SMG_A_L;
 SMG_B_L;
 SMG_C_L;
 SMG_D_L;
 SMG_E_L;
 SMG_F_L;
 SMG_G_H;
 SMG_P_H;
 }
 if(n==1)
  {
     SMG_A_H;
 SMG_B_L;
 SMG_C_L;
 SMG_D_H;
 SMG_E_H;
  SMG_F_H;
 SMG_G_H;
 SMG_P_H;
 }
 if(n==2)
 {
     SMG_A_L;
 SMG_B_L;
 SMG_C_H;
 SMG_D_L;
 SMG_E_L;
 SMG_F_H;
 SMG_G_L;
 SMG_P_H;
 }
 if(n==3)
 {
     SMG_A_L;
 SMG_B_L;
  SMG_C_L;
 SMG_D_L;
 SMG_E_H;
 SMG_F_H;
 SMG_G_L;
 SMG_P_H;
 }
 if(n==4)
  {
     SMG_A_H;
 SMG_B_L;
 SMG_C_L;
 SMG_D_H;
 SMG_E_H;
 SMG_F_L;
 SMG_G_L;
 SMG_P_H;
 }
 if(n==5)
 {
     SMG_A_L;
 SMG_B_H;
 SMG_C_L;
 SMG_D_L;
 SMG_E_H;
 SMG_F_L;
 SMG_G_L;
 SMG_P_H;
 }
 if(n==6)
 {
     SMG_A_L;
 SMG_B_H;
 SMG_C_L;
 SMG_D_L;
 SMG_E_L;
 SMG_F_L;
 SMG_G_L;
  SMG_P_H;
 }
 if(n==7)
 {
     SMG_A_L;
 SMG_B_L;
 SMG_C_L;
 SMG_D_H;
 SMG_E_H;
 SMG_F_H;
 SMG_G_H;
  SMG_P_H;
 }
 if(n==8)
 {
     SMG_A_L;
 SMG_B_L;
 SMG_C_L;
 SMG_D_L;
 SMG_E_L;
 SMG_F_L;
 SMG_G_L;
 SMG_P_H;
 }
 if(n==9)
 {
     SMG_A_L;
 SMG_B_L;
 SMG_C_L;
 SMG_D_L;
 SMG_E_H;
 SMG_F_L;
 SMG_G_L;
 SMG_P_H;
 }
}

The main program to realize 2-digit automatic counting display is:

int main(void)
{
     char i;
 int j;
 AT32_Board_Init();
 smg_Init();
     SMG_A_L;
 SMG_B_L;
 SMG_C_L;
 SMG_D_L;
 SMG_E_L;
 SMG_F_L;
 SMG_G_L;
 SMG_P_L;
     for(;;)
     {
 for(j=0;j<500;j++)
 {
  if(i<10)
 {
        SMG_1L;
 SMG_2H;
 smg_disp(i);
 Delay_ms(2);
 }
 else
 {
  SMG_1L;
 SMG_2H;
   smg_disp(i%10);
 Delay_ms(1);
 SMG_1H;
 SMG_2L;
 smg_disp(i/10);
  Delay_ms(1);
 }
             }
  }
  i++;
  if(i>99) i=0;
}

This post is from Domestic Chip Exchange

Latest reply

Thanks for sharing, looking forward to the follow-up!   Details Published on 2021-4-21 18:24

赞赏

1

查看全部赞赏

 
 

1668

Posts

0

Resources
2
 

The module only provides a power supply VCC pin, but no GND pin.

Why is it designed like this?

This post is from Domestic Chip Exchange

Comments

I guess it's to save pins, so the segment code must output a low level to light up.  Details Published on 2021-4-20 00:11
 
 
 

1455

Posts

1

Resources
3
 
Hot Ximi Show published on 2021-4-19 23:19 The module only provides a power supply VCC pin, but no GND pin. Why is it designed like this?

I guess it's to save pins, so the segment code must output a low level to light up.

This post is from Domestic Chip Exchange
 
 
 

71

Posts

2

Resources
4
 

Alas, there are no such convenient peripheral modules. It seems that I have to buy some kits in the future.

This post is from Domestic Chip Exchange

Comments

It is more appropriate to use some less expensive modules, which will be much more convenient.  Details Published on 2021-4-21 15:32
 
 
 

1455

Posts

1

Resources
5
 
Albert.G posted on 2021-4-21 09:17 Alas, there are no such convenient peripheral modules. It seems that I have to buy some kits in the future.

It is more appropriate to use some less expensive modules, which will be much more convenient.

This post is from Domestic Chip Exchange
 
 
 

7462

Posts

2

Resources
6
 

Thanks for sharing, looking forward to the follow-up!

This post is from Domestic Chip Exchange
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

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