我写了UART_SendStr()函数来发送AT命令。我可以从SIM808接收和发送SMS。现在,我想向phpmyadmin发送消息和发件人号码。我能怎么做? UART_SendStr()函数如下:
void UART_SendChar (char data)
{
while (get_bit(UART1->FR,5)==1) //Poll on bit 5 (TXFF) until it becomes 0. The loop exits only if the bit value is 0
{
}
UART1->DR=data; // Put the data to send in the UARTDR register
}
void UART_SendStr (char* string)
{
char i=0;
while (*(string+i) != '\0')
{
UART_SendChar(*(string+i));
i+=1;
}
}
我创建了gsm_send_data()函数,用于向phpmyadmin发送消息和发件人编号。
void gsm_send_data(char *Number, char *Text)
{
UART_SendStr("AT+HTTPINIT\r\n");
delay_ms(1000);
UART_SendStr("AT+HTTPPARA=\"URL\",\"http://my_IP_adress/info.php?num=%c&text=%c\"");
delay_ms(1000);
}
问题是我无法使用UART_SendStr函数编写AT命令。