Manwolf
Worked With Your Pbp And Your Right It Is Displaying The Correct C Temperature
Its Pb Math Thats Incorect
Any Ideas How ?
Also The Formula Temp = ((temp*1.8)+32) Gives Corect Answer But Wont Compile
On Pbp
Manwolf
Worked With Your Pbp And Your Right It Is Displaying The Correct C Temperature
Its Pb Math Thats Incorect
Any Ideas How ?
Also The Formula Temp = ((temp*1.8)+32) Gives Corect Answer But Wont Compile
On Pbp
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
Last edited by manwolf; - 24th July 2008 at 04:26. Reason: Forgot to answer the question
Hi, Manwolf
What do you mean by that :
" Acetronics: May I play around with the thermostat program you posted? "
Of course YOU can play with it ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Your bit-banged read & write routines use a @ NOP for a 1uS delay, but you're running
at 20MHz so these are only 200nS. You would need 5 x @ NOP for a 1uS delay.
Thanks For The Math Help
As For As Speed Goes I Have Treid 4 And 20 Does Not Make A Difference
Will Work On The Math Issue
Do You Have The Thermostat Program In Pbp Not Hex
Thanks
Hi, Jcleaver
The thermostat program was for you to verify what you had to find ... and show you a different Bargraph view.
NOT to copy / paste it ...
You can find any parts of it on this forum, The DS18x20 subject has been widely explored during the past months.
but that need some little efforts ... is it the problem ?
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks