// Send strings to the UART0.
void Uart0SendStrings(unsigned char *pStr)
{
while((*pStr!='\0'))
{
//Sends the character ucData to the transmit FIFO for the specified port.
//If there is no space available in the transmit FIFO, this
//function will wait until there is space available before return-ing.
UARTCharPut(UART0_BASE, *(pStr++)); //发送字符,若FIFO满,自动等待
//Writes the character ucData to the transmit FIFO for the speci?ed port.
//This function does not block, so if there is no space available,
//then a false is returned, and the application will have to retry the function later.
//UARTCharPutNonBlocking(UART0_BASE, *(pStr++)); //发送字符,若FIFO满,返回false
}
}
long Uart0ReceiveStrings(unsigned char s[4],unsigned char a,unsigned char i)
{
return i;
}
//主函数
int main(void)
{
unsigned char s[7];
unsigned char i;
unsigned int j;
unsigned char a;
//函数开始,调用Jta g防锁死程序
jtagWait();
// Set the clocking to run directly from the crystal.配置时钟
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_6MHZ);
// Enable the peripherals used by this example.
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
// Set GPIO A0 and A1 as UART pins.
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
// Configure the UART for 115,200, 8-N-1 operation.
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 9600,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
UARTFIFOLevelSet(UART0_BASE,UART_FIFO_TX4_8,UART_FIFO_RX6_8);
UARTIntEnable(UART0_BASE,UART_INT_RX|UART_INT_RT);
IntEnable(INT_UART0);
IntMasterEnable();
for(;;);