Whats with (no) negative numbers in the BS1?
Amnoid
Posts: 11
I did some basic math to compare two analog inputs on a BS1. The manual sais that I can see negative nubers (i.e. 10- 20= -10). But instead I get something near 65533 (similar to when an 8bit variable reaches the end of its number stack·and starts back at 0).... I am using word variables (W0 - W1), but still don't see any NEGATIVE numbers. I was able to work around this, but I would still like to use simple math. Any hints?
Thanks
Thanks
Comments
- Subtraction
The Subtraction operator (-) subtracts variables and/or constants, returning a 16-bit result. Works exactly as you would expect with unsigned integers from 0 to 65535. >>>>> If the result is negative, it will be correctly expressed as a signed 16-bit number. <<<<<
So where is the mistake? Is there a way to change a number to signed?
compare VAR Word
value1 VAR Word
Value2 VAR Word
compare = ABS (value1 - value2)
Though im not sure if this helps you or not sorry
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Thanks