1、int led = 0x200;intlcddata52=0;intrunnian=1,flag=2,dian=0,flag2=1,timer=0;charrtc30;char no=0;char lcd_code16= /编码 0xeb,/0 0x0a,/1 0xad,/2 0x8f,/3 0x4e,/4 0xc7,/5 0xe7,/6 0x8a,/7 0xef,/8 0xcf,/9 0x7e,/A 0x37,/B 0x71,/C 0x1f,/D 0x75,/E 0x74/F;/private functionvoidLCD_Write(int data, int bit);voidSyst
2、ick_Proc(void);voidLcd_Proc(void);void lcd_display0(void);void lcd_display1(void);void lcd_display2(void);void lcd_display3(void);void lcd_display4(void);void lcd_display5(void);void lcd_display6(void);voidUart_IO_Config(void);voidLCD_IO_Config(void);voidLed_IO_Config(void);voidButton_IO_Config(void
3、);voidEXTILineConfig(void);voidNVIC_Configuration(void);voidUart_Init(void);voidLCD_Init(void);voidSystick_Init(void);voidLED_Proc(void);voidUart(void);voiduartPuts( u8 *s);voidUart_r(void);voidUSART_GetS_Time(void);int main(void)/SystemInit();/Systick_Init();SystemInit();SysTick_Config(9000000);LCD
4、_IO_Config();Led_IO_Config();Uart_IO_Config();Button_IO_Config();EXTILineConfig();NVIC_Configuration();Uart_Init();LCD_Init();while(1) Systick_Proc(); Lcd_Proc(); Uart_r();voidSystick_Proc(void)if(NVIC_STCSR&0x10000) dian=1; if(+time0)=60) time0=0;if(+time1) time1=0;if(+time2)=24)time2=0; switch(tim
5、e4) case 1:case 3:case 5:case 7:case 8:case 10: case 12:if(+time3 = 32)if(+time4 = 13)time4=1;break; case 2:if(runnian)if(+time3 = 30)if(+time4 = 13)time4=0; else if(+time3 = 29)if(+time4 break;case 4:case 6:case 9: case 11:= 31)if(+time4 default:break;/time4=0;time3=0; sprintf(rtc ,%d-%d %d:%d:%d,t
6、ime4,time3,time2,time1,time0); /格式化输入出处 /sprintf(rtc2 ,);lcddata00 = time0 % 10;lcddata01 = time0 / 10;lcddata10 = time1 % 10;lcddata11 = time1 / 10;lcddata20 = time2 % 10;lcddata21 = time2 / 10;lcddata30 = time3 % 10;lcddata31 = time3 / 10;lcddata40 = time4 % 10;lcddata41 = time4 / 10; /之前开始以分钟之后才能
7、显示 放在前边日期与时间是:Uart();while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) = RESET);USART_SendData (USART1,0xd);USART_SendData (USART1,0xa);LED_Proc();voidLcd_Proc(void)/*inttemp8;temp0 = (lcd_codemin_display_h&0xf0)4); /分钟十位高四位temp1 = (lcd_codemin_display_h&0x0f); /分钟十位低四位temp2 = (lcd_codemin_display_l
8、& /分钟个位高四位temp3 = (lcd_codemin_display_l& /分钟个位低四位temp4 = (lcd_codesec_display_h& /秒钟十位高四位temp5 = (lcd_codesec_display_h& /秒钟十位低四位temp6 = (lcd_codesec_display_l& /秒钟个位高四位temp7 = (lcd_codesec_display_l& /秒钟个位低四位*/switch(flag) case 0:lcd_display0();lcd_display1();lcd_display2(); case 3:lcd_display3();
9、 case 4:lcd_display4(); case 5:lcd_display5(); case 6:lcd_display6();void lcd_display0(void) /时分显示LCD_Write(514)+(08)+lcd_codelcddata21+(dian 4), 17);/移位出现问题14)+(28)+lcd_codelcddata20, 17); /移位这一块14)+(48)+lcd_codelcddata11, 17);14)+(68)+lcd_codelcddata10, 17);void lcd_display1(void) /月日显示8)+lcd_codelcddata41, 17);8)+lcd_codelcddata40, 17);8)+lcd_codelcddata31, 17);8)+lcd_codelcddata30, 17);void lcd_display2(void) /分秒显示8)+lcd_codelcddata11+(dian 8)+lcd_codelcddata01, 17);8)+lcd_codelcddata00, 17);void lcd_display3(void) /月设置显示 if(dian)8)+no, 17);8)+lcd_codelc
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1