微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > 新手求助 LPC1788 串口1 查询方式 发送hello world 串口助手一直木有显示 这是什么问题啊?

新手求助 LPC1788 串口1 查询方式 发送hello world 串口助手一直木有显示 这是什么问题啊?

时间:10-02 整理:3721RD 点击:
#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\n\r";
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_ConfigStructInit(&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);               //发送数据
                }
        }
}

使用LPC1788库函数的一些总结经验

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top