I will try to find and run the patch to find out if that’s the culprit.
Thanks ski
I will try to find and run the patch to find out if that’s the culprit.
Thanks ski
Patch in place..... No, that did not cancel the compile error!
Here’s the code:
Thanks!Code:READTEMP: OWOUT PORTA.5,1,[$CC, $44] ' SEND Start Temperature Conversion command OWOUT PORTA.5,1,[$CC, $BE] ' SEND Read Temperature command OWIN PORTA.5,0,[STR dq\9] ' Retrieve all 9 bytes of data RawTemp.Byte0 = dq[0] RawTemp.byte1 = dq[1] IF RawTemp.8 = 1 then ' Check IF temperature is a negative reading SignC = Negative RawTemp.lowbyte = RawTemp.lowbyte ^ 255 ' Invert data ELSE SignC = Positive ENDIF dummy = RawTemp.0 ' Store the half degree indicator bit TempC = ((RawTemp.lowbyte) >> 1) * 100 ' Divide raw data by 2 to give real temperature TempC = TempC + (dummy * 50) ' Add the half degree is present IF SignC = Negative then ' Only proceed IF temperature is negative IF TempC => 1770 then SignF = Negative TempF = (TempC + 5000) * 900 TempF = div32 500 TempF = TempF - 12200 RETURN ELSE SignF = Positive TempF = (TempC + 5000) * 900 TempF = div32 500 TempF = 12200 - TempF RETURN ENDIF ENDIF SignF = Positive TempF = TempC * 18 / 10 + 3200 RETURN
Hi,
Is not that much simpler than yout modifyer and the two following lines :
Code:OWIN PORTA.5,0,[STR dq\9] ' Retrieve all 9 bytes of data RawTemp.Byte0 = dq[0] RawTemp.byte1 = dq[1]
( taken from a Malc C example )
AlainCode:OWIN Porta.5, 2, [R_Temp.Lowbyte, R_Temp.Highbyte] ' Read two bytes / end comms
************************************************** ***********************
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 " !!!
*****************************************
Hi Alain,
Your suggestion tested, does not compile due to multiple errors in the line.
Made a search in the forum but could not find anything regarding the STR macro problem.
Thanks.
I can't believe it ...does not compile due to multiple errors in the line.
Made a search in the forum but could not find anything regarding the STR macro problem.
I can't ...
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 " !!!
*****************************************
Looks like you have dq defined as a WORD VS BYTE.
We need to see how the variables are declared as well as other settings. Its obviously not this part of the code that is the culprit because it compiles fine for others which means there is a problem somewhere else in the code. Like Bruce said, it could be something simple like a word variable being declared as a byte.
Hi Guys!
Been busy doing other stuff but now I’m back to finish this project! As some of you suspected it was a “simple” mistake, a word variable was declared as a byte! Now it runs like clockwork!
It seems the problem is always simple, finding the problem is the hard part!
Thank you all!
Bookmarks