Hi Team,
I am struggeling to understand what I am doing wrong,
I have the Voltage of AN0 in a Float variable example 3.338xxx then I load the value into a Long variable for the component macro SendNumber
in the debugger I see now iin the LoadSignal(the ANO Voltage) 3.338 but in the TestNumber Variable(Long) I only see the 3 the decimal part is missing
this is also to for the value received on the other end the 3 is received but the decimal part is missing.
What am I doing wrong ,I also tried to convert the 3.338 to a string and send the string that also clips the decimal part.
Not that I think this is relevant however just for the exception PIC18F26K80 .
Pleas help the old man
here for example the value was 2.9200 I only receive the 2
Send Number over UART
Moderator: Benj
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Send Number over UART
Hi,
Yes, transferring a float value into an integer variable you will lose the fractional part
try this ... where 3 is the precision
Yes, transferring a float value into an integer variable you will lose the fractional part
try this ... where 3 is the precision
Code: Select all
LoadSignal = 3.338
Text = FloatToString$ (LoadSignal,3)
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Send Number over UART
Thanks a million Leigh
I appreciate you pulling me out of the endless loop
I appreciate you pulling me out of the endless loop
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR