TM4C123GLaunchPad教程五_UART
TM4C123GH6PM具有8个串口。可以配置它的波特率,数据长度,奇偶校验位,停止位等参数。同时UART也有多个中断。
代码及详解
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_ints.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/uart.h"
#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
/* 中断服务函数 */
void vUART0_IntHandler(void)
{
uint32_t ui_Status;
int32_t i_UartReceiveData;
/* 读取当前的中断状态 */
ui_Status = UARTIntStatus(UART0_BASE, true);
/* 清除中断状态 */
UARTIntClear