您好!
我需要使用 UART1将 AT 命令发送到 Sim800A 模块、但它不起作用。 我知道这是因为我没有收到来自 sim 模块的消息。 我需要您的帮助、我必须在本周结束时完成该项目。 情况紧急。 这是我的代码:
#include 
#include 
#include 
#include "inc/tm4c123gh6m.h" 
#include "inc/hw_memmap.h" 
#include "inc/hw_types.h" 
#include "driverlib/pin_map.h" 
#include "driverlib/sysctl.h" 
#include "driverlib/gpio.h" 
#include "driverlib/uart.h" 
#include "utils/uartstdio.h" 
void delay_ms (int t) 
{ 
SysCtlDelay (SysCtlClockGet ()/(3*1000/t)); 
} 
void sendStr (char *str) 
{ 
while (* str) 
{ 
UARTCharPut (UART1_base、* str); 
STR++; 
} 
} 
int main (空) 
{ 
SysCtlClockSet (SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHz); 
SysCtlPeripheralEnable (SYSCTL_Periph_UART1); 
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOB); 
GPIOPinConfigure (GPIO_PCTL_PB0_U1RX); 
GPIOPinConfigure (GPIO_PCTL_PB1_U1TX); 
GPIOPinTypeUART (GPIO_PORTB_BASE、GPIO_PIN_0 | GPIO_PIN_1); 
UARTConfigSetExpClk (UART1_base、SysCtlClockGet ()、9600、(UART_CONFIG_WLEN_8 |UART_CONFIG_STOP_ONE|UART_CONFIG_PAR_NONE)); 
sendStr ("at\n"); 
delay_ms (200); 
sendStr ("AT+CMGf=1\n"); 
delay_ms (200); 
sendStr ("AT+CMGs="0944353095\"\n"); 
delay_ms (200); 
sendStr ("abcde\n"); 
delay_ms (200); 
UARTCharPutNonBlocking (UART1_base、26); 
delay_ms (200); 
}