582 views|2 replies

1453

Posts

1

Resources
The OP
 

[SoC 6 BLE prototype development board] + serial digital tube display driver [Copy link]

Last time I tried to use the GPIO port using the expansion interface. This time I will use the GPIO port to configure a serial digital tube display module for the development board to achieve the purpose of data display.

The serial digital tube module is shown in Figure 1. Its main control chip is MAX7219, which is a chip that converts serial signals into parallel signals.

The display module has a total of 5 pins. Except for the 2 pins occupied by the power supply, the functions and connection relationships of the remaining 3 pins are as follows:

DIN----Data pin---P5.2

CLK----Clock pin---P5.3

CS ---- chip select pin --- P5.5

Figure 1 Serial digital tube module

To achieve the output of high and low level signals, the statements are defined as:

#defineDIN_SetHigh() Cy_GPIO_Set(P5_2_PORT, P5_2_NUM)

#defineDIN_SetLow() Cy_GPIO_Clr(P5_2_PORT, P5_2_NUM)

#defineCLK_SetHigh() Cy_GPIO_Set(P5_3_PORT, P5_3_NUM)

#defineCLK_SetLow() Cy_GPIO_Clr(P5_3_PORT, P5_3_NUM)

#defineCS_SetHigh() Cy_GPIO_Set(P5_5_PORT, P5_5_NUM)

#defineCS_SetLow() Cy_GPIO_Clr(P5_5_PORT, P5_5_NUM)

To ensure the stability and reliability of the output signal, the configured delay function is:

void delay_ns(unsignedint n)
{
 unsignedint i;
 unsignedint count=4;
 for(i=0;i<n; i++)
 {
 count=4;
 while(count--);
 }
}

The function that implements serial transmission of byte data is:

void Write_Max7219_byte(char DATA)
{
 char i;
 CS_SetLow();
 delay_ns(100);
 for(i=8;i>=1;i--)
 {
 CLK_SetLow();
 delay_ns(100);
 if(DATA&0x80)
 DIN_SetHigh();
 else
 DIN_SetLow();
 delay_ns(100);
 DATA=DATA<<1;
 CLK_SetHigh();
 delay_ns(100);
 }
}

The function to send data to the specified unit is:

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

The function to initialize the serial digital tube module 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 serial digital tube drive test is:

int main(void)
{
 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);
}

After the program is compiled and downloaded, the display effect of its operation is shown in Figure 2.

Figure 2 Serial digital tube test results

This post is from RF/Wirelessly

Latest reply

The main control IC max7219 should be the driver chip of the serial input/output common cathode digital tube dot matrix. ICs from large manufacturers are relatively easy to use.   Details Published on 2024-1-21 07:31
 

6570

Posts

0

Resources
2
 

The main control IC max7219 should be the driver chip of the serial input/output common cathode digital tube dot matrix. ICs from large manufacturers are relatively easy to use.

This post is from RF/Wirelessly

Comments

That's right!!!  Details Published on 2024-1-21 09:57
 
 

1453

Posts

1

Resources
3
 
Jacktang posted on 2024-1-21 07:31 The main control max7219 IC should be the driver chip of the serial input/output common cathode digital tube dot matrix. The IC of a large manufacturer is still relatively easy to use

That's right!!!

This post is from RF/Wirelessly
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

快速回复 返回顶部 Return list