jinglixixi 发表于 2020-10-26 13:08

【AT-START-F403A测评】+图标式应用系统设计 (兼结题报告)

本帖最后由 jinglixixi 于 2020-10-26 14:14 编辑

<p>&nbsp;AT32F403A开发板是一款功能强大的开发板,将潜能极大地发掘出来才是好的设计,为此,将先前建立在同一强大开发平台的设计移植它的上面以展示它的性能。</p>

<p>该设计的特点是采用图标式的界面设计,由于TFT未配置触摸功能,故以按键来辅助功能的选择,其主界面如图1所示,功能选择如图2所示。</p>

<p></p>

<p>图1 主界面</p>

<p></p>

<p>图2 功能选择</p>

<p>1. 电子时钟</p>

<p>RTC电子时钟是依靠MCU内部的RTC计时器来实现,其工作界面如图3所示。</p>

<p></p>

<p>图3 电子时钟</p>

<p>实现RTC显示功能的程序如下:</p>

<pre>
<code class="language-cpp">        LCD_Clear(WHITE);         
        show_imageh(10,300,0);  //200*200 * 1     
        showhanzi16h(60,80,0,0);
        showhanzi16h(60,60,1,0);
        showhanzi16h(60,40,2,0);
        Delay_ms(400u);
        while(GPIO_ReadInputDataBit(GPIOA, GPIO_Pins_0)==0)
        {       
             rtc_show_time();
        }  </code></pre>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>

<p>2.温湿度检测</p>

<p>借助外挂的DHT22温湿度传感器模块,可对环境的温湿度进行采集,其显示效果如图4所示。</p>

<p></p>

<p>图4温湿度检测</p>

<p>显示温湿度显示的程序如下:</p>

<pre>
<code class="language-cpp">         LCD_Clear(WHITE);    
         show_imageh(10,300,0);  //200*200 * 1
         while(GPIO_ReadInputDataBit(GPIOA, GPIO_Pins_0)==0)
         {  
                senflag=DHT22_Init();         
                  if(!senflag)
                  {

                        DHT22_Read_Data(&amp;temperature,&amp;humidity);
                        LCD_ShowCharh(100,100,'T',1);
                        LCD_ShowCharh(100,90,'e',1);
                        LCD_ShowCharh(100,80,'m',1);
                        LCD_ShowCharh(100,70,'p',1);
                        LCD_ShowCharh(100,60,':',1);
                        LCD_ShowCharh(100,50,temperature/10+'0',0);
                        LCD_ShowCharh(100,40,temperature%10+'0',0);
                        LCD_ShowCharh(120,100,'H',1);
                        LCD_ShowCharh(120,90,'u',1);
                        LCD_ShowCharh(120,80,'m',1);
                        LCD_ShowCharh(120,70,'i',1);
                        LCD_ShowCharh(120,60,':',1);
                        LCD_ShowCharh(120,50,humidity/10+'0',0);
                       LCD_ShowCharh(120,40,humidity%10+'0',0);
                   }
                   Delay_ms(200u);
           }</code></pre>

<p>3.波形绘制</p>

<p>在配置绘图函数的基础上,可完成波形绘制的功能,其绘制3相交流电的波形曲线如图5所示。</p>

<p></p>

<p>图5波形绘制</p>

<p>绘制正弦曲线的参数数组为:</p>

<p>unsigned char values=</p>

<p>{</p>

<p>&nbsp;{0x07, 0xFF},{0x08, 0xC8},{0x09, 0x8E},{0x0A, 0x51},{0x0B, 0x0F},</p>

<p>&nbsp;{0x0B, 0xC4},{0x0C, 0x71},{0x0D, 0x12},{0x0D, 0xA7},{0x0E, 0x2E},</p>

<p>&nbsp;{0x0E, 0xA5},{0x0F, 0x0D},{0x0F, 0x63},{0x0F, 0xA6},{0x0F, 0xD7},</p>

<p>&nbsp;{0x0F, 0xF5},{0x0F, 0xFF},{0x0F, 0xF5},{0x0F, 0xD7},{0x0F, 0xA6},</p>

<p>&nbsp;{0x0F, 0x63},{0x0F, 0x0D},{0x0E, 0xA5},{0x0E, 0x2E},{0x0D, 0xA7},</p>

<p>&nbsp;{0x0D, 0x12},{0x0C, 0x71},{0x0B, 0xC4},{0x0B, 0x0F},{0x0A, 0x51},</p>

<p>&nbsp;{0x09, 0x8E},{0x08, 0xC8},{0x07, 0xFF},{0x07, 0x36},{0x06, 0x70},</p>

<p>&nbsp;{0x05, 0xAD},{0x04, 0xEF},{0x04, 0x3A},{0x03, 0x8D},{0x02, 0xEC},</p>

<p>&nbsp;{0x02, 0x57},{0x01, 0xD0},{0x01, 0x59},{0x00, 0xF1},{0x00, 0x9B},</p>

<p>&nbsp;{0x00, 0x58},{0x00, 0x27},{0x00, 0x09},{0x00, 0x00},{0x00, 0x09},</p>

<p>&nbsp;{0x00, 0x27},{0x00, 0x58},{0x00, 0x9B},{0x00, 0xF1},{0x01, 0x59},</p>

<p>&nbsp;{0x01, 0xD0},{0x02, 0x57},{0x02, 0xEC},{0x03, 0x8D},{0x04, 0x3A},</p>

<p>&nbsp;{0x04, 0xEF},{0x05, 0xAD},{0x06, 0x70},{0x07, 0x36}</p>

<p>};</p>

