【SoC 6 BLE原型开发板】+点阵模块显示驱动
<p align="left">前面介绍过程序数码管的显示驱动,它所使用的芯片是MAX7219。其实该芯片不仅是用在串行数码管模块,它还可以用在点阵模块上。</p><p align="left" >图1是点阵模块,它的用法与串行数码管模块十分相近,只是在初始化和显示处理方面有所区别。</p>
<p align="left" > </p>
<p align="left" >图1点阵模块</p>
<p align="left" > </p>
<p align="left" >点阵模块的初始化函数为:</p>
<pre>
<code class="language-cpp">void Init_MAX7219_D(void)
{
Write_Max7219(0x0b, 0x07);
Write_Max7219(0x0c, 0x01);
Write_Max7219(0x0f, 0x00);
}</code></pre>
<p align="left" >由于点阵模块在显示时,需要字模的支持,故需为其配置相应的字库,其结构如下:</p>
<p align="left" >unsignedchar disp={</p>
<p align="left" >{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0</p>
<p align="left" >{0x10,0x30,0x50,0x10,0x10,0x10,0x10,0x10},//1</p>
<p align="left" >{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2</p>
<p align="left" >{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3</p>
<p align="left" >{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4</p>
<p align="left" >{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5</p>
<p align="left" >{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6</p>
<p align="left" >{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7</p>
<p align="left" >{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8</p>
<p align="left" >{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9</p>
<p align="left" >{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A</p>
<p align="left" >{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B</p>
<p align="left" >{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C</p>
<p align="left" >...</p>
<p align="left" >{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X</p>
<p align="left" >{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y</p>
<p align="left" >{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z</p>
<p align="left" >{0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//zhong</p>
<p align="left" >{0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//guo</p>
<p align="left" >};</p>
<p align="left" >实现显示测试的程序为:</p>
<pre>
<code class="language-cpp"> Init_MAX7219_D();
while(1)
{
for(j=0;j<38;j++)
{
for(i=1;i<9;i++)
{
Write_Max7219(i,disp);
for(k=1;k<65;k++)
{
delay_n(65);
}
}
for(k=1;k<650;k++)
{
delay_n(65);
}
}
}</code></pre>
<p align="left" >经程序的编译和下载,其显示效果如图2所示。</p>
<p align="left" > </p>
<p align="left" >图2 显示效果</p>
<p align="left" > </p>
<p align="left" >演示视频:</p>
<p align="left" >7245157f6e1b654e0348b09356ff06fa<br />
</p>
页:
[1]