Hi,
Normally PBP doesn't handle signed values very well, 1-2=255 so that's probably where the problem is comming from. If you're only displaying values then you can use the SDEC modifier in LCDOUT etc statements, it will give you -1 for the above example. This is only for display purposes though, the actual math operations are still treated as unsigned.
What to do. Well, you could switch to LONG variables - these are signed. Or you can apply an offset to all your values so that instead of the value 0 meaning 0 degrees you say that 10000 means 0 degrees. 10001 is 0.1 degrees and 9999 is -0.1 degrees - for example.
I haven't looked very cloesly at your actual code in order to say which would be best.
/Henrik.




Bookmarks