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.

CCS10 MSP430F149 printf函数重定向到串口1,无法打印出整型数

Other Parts Discussed in Thread: MSP430F149, MSP430F5529

CCS版本: Version: 10.3.0.00007 

芯片型号:MSP430F149(没有使用TI的开发板)

烧录工具:MSP-FET430UIF

串口1:初始化程序参考官方例程fet_uart11_0115k_2

printf重定向程序:

/*
 * 函数名:Uart1_SendByte
 * 函数功能:串口1发送单个字符
 * 形参:data:要发送的字符数据
 * 返回值:无
 * 备注:无
 * */
void Uart1_SendByte(uint8_t data)
{
    while(!(IFG2 & UTXIFG1));
    TXBUF1 = data;
}

/*
 *
 * */
void Uart1_SendString(uint8_t* p)
{
    while(*p != '\0')
    {
        Uart1_SendByte(*p++);
    }
}

/*printf重定向到串口1*/
int fputc(int ch, FILE *f)
{
    Uart1_SendString((uint8_t*)&ch);
    return ch;
}

打印测试函数:

	uint8_t cnt = 0;
        while(1)
	{
	    if(cnt++ >= 255)
	    {
	        cnt = 0;
	    }
	    printf("cnt = %d\r\n",cnt);
	    delay_ms(1000);
	}

打印结果:

只能输出cnt=,字符输出没有问题,整型输出没有任何东西。

请问这种问题有什么办法可以解决吗?