Send Number over UART

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Send Number over UART

Post by QMESAR »

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. :oops:
Not that I think this is relevant however just for the exception PIC18F26K80 .

Pleas help the old man :D
P1.jpg
P1.jpg (26.67 KiB) Viewed 1905 times
P2.jpg
P2.jpg (36.9 KiB) Viewed 1905 times
here for example the value was 2.9200 I only receive the 2
P3.jpg
P3.jpg (93.67 KiB) Viewed 1905 times

User avatar
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

Post by LeighM »

Hi,
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)

User avatar
QMESAR
Valued Contributor
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

Post by QMESAR »

Thanks a million Leigh
:D
I appreciate you pulling me out of the endless loop :D :D

Post Reply