请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
部件号:TMS320F28.0025万C 主题中讨论的其他部件:C2000WARE
各位专家,您好!
您能否分享如何将'SCANF'函数重定向到SCI接口的方法或演示? 在C2000Ware演示的帮助下,我找到并实现了SCI上的打印功能,但客户希望进一步实现扫描功能。 感谢你的帮助。
此致,
意愿
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.
各位专家,您好!
您能否分享如何将'SCANF'函数重定向到SCI接口的方法或演示? 在C2000Ware演示的帮助下,我找到并实现了SCI上的打印功能,但客户希望进一步实现扫描功能。 感谢你的帮助。
此致,
意愿
您好,
您是否可以尝试以下(未经测试的)代码? 如果这还不够,我会联系我们,但我认为对“sci_ex4_stdout_redirect”C2000Ware示例所做的以下更改就足够了。
示例所需的更改:
在sci_ex4_sdout redirect.c文件中:
1.将UartGetChar添加到声明中:
// // Declarations // void UartSetup(); void UartPutChar(uint16_t charToWrite); uint16_t UartGetChar();
2.将UartGetChar函数添加到文件底部:
uint16_t UartGetChar()
{
return SCI_readCharBlockingFIFO(SCIA_BASE)
}
在UART_drv.c文件中:
1.将“UART_READ”函数更改为如下所示:
/*****************************************************************************/
/* */
/* UART_read() reads *at most* count bytes. */
/* */
/*****************************************************************************/
int UART_read(int dev_fd, char *buf, unsigned count)
{
/*-----------------------------------------------------------------------*/
/* Get chars using the SCI peripheral, blocking read wait for response */
/*-----------------------------------------------------------------------*/
for (i=0; i < count; i++)
buf[i] = UartGetChar();
return count;
}
请告诉我这是否有效,如果不能,我将与驱动程序团队团队同步,以确定UART_drv*文件的必要更新。
此致,
文斯