Help with phsa
Andrew C
Posts: 14
Hi,
When I put this code into my program:
time := (phsa - 624) #> 0···············
a := time
the time variable will·display a number like 773 in hyper terminal.
However, when I display a, it will show a number such at 1e-42.
Can someone please explain to me why a does not read the same as time?
When I put this code into my program:
time := (phsa - 624) #> 0···············
a := time
the time variable will·display a number like 773 in hyper terminal.
However, when I display a, it will show a number such at 1e-42.
Can someone please explain to me why a does not read the same as time?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
I need to put a filter on my thinking. Yep, I converted to string!
What are you using to convert to string?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
a is multiplying ok, but it appears to be the "b" that is not adding correctly.
Strange, here is the code:
long a
long b
long c
long time
dira[noparse][[/noparse]17] := outa[noparse][[/noparse]17] := 1
waitcnt(clkfreq/10_000 + cnt)
phsa~
dira[noparse][[/noparse]17]~
waitcnt(clkfreq + cnt)
time := (phsa - 624) #> 0
Debug.Str(String(13, "time = "))
debug.dec(time)
Debug.Str(String(" which correlates to "))
a := fMath.FMul(time, 1.5279)
b := fMath.FAdd(a, 36.1526)
debug.dec(b)
Debug.Str(String(" ohms"))
Debug.Str(String(13, "a = "))
Debug.dec(a)
Debug.Str(String(13, "b = "))
Debug.dec(b)
Debug.Str(String(13, "c = "))
Debug.dec(c)
Debug.Str(String(13, "Dec version of time = "))
Debug.dec(time)
Debug.Str(String(13, "Dec version of a = "))
Debug.dec(a)
waitcnt(clkfreq + cnt)
Post Edited (Andrew C) : 12/16/2009 12:11:08 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
In the floatstring object there is a function to convert a float to a string which would be useful when outputting to the terminal.
There is a float demo showing the use of floatstring that comes with the prop tool.
Cheers,
Graham
p.s. to make your code more readable surround it with code tags [noparse][[/noparse]code ] and [noparse][[/noparse]/code ]
(but remove the spaces between the square brackets)
Thank you! I'm learning more again. Here is the code I used to help understand:
Post Edited (Andrew C) : 12/16/2009 2:49:19 AM GMT