Printing out Floating Numbers
Technic-R-C
Posts: 117
hello, I am having trouble printing out floating point calculations to the Parallax serial terminal and I was wondering if any of you folks could help me out.
The output of this code to the Parallax serial terminal is:
·with nothing afterwards as if the program stopped after
All help is appreciated.
Thank you
Technic-R-C
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ Debug : "FullDuplexSerialPlus" fMath : "Float32" fString : "FloatString" PUB Convert | a, b, c, d Debug.StartPST(19200) waitcnt(clkfreq*2 + cnt) Debug.tx(Debug#CLS) a := 21.622 b := 80_000 'WORKS BELOW Debug.str(String(" a: ")) Debug.str(fstring.FloatToString(a)) Debug.str(String(" b: ")) Debug.dec(b) 'DOES NOT WORK BELOW c := fMath.FMul(a, 32) d := fMath.FAdd(c, b) Debug.str(String(" c: ")) Debug.str(fstring.FloatToString(c)) Debug.str(String(" d: ")) Debug.str(fstring.FloatToString(d))
The output of this code to the Parallax serial terminal is:
a: 21.622 b: 80000
·with nothing afterwards as if the program stopped after
c := fMath.FMul(a, 32)
All help is appreciated.
Thank you
Technic-R-C
Comments
They are as follows:
·These aren't correct.. I'll keep trying but if anyone could help out it'd be appreciated.
Technic-R-C
you have to set
and then
Problem solved.· I scratched my head for two days but figured it out within seconds of posting it on this forum.· Forum moderators please feel free to delete this thread.
Thanks
Technic-R-C