主题中讨论的其他器件:EK-TM4C1294XL
您好!
通过 XDC 工具(System_printf)生成 CCS 示例输出日志。 我想通过 UART 驱动程序(uart_write)输出日志。
您是否有一些示例, 尤其是使用一个或两个参数打印(例如 printf ("Config failed for deviceMap %u with error code %d\n\n"、deviceMap、RetVal);)
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.
您好!
通过 XDC 工具(System_printf)生成 CCS 示例输出日志。 我想通过 UART 驱动程序(uart_write)输出日志。
您是否有一些示例, 尤其是使用一个或两个参数打印(例如 printf ("Config failed for deviceMap %u with error code %d\n\n"、deviceMap、RetVal);)
您好!
请从 https://www.ti.com/tool/SW-TM4C 下载 TivaWare SDK。 TivaWare SDK 提供 一整套软件库。 这些库包括一个用于所有器件外设的驱动程序库 和大量示例。 TivaWare 驱动程序库 为每个外设提供易于使用的 API 可简化开发。 请从 C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\hello 中查看 hello 示例。 hello 示例将通过 UART 向您的 COM 端口发送'hello world'。 在以下两个目录中还有更多示例:
C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl
C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals
如果您使用的是 TI-RTOS、则有一些示例可以通过 UART 向 COM 端口发送消息。 请查找以下示例、这些示例可从 CCS 中的 TI Resource Explorer 下载。

您好!
您需要使用像 sprintf()这样的 C 库函数首先将格式化的输出发送到字符串,然后将字符串传递给 UART。 请参见下面的链接。
https://www.tutorialspoint.com/c_standard_library/c_function_sprintf.htm
您好!
如果您引用的是 sprintf 函数、则它是 C 运行时库的一部分。 您需要标头#include 。 下面是一个您可以在线找到的示例。 在这种情况下,您只需 将字符串作为参数传递给 uart_WRITE()函数。
#include <stdio.h>
#include <math.h>
int main () {
char str[80];
sprintf(str, "Value of Pi = %f", M_PI);
puts(str);
return(0);
}