Passing data problems - FloatToSting issue?
Martin Hebel
Posts: 1,239
Well,
I finally took the punge into video for a research project I'm involved in, and it support my long-time desire to do plotting with the Propeller video, but I've ran into an issue I can't seem to resolve.· I'm reading several channels of an ADC, plotting it, and showing some information in the text area.
As seen in the pic, the plots work fine, they are being sent raw ADC data.· The text at the top is converted to a string float before being passed.· When I call it·with the following, it seems to work fine:
But when I change it to this, the value of Vapp1 always follow Vapp2 as shown in the image.
I've tested it everywhich way, and the values are also sent via RF to StampPlot so I know they hold what they are suppose to.· Am I missing something or is there simply a glitch in FloatToString perhaps?
Once I get a few more things ironed out, I'll post the object for plotting a couple channels revised for general use.
Thanks all
Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
I finally took the punge into video for a research project I'm involved in, and it support my long-time desire to do plotting with the Propeller video, but I've ran into an issue I can't seem to resolve.· I'm reading several channels of an ADC, plotting it, and showing some information in the text area.
As seen in the pic, the plots work fine, they are being sent raw ADC data.· The text at the top is converted to a string float before being passed.· When I call it·with the following, it seems to work fine:
Vid.UpdateText(FS.FloatToString(VoltFloat[noparse][[/noparse]0]),string("0"),string("1"),string("1"))
Pub UpdateText (Vapp1,Vapp2,CH1,Ch2)| Time gr.width(0) gr.color(0) gr.box(0,151,256,40) PlaceText gr.text(45,151,Vapp1) gr.text(45,166,Vapp2) gr.text(180,151,Ch1) gr.text(180,166,Ch2) Time := fp.fdiv(FP.FFloat(timer),10.0) gr.text(215,177,fs.floattostring(Time))
But when I change it to this, the value of Vapp1 always follow Vapp2 as shown in the image.
Vid.UpdateText(FS.FloatToString(VoltFloat[noparse][[/noparse]0]),FS.FloatToString(VoltFloat[noparse][[/noparse]2]),string("1"),string("1"))
I've tested it everywhich way, and the values are also sent via RF to StampPlot so I know they hold what they are suppose to.· Am I missing something or is there simply a glitch in FloatToString perhaps?
Once I get a few more things ironed out, I'll post the object for plotting a couple channels revised for general use.
Thanks all
Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
Comments
Ok.... now to figure out how to get around this....
Thanks! Gosh, you guys are great! Once I post a problem, I start thinking what you may be thinking! It's like talking out-loud I guess [noparse]:)[/noparse]
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
Yes, the Float to String routines use the same temporary buffer to store the string until it's used. You can get around this by declaring two instances of the FloatToString object or an array of instances (OBJ FS[noparse][[/noparse] 2] : .....). Each will have its own set of variables, but there'll be only one copy of the code. You'd do "FS[noparse][[/noparse] 0].FloatToString(VoltFloat[noparse][[/noparse] 0])" and "FS[noparse][[/noparse] 1].FloatToString(VoltFloat[noparse][[/noparse] 2])".
Another possible choice would be to copy the string to your own temporary string area, then do the second conversion.
Appreciate it!
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
-Martin
-Martin
·
Depending on the order of the following code for showing the values, it makes a big difference in which values get jumpy and don't use the precision set. I'd tried a few things between each to see if I could calm it down, but nothing works, just changing the order makes a difference, and it really doesn't seem to follow a pattern.
Thoughts?· I'm not good enough to dig into Chip's FloatString object to try to debug it if that is the issue.
·-Martin