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.
大家好、我正在尝试基于 TIVAWARE 示例文件夹中提供的示例使用 UART5。 我只是对代码进行了一些修改、以便仅使用我需要的内容、但我无法在串行端口中看到任何字符。
以下是我的代码:
#include #include #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "driverlib/sysputs.h" #include "driverlib/uart.h"#idt_uint32ut ut uints/iintuintegot_uidrupt_u32ut uinth 和 iinth uinth uinth uintegot_uintuintuidt_uintuintuidt_uidrupt.h * uinth while (ui32Count---) { // //将下一个字符写入 UART。 // UARTCharPutNonBlocking (UART5_BASE、* pu8Buffer++); } } int main (void) { /*将时钟设置为以120MHz 运行*/ G_ui32SysClock= SysCtlClockFreqSet ((SYSCTL_XTAL_25MHz | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480)、120000000); /*为 UART*/启用 UART 和 GPIO SysCtlPeripheralEnable (SYSCTL_Periph_UART5); SysCtlPeripheralEnable (SYSCTL_Periph_GPIOC); /*设置 UART 功能的引脚*/ GPIOPinConfigure (GPIO_PC6_U5RX); GPIOPinConfigure (GPIO_PC7_U5TX); GPIOPinTypeUART (GPIO_PORTC_BASE、GPIO_PIN_6 | GPIO_PIN_7); /*设置 UART5配置*/ UARTConfigSetExpClk (UART5_BASE、g_ui32SysClock、19200、 (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE); /*将永远重复的任务*/ while (1){ UARTSend ((uint8_t *)"\033[2JEnter 文本:"、16); } 返回0; }
我使用的 USB 转串行转换与此类似: