[SoC 6 BLE prototype development board] + dot matrix module display driver
[Copy link]
The display driver of the program digital tube was introduced earlier. The chip it uses is MAX7219. In fact, this chip is not only used in serial digital tube modules, it can also be used in dot matrix modules.
Figure 1 is a dot matrix module, which is very similar to the serial digital tube module in usage, except for the initialization and display processing.
Figure 1 Dot matrix module
The initialization function of the dot matrix module is:
void Init_MAX7219_D(void)
{
Write_Max7219(0x0b, 0x07);
Write_Max7219(0x0c, 0x01);
Write_Max7219(0x0f, 0x00);
}
Since the dot matrix module needs the support of fonts when displaying, it is necessary to configure the corresponding font library for it. Its structure is as follows:
unsignedchar disp[38][8]={
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0
{0x10,0x30,0x50,0x10,0x10,0x10,0x10,0x10},//1
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2
{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9
{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
...
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z
{0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//zhong
{0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//guo
};
The program to implement the display test is:
Init_MAX7219_D();
while(1)
{
for(j=0;j<38;j++)
{
for(i=1;i<9;i++)
{
Write_Max7219(i,disp[j][i-1]);
for(k=1;k<65;k++)
{
delay_n(65);
}
}
for(k=1;k<650;k++)
{
delay_n(65);
}
}
}
After the program is compiled and downloaded, the display effect is shown in Figure 2.
Figure 2 Display effect
Demo video:
点阵模块
|