#include "LPC177x_8x.h"
#include "lpc177x_8x_gpio.h"
#include "lpc177x_8x_uart.h"
#include "lpc177x_8x_pinsel.h"
//#define LED_CON_PIN (23)
//#define GPIO_PORT_NUM (0)
unsigned char str[]="hello world
";
void Uart_Init(void)
{
UART_CFG_Type UART_ConfigStructure;
UART_FIFO_CFG_Type UART_FIFOInitStructure;
PINSEL_ConfigPin(2,0,2); //设置P2.0为U1TXD功能
PINSEL_ConfigPin(2,1,2); //设置P2.1为U1RXD功能
UART_ConfigStruc
tinit(&UART_ConfigStructure);
UART_Init(UART_1,&UART_ConfigStructure); //UART_1初始化
UART_FIFOConfigStructInit(&UART_FIFOInitStructure);
UART_FIFOConfig(UART_1,&UART_FIFOInitStructure);
UART_TxCmd(UART_1,ENABLE); //UART_1 TX使能
}
int main(void)
{
Uart_Init();
while(1)
{
if(UART_CheckBusy(UART_1)==RESET) //检测UART_1是否忙碌,忙碌返回SET,不忙碌返回RESET
{
UART_Send(UART_1,str,sizeof(str),BLOCKING); //发送数据
}
}
}
一周热门 更多>