<p>此外,它能利用A/D转换功能对MCU内部的温度传感器进行采集,所绘制的温度曲线如图6所示,温度波动值在1度以内。</p>

<p></p>

<p>图6 片内温度采集</p>

<p>实现该功能的相关程序如下:</p>

<pre>
<code class="language-cpp">         POINT_COLOR=RED;
         BACK_COLOR=WHITE;
         i=0;
         LCD_ShowCharh(20,130,'t',0);
         LCD_ShowCharh(20,120,'=',0);
         LCD_ShowCharh(20,80,'C',0);
         while (1)
        {
             Delay_sec(1);
             t=(uint16_t)(( 1.26 -(double)ADCConvertedValue*ADC_VREF/4096)/(-0.00423) +25);
            LCD_ShowNum(20,100,t,2);
             sj=t*2;
             if(i==0) sp=sj;  
           LCD_DrawLine(220-sp, 300-4*(i-1), 220-sj, 300-4*(i));
           sp=sj;
             if(i&lt;72) i++;
             else
             {
                  LCD_Clear(WHITE);
                  LCD_DrawLine(10, 304, 220, 304);
                  LCD_DrawLine(60, 10, 60, 304);
                  LCD_DrawLine(100, 10, 100, 304);
                 LCD_DrawLine(140, 10, 140, 304);
                  LCD_DrawLine(180, 10, 180, 304);
                  LCD_DrawLine(220, 10, 220, 304);
                  LCD_ShowCharh(20,170,'A',0);
                LCD_ShowCharh(20,162,'/',0);
                LCD_ShowCharh(20,154,'D',0);
                  LCD_ShowCharh(20,130,'t',0);
                LCD_ShowCharh(20,120,'=',0);
                  LCD_ShowCharh(20,80,'C',0);
                  i=0;
             }
           Delay_ms(200);
         }</code></pre>

<p>4. MP3播放菜单</p>

<p>借助&nbsp;AT32F403A的串行通讯功能,可通过串口指令来控制MP3音频播放模块,图7是其所实现的中文歌单,以辅助歌曲的选播。</p>

<p></p>

<p>图7歌曲选择界面</p>

<p>5. 图片显示</p>

<p>&nbsp;AT32F403A具有较大的内存,在不做它用的情况下,完全可以支持一张320*240像素的图片显示。在借助板载16M FLASH存储器的情况下,则可实现数码相框的功能。</p>

<p></p>

<p>图8 图片显示</p>

<p>&nbsp;</p>

<p>基于FLASH的图像显示程序为:</p>

<pre>
<code class="language-cpp">  // 显示一页的图像
  i=0;
  while(i&lt;SPIM_PAGE_SIZE)
  {
         da=WriteBuffer;
         da&lt;&lt;=8;
         da|=WriteBuffer;
         POINT_COLOR=da;
         LCD_DrawPoint(10+((SPIM_ADDR+i)/400),300-((SPIM_ADDR+i)%400)/2);
         i=i+2;
         if((i+SPIM_ADDR)&gt;=80000) goto ok;       
         SPIM_ADDR=SPIM_ADDR+4096;
  }
  goto ok;
 /* Print the ext.flash testing result */
  ok:
 printf("test SPIM success!\r\n");
}</code></pre>

<p>由于其他功能缺少画面感,就不在此一一加以介绍了,相信由此便可管窥一斑地见识到&nbsp;AT32F403A开发板的强大,也在此为芯片的国产化摇旗呐喊、占脚助威!</p>

<p>再次对测评活动的组织者及雅特力公司所提供的AT32F403A开发板表示感谢!</p>

freebsder 发表于 2020-10-26 23:41

<p>可以可以,坚持看到最后一张图片。。。好图</p>

jinglixixi 发表于 2020-10-27 07:56

<p>图片比较直观易识别!</p>
页: [1]
查看完整版本: 【AT-START-F403A测评】+图标式应用系统设计 (兼结题报告)