Float number problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Float number problem

Jump to solution
2,989 Views
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

Labels (1)
0 Kudos
1 Solution
2,907 Views
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

 

View solution in original post

5 Replies
2,926 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Aleshea,

How about use another terminal to show result?

 

BR

Alice

2,916 Views
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 Kudos
2,959 Views
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 Kudos
2,908 Views
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

 

2,898 Views
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 Kudos