历史上的今天
今天是:2024年10月08日(星期二)
2021年10月08日 | STM32串口通信printf重定向方法
2021-10-08 来源:eefocus
在源程序中加入如下代码,包含“stdio.h”。
默认使用USART1,确认串口已经初始化成功、
#pragma import(__use_no_semihosting)
_sys_exit(int x)
{
x = x;
}
struct __FILE
{
int handle;
/* Whatever you require here. If the only file you are using is */
/* standard output using printf() for debugging, no file handling */
/* is required. */
};
/* FILE is typedef’ d in stdio.h. */
FILE __stdout;
int fputc(int ch, FILE *f)
{
while(USART_GetFlagStatus(USART1,USART_FLAG_TC) == RESET);
USART_SendData(USART1,ch);
return ch;
}
史海拾趣
|
Web2.0战火波及移动IM 3G前圈地争夺话语权 2006-7-10 3G的山雨欲来、2G业务的示范效应、web2.0的遍地开花,年余以来,在这种种利好刺激下,基于2.5G的移动互联网业务正逐步消解来自政策、技术、应用等层面的晦暗因素,呈现出爆 ...… 查看全部问答> |
|
A flag to another clock domainIf the signal that needs to cross the clock domains is just a pulse (i.e. it lasts just one clock cycle), we call it a \"flag\". The previous design usually doesn\'t work (the flag might be missed, or ...… 查看全部问答> |
|
来自:电子工程师技术交流(12425841)我想采用开路电压法设计电路 通过电压来粗略判断电量 是设计电路 利用单片机AD功能完成电压采集 各位大侠有没有相关电路,参考一下 … 查看全部问答> |
|
$(\'swf_pxT\').innerHTML=AC_FL_RunContent(\'width\', \'550\', \'height\', \'400\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', encodeURI(\'http://player.youku.com/player.php/sid/XMjgxOTM1Njgw/v.sw ...… 查看全部问答> |
|
初次了解 C2000,C2000™ Piccolo LaunchPad 是价格低廉的评估平台,旨在帮助您跨入 C2000 Piccolo 微控制器实时控制编程领域。 LaunchPad 基于 Piccolo TMS320F28027,具有 64KB 板载闪存、8 个 PWM 通道、eCAP、12 位 ADC、I2C、SPI、UART ...… 查看全部问答> |
|
本帖最后由 pinggougou 于 2015-2-27 00:29 编辑 我定义一个数组,type state is (inc,dec,add,not,load); 语法检查提示:ERROR: syntax error near not (VHDL-1261) 把not去掉后,就正确了!!这是为什么呢??… 查看全部问答> |




