STM32电子钟万年历Proteus仿真_LCD1602液晶屏
STM32电子钟万年历Proteus仿真_LCD1602液晶屏
(仿真+原理图+PCB+源码+报告)
仿真:protues 8.9
程序编译器:keil 5
编程语言:C语言
编号C0003
基本功能:
1.具有显示年、月、日、时、分、秒功能;
2.能计算并显示星期;
3.能手动调整时间;
4.具有闹钟功能。
文件清单:
- Proteus8.9 仿真图;
- C语言源代码,Keil5打开;
- Altium Designer 原理图 源文件和PDF;
- Altium Designer PCB 源文件和PDF;
- 参考报告(论文)。
仿真图(提供源文件):
原理图(提供源文件):
PCB(提供源文件):
程序:
int main(void)
{
bool i = 0;
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
delay_init(10); //³õʼ»¯ÑÓʱº¯Êý
TIM3_Init(2400-1, 72-1); // 10ms
MX_RTC_Init();
Key_Init();
Beep_Init();
LCD_Init();
sAlrm_g.Alm_Hour = 0;
sAlrm_g.Alm_Min = 0;
sAlrm_g.Alm_Sec = 10;
while(1)
{
switch(set_mode)
{
case 0:
HAL_RTC_GetDate(&hrtc, &sDate_g, RTC_FORMAT_BIN);
HAL_RTC_GetTime(&hrtc, &sTime_g, RTC_FORMAT_BIN);
Conv_Disp_Data(0);
LCD_write_string(0, 0, (char*)temp_line_one);
LCD_write_string(0, 1, (char*)temp_line_two);
break;
case 1:
Conv_Disp_Data(i*1);
i = !i;
LCD_write_string(0, 0, (char*)temp_line_one);
break;
case 2:
Conv_Disp_Data(i*2);
i = !i;
LCD_write_string(0, 0, (char*)temp_line_one);
break;
case 3:
Conv_Disp_Data(i*3);
i = !i;
LCD_write_string(0, 0, (char*)temp_line_one);
break;
case 4:
Conv_Disp_Data(i*4);
i = !i;
LCD_write_string(0, 0, (char*)temp_line_one);
break;
case 5:
Conv_Disp_Data(i*5);
i = !i;
LCD_write_string(0, 0, (char*)temp_line_one);
break;
case 6:
Conv_Disp_Data(i*6);
i = !i;
LCD_write_string(0, 0, (char*)temp_line_one);
break;
case 7:
Conv_Disp_Data(i*7);
i = !i;
LCD_write_string(0, 1, (char*)temp_line_two);
break;
case 8:
Conv_Disp_Data(i*8);
i = !i;
LCD_write_string(0, 1, (char*)temp_line_two);
break;
case 9:
Conv_Disp_Data(i*9);
i = !i;
LCD_write_string(0, 1, (char*)temp_line_two);
break;
default:
break;
}
if( (sTime_g.Hours == sAlrm_g.Alm_Hour) && (sTime_g.Minutes == sAlrm_g.Alm_Min) && (sTime_g.Seconds == sAlrm_g.Alm_Sec) )
{
for(uint8_t j = 0; j < 10; j++)
{
LED2_TOG();
HAL_Delay(300);
}
}
HAL_Delay(100);
}
}
资料清单:
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 嘉盛单片机!