Float number problem

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

Float number problem

跳至解决方案
6,999 次查看
Alexshea
Contributor III

Hello everyone, my code used to work fine, but I changed the chip and added some new lines to my code. I used to read two temperatures (LM35) from ADC and I want my data to be float. Now instead of dot it shows temperatures with something similar to a y with two dots on top of it. For example instead of showing 25.3 it shows something like 25y3. I can show the temperatures in integer correctly, but when I change the data to float it shows something weird like 25y3. It used to work fine. I added my code and the screenshot of the bluetooth app. Btw my chip is LPC1768

Thanks in advance, 

Alex

标签 (1)
0 项奖励
回复
1 解答
6,917 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi

I think you can consider to change the library or the float number format as the following screenshot.

1)change the library

Setting->Miscellaneous->library header

2)change the float format

Setting->Architecture->Floating point.

Hope it can provide a clue.

Hope it can help you

BR

XiangJun Rong

 

 

xiangjun_rong_0-1650507554094.png

 

在原帖中查看解决方案

5 回复数
6,936 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Aleshea,

How about use another terminal to show result?

 

BR

Alice

6,926 次查看
Alexshea
Contributor III

Thank you for the reply. Actually, I tried that with LabVIEW too. Problem wasn't with the Bluetooth terminal. Interestingly, it works fine when I use only uart3, but when I activate uart1 it messes up float numbers. I could send them as uint and instead of sending the data in float I sent them in uint and devided it by 10 in LabVIEW, so that I can see the data in LabVIEW like float numbers. So, I bypassed this problem, though still it's good to know why activating uart1 messes up the data in float

0 项奖励
回复
6,969 次查看
Alexshea
Contributor III

@xiangjun_rong Hi, could you please help me? I showed this code to you many times. Someone else also told me my float variables shouldn't have that much zeros.

0 项奖励
回复
6,918 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi

I think you can consider to change the library or the float number format as the following screenshot.

1)change the library

Setting->Miscellaneous->library header

2)change the float format

Setting->Architecture->Floating point.

Hope it can provide a clue.

Hope it can help you

BR

XiangJun Rong

 

 

xiangjun_rong_0-1650507554094.png

 

6,908 次查看
Alexshea
Contributor III

Thank you so much. I think it'll work this way. I sent the data in uint16 and change it into float in LabVIEW, but I may face this problem again and can try what you recommended

0 项奖励
回复