Well, probably something like this
Code:wDummy=wTemp * (wWeight2-wWeight1) IF wDummy > 65536 THEN wDummy=wTemp * (wWeight2-wWeight1) 'This line needs to be before DIV32 wTemp= DIV32 100 ENDIF
Well, probably something like this
Code:wDummy=wTemp * (wWeight2-wWeight1) IF wDummy > 65536 THEN wDummy=wTemp * (wWeight2-wWeight1) 'This line needs to be before DIV32 wTemp= DIV32 100 ENDIF
"No one is completely worthless. They can always serve as a bad example."
Anonymous
@ first ...
could you explain how DIV32 results can be > 16 bits ...
Never seen that for 14 Years I use PBP !
Ok, ...
1) The "Dummy" variable must be < 32768 ... see Manual !
2) IF you use DIV32 ... your program variables only can be < 16 Bits ( 65535 ), obvious, eh ! ( DIV32 doesn't work when LONGS used !!!)
=> soooo, how are you dealing with your supposed 16 -> 32 bits intermediate "results" ???
BTW :
" another " compiler would have sent you the messageCode:IF wDummy > 65536 THEN
AlainCondition always TRUE
************************************************** ***********************
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 " !!!
*****************************************
DIV32 results are never over 16bits. What I meant is that my calculation in the following sentence
wDummy=wTemp * (wWeight2-wWeight1)
Can result in result of upto 16 bits, which is fine as wDummy can handle it. But in cases when it gets over 16bits for example if wTemp is 100 and result of the subtraction is 100 as well, DIV32 gets me what I want. i.e. 10,000 in this example.
BUT the problem is that I am not sure if DIV32 is still doing something to my answer when the result is up to 16 bits as I would not like DIV32 to execute in this case. Hope I made myself more clear this time.
Bookmarks