Last edited by Acetronics2; - 24th January 2011 at 17:44.
************************************************** ***********************
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 " !!!
*****************************************
calm down Alain
jeroeni seems you're using another variant of PICBasic compiler, to me it looks like Proton Picbasic whose forum is located at the following link
http://www.protonbasic.co.uk/forum.php?
HTH
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi, Steve
Sorry ... I couldn't recognise this one ... which is running fine.
Code:' One-wire temperature for PROTON Board and DS1820 Include "PROTON_4.INC" Dim Temperature As Word ' Temperature storage Dim Count_remain As Byte ' Count remaining Dim Count_per_c As Byte ' Count per degree C Dim Dum As Byte ' Dummy variable to pad OWIN Symbol DQ = PORTC.0 ' One-wire data pin DelayMS 500 ' Wait for PICmicro to stabilise Cls Mainloop: OWrite DQ, 1, [$CC, $44] ' Start temperature conversion While ORead DQ, 4 = 0 : Wend ' Check for still busy converting OWrite DQ, 1, [$CC, $BE] ' Read the Temperature ORead DQ, 0, [Temperature.LowByte, Temperature.HighByte, Dum,Dum,Dum,Dum, Count_remain, Count_per_c] ' Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature) Temperature = (((Temperature >> 1) * 100) - 25) + (((Count_per_c - Count_remain) * 100) / Count_per_c) Print $FE, 1, Dec (Temperature / 100), ".", Dec2 Temperature, " C" ' Calculate temperature in degrees F to 2 decimal places (not valid for negative temperature) Temperature = (Temperature */ 461) + 3200 Print $FE, $C0, Dec (Temperature / 100), ".", Dec2 Temperature, " F" DelayMS 1000 ' Display once a second GoTo Mainloop ' Do it forevermackrackit
Are you using Pic Basic (PRO) ?Ok, Ok ...jeroeniYeah, I'm using the pro version
![]()
************************************************** ***********************
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 " !!!
*****************************************
. . . . . . . . . .
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Sorry, i guess i misunderstoot... PicBasic = program language and proton ide is the compiler, or is my mind freaking out with me now ? :P
Hi,
No, your mind is not freaking out but this is not the forum for Proton.
It's often confusing as there are several BASIC-compilers for PIC available from different vendors, many of them with the phrasing or names like PICBasic.
It doesn't get easier by the fact the THIS forum (which is for the PICBASIC compiler from MELABS) are hosted by Crownhill which are the developers of the Proton compiler.....
For Proton specific questions you might have better luck at the Proton forum.
With that said, and without knowing Proton the DEC modifier (at least in PBP) is used to convert the value contained in a variable to ASCII text in order to print to a display or serial terminal etc. If you do something like Temp = 100 the variable called Temp will contain the value 100. Now you can do stuff likeBut if you want to display the value of Temp on a display or terminal simply saying LCDOUT Temp (PRINT Temp in your case) will display the letter 'd' because 100 is the ASCII code for 'd'Code:If Temp > 125 then Goto CoolDown If Temp < 75 then Goto HeatUp
In order to display 100 the compiler needs to convert the value 100 into the text '1' '0' '0' and THAT is what the DEC modifier does.
/Henrik.
Bookmarks