/************************************************************************ * @brief main function * @param[in] None * @return None ***********************************************************************/ int main(void) { uint16_t i; uint16_t ReData; SystemInit(); USART_Config(); init_display (); USART1_Puts("This msg from USART1\n\r"); USART2_Puts("This msg from USART2\n\r"); while(1) { #if 0 ReData = USART2_GetChar(); //USART2_Puts((unsigned char*)ReData); USART_SendData(USART2, ReData); #endif #if 1 USART2_Puts("*STS#"); GLCD_displayStringLn(Line7, "Sending: *STS#"); USART2_SmartCardGet(4); //updating data if (USART2_BufferCompare((uint8_t *)"*CP#", 4)) { USART2_Puts("*R0802#"); GLCD_displayStringLn(Line8, "Sending: *R0802#"); USART2_SmartCardGet(12); //updating data if (USART2_BufferCompare((uint8_t *)"*RD08024344#", 12)) { GLCD_clearLn(Line9); GLCD_displayStringLn(Line9, "Person 1"); //break; } if (USART2_BufferCompare((uint8_t *)"*RD08024142#", 12)) { GLCD_clearLn(Line9); GLCD_displayStringLn(Line9, "Person 2"); //break; } if (USART2_BufferCompare((uint8_t *)"*RD08024143#", 12)) { GLCD_clearLn(Line9); GLCD_displayStringLn(Line9, "Person 3"); //break; } } #endif } }
int main(void) { unsigned char key; Sys_Clock_Init(); SysTick_Configuration();//Sys定时器 USART_Configuration(); //配置串口 NVIC_Configuration(); //中断配置 // sys_power_on();//开启系统电源 LED_Init(); //指示灯 // KEY_Init(); //按键 USART1_Puts("this is a uart test!\n"); CheckRTC(); //2.RTC LED2_OFF(); while (1) { LED1_OFF();delay_nms(3000); LED1_ON(); delay_nms(100); key=KEY_Scan(); if(key==1) {LED2_ON(); } // // if(mode==0) //显示时间 // { if(RTC_1S==TRUE) { RTC_1S=FALSE; UpdateRTC(); } // } } }