【翌创ET6001测评】RTC电子时钟
<p>翌创ET6001开发板具有RTC计时功能,在使用串口0连接外部USB转TTL模块的情况下,可查看到RTC计时的效果,见图2所示。</p><p> </p>
<p>图1 串口0接口</p>
<p> </p>
<p> </p>
<p>图2 测试效果</p>
<p > </p>
<p >若将RTC与串行数码管显示模块相结合,则可实现电子时钟的计时效果,其主程序为:</p>
<pre>
<code class="language-cpp">int main(void)
{
rtcDatetime calendar;
uint8_t tick = 0;
RTC_Calendar_init();
EVB_SMG_Init();
Init_MAX7219();
Write_Max7219(1,1);
Write_Max7219(2,0);
Write_Max7219(3,10);
Write_Max7219(4,0);
Write_Max7219(5,0);
Write_Max7219(6,10);
Write_Max7219(7,0);
Write_Max7219(8,0);
while (1)
{
RTC_GetDatetime(&calendar);
if(tick != calendar.second)
{
tick = calendar.second;
Write_Max7219(1,calendar.second%10);
Write_Max7219(2,calendar.second/10);
Write_Max7219(4,calendar.minute%10);
Write_Max7219(5,calendar.minute/10);
Write_Max7219(7,calendar.hour%10);
Write_Max7219(8,calendar.hour/10);
}
}
}</code></pre>
<p>经程序的编译与运行,其效果如图3所示。</p>
<p> </p>
<p>图3 电子时钟效果</p>
<p> </p>
<p>演示视频:</p>
<p>7eb268540f9c108153f1eb6f684f4e55<br />
</p>
<p>优秀啊,点赞</p>
kouko 发表于 2024-11-5 17:40
优秀啊,点赞
<p>感谢支持!!!</p>
页:
[1]