Using Serial_LDD To Print Integers to Serial Monitor

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Using Serial_LDD To Print Integers to Serial Monitor

跳至解决方案
2,323 次查看
adegonge
Contributor II

Hey Everyone,

 

I'm trying to use the Serial_LDD block in order to output some values to a serial monitor. I can get this function working just fine with characters and arrays of characters, but I can't get it to print integers unless I declare the value as a character (Like char n = '1';). I would like to be able to print any integer to the serial monitor, whether this be direct or by converting it into a character like I manually did above. Any help would be appreciated!

标签 (1)
0 项奖励
回复
1 解答
2,179 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

hi Andew,

i think the problem is your PC side serial terminal doesn't enable hex display. some serial terminal doesn't have feature of displaying hex character. please choose a serial terminal monitor that can display hex

otherwise you have to  modify your C code, convert your integer to a string. then display the member of string one by one via Serial_LDD to serial terminal. for this topic your can use google search -  how to convert ascii to string.


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
3 回复数
2,180 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

hi Andew,

i think the problem is your PC side serial terminal doesn't enable hex display. some serial terminal doesn't have feature of displaying hex character. please choose a serial terminal monitor that can display hex

otherwise you have to  modify your C code, convert your integer to a string. then display the member of string one by one via Serial_LDD to serial terminal. for this topic your can use google search -  how to convert ascii to string.


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
2,179 次查看
adegonge
Contributor II

Perfect thanks! I was using putty and that turned out to be the restricting factor, I downloaded RealTerm and I can now display numbers directly without having to convert to a string. Thanks!

0 项奖励
回复
2,179 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

you are welcome! thank you for using Freescale Community!


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复