This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于tm4c123gh6pm串口5的使用

Other Parts Discussed in Thread: TM4C123GH6PM

这个 是我的程序 我将串口换成UART0_BASE的时候 就进去中断  可是 串口5就进不去中断  为什么呢

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/rom.h"
#include "driverlib/pin_map.h"
void UARTSend(const uint8_t *pucBuffer, uint32_t ulCount);
void UARTIntHandler(void);
int main(void)
{
//使能FPU
FPUEnable();
FPULazyStackingEnable();
//设置时钟直接使用外部晶振
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

/////////uart 5
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);

GPIOPinConfigure(GPIO_PE4_U5RX);
GPIOPinConfigure(GPIO_PE5_U5TX);
GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
UARTConfigSetExpClk(UART5_BASE, SysCtlClockGet(),115200,(UART_CONFIG_WLEN_8|UART_CONFIG_STOP_ONE|UART_CONFIG_PAR_NONE));
//使能中断
// IntMasterEnable();
//使能串口中断
//UART Init
IntEnable(INT_UART5); //enable the UART interrupt
UARTIntEnable(UART5_BASE, UART_INT_RX|UART_INT_RT); //only enable RX interrupts
IntRegister(INT_UART5, UARTIntHandler);
while(1)
{
}
}

//串口发送函数
void UARTSend(const uint8_t *pucBuffer, uint32_t ulCount)
{
while(ulCount--)
{
//将要发送的字符写进UART
UARTCharPutNonBlocking(UART0_BASE, *pucBuffer++);
//UARTCharPut(UART0_BASE, *pucBuffer++);
}
}
//串口接收中断服务程序
void UARTIntHandler(void)
{
uint32_t ulStatus;
//获取中断状态
ulStatus = UARTIntStatus(UART5_BASE, true);
//清除中断标志
UARTIntClear(UART5_BASE, ulStatus);
//直到串口FIFO中没有数据时才退出循环
while(UARTCharsAvail(UART5_BASE))
{
//读串口接收的字符并回发
UARTCharPutNonBlocking(UART5_BASE,UARTCharGetNonBlocking(UART5_BASE));
}
}