Sorry if I'm hijacking here but wanted thank you Henrik for the cool tip!
I've been experimenting with a 2000dps gyroscope that outputs a max of 32757 counts.
Then with the resolution at 0.07dps, I had to use LONG's to make (32757*0.07=2292.99dps) work.
I didn't know if it would work without LONGs but it did, and trimmed 1356 Words in my program!Code:INTxg VAR WORD Xg VAR LONG INTxg = (Xg*7)/100 ' Xg max value =32757 *** changed to *** INTxg VAR WORD Xg VAR WORD INTxg = Xg*/18 ' 0.07*256=17.92 for (32757*18)/256=2303, rounding up only 0.43% error at max




Bookmarks