Jack
As Acetronics stated:
Remember PBP works with UNSIGNED INTEGERS ...
So 9/5 = 1.8 still won't fly in PBP
How about something like this?
temp = (((temp >> 1) * 100) - 25) 'calculate degrees C
temp = (temp */ 461) + 3200 'convert degrees C to F
And before you ask, crack open the ugly green book and figure out what '*/' does.
Hint: it uses all unsigned integers.
The hardest part of writing any program is learning how to handle the math. If you can not get your head around the math none of this stuff makes any sense.
Don't be afraid to throw some output in there to see what is happening. Run Debug, output to LCD or a serial port to see what it is changing.
For a better explaination of the math go here - http://www.rentron.com/PicBasic/one-wire3.htm
Ted
Bookmarks