12-16-2009 07:57 PM
Hi,
I like to add 20hex string together & divide by 20 but somehow i can't get the correct result.
Attach with my vi here.
thanks and regards,
Simon
Solved! Go to Solution.
12-16-2009 08:19 PM
Could you add your input string to the VI, make current values default, save and attach it once more? Also tell us what result you expect.
(Your code seems overly complicated. Can't you just cast the string to an array of U16, convert to e.g. U32 to avoid overflow, take the sum, and divide by 20?)
12-16-2009 08:54 PM
Hi,
Attach with vi again.
I expect to get back FFFF(maximum so U16 is sufficient) for the average of 20 points reading.
Thanks alot.
Simon
12-16-2009 09:24 PM
Try the attached VI, I changed the offset you were using in the search/split string to 2 because you are displaying the input string as hex, so when labview operates on the string it operates on the ASCII representation of the string (which is one character) even though your display is in hex (two characters per one ascii character) so you only need to split at an offset of 2 instead of 4. For example, ÿÿ = FFFF.
-RW
12-16-2009 10:57 PM - edited 12-16-2009 11:01 PM
Isn't this easier and pretty much along the lines of Altenbach's suggestion?
PS: The latest version of code capture tool works great.
12-16-2009 11:58 PM
Hi,
How you get the final result?? i getting -1 here...
regards,
Simon
12-17-2009 12:04 AM
12-17-2009 12:21 AM
Now i get it. This approach much simple.
Thanks once again.
regards,
Simon
12-17-2009 02:18 AM - edited 12-17-2009 02:18 AM
Here's my idea mentioned above (eliminates coercions and orange wires).
01-13-2010 01:55 AM
Hi,
If i like to have moving averaging let say for N=10 datapoint, how can i do it??
e.g. t0,t1,t2.....t9,t10,t11,...t(n-1) : t0~t9, t1~t10,.... & plot into the graph.
My incoming data is read from UART with the data format as pic attachment.
thanks & regards,
Simon