void main(void){ // UCHAR Test[3]={0x88,0x01,0x02}; IO_Init(); init_Uart(); Timer0Init(); INT_Init(); System_SetParaInit(); EA=1; // USART_Send(Test,sizeof(Test),1); Delay_ms(100); BuzzerTriggrt = 1; while(1){ // Delay_ms(1000); // SBUF = 0xaf;while(!(SCON&0x02));SCON &= ~0x02; //if(Com1DataCounter != 0){ // Muti_Send_Byte(Com1DataBuffer,Com1DataCounter); //将上位机的数据直接下发到下面的单片机 // Com1DataCounter=0; // memset(Com1DataBuffer,0x00,600); //} P34 = 1; ENTM = 1; if(HeartbeatTrigger == 1) { UART_Fe_Seq++; USART1_Send(CommonDataBuffer,Fe_data_Organize(CMD_Heartbeat,&ReplySucc,1,0)); HeartbeatTrigger = 0; } if(ResetWifiTrigger == 1) { /*由徐志坚禁止了没有收到服务器的命令而重启WiFi的功能*/ //nResetWifi = 0; //Delay_ms(500); //nResetWifi = 1; //ResetWifiOnOff = 0;//关闭WIFI重置开关,WIFI重启以后,必须关闭重置开关防止WIFI模块连接服务器过程中再次重启。 ResetWifiTrigger = 0; } if(Com1HaveDate) { USART4_Send(Com1DataBuffer,Com1DataCounter); Com1DataCounter=0; memset(Com1DataBuffer,0x00,600); Com1HaveDate = 0; } if(Exint0Counter != 0) { Exint0_DATA_deal(); } } }
void USART1_SendText(uint8_t * text) { while(*text) { uint8_t temp; temp = *text; USART1_Send(temp); text++; } }
void USART1_SendBuf(uint8_t * _buf, uint8_t _len) { unsigned int i; for(i = 0; i < _len; i++) USART1_Send(_buf[i]); }