Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I dont know about Pic basic pro, but most simple basic languages dont allow negative values, only positive integers, so somewhere set your "0" to say 127 (half of 255, by adding 127 to the original value) and then use your code the way it is but with "if B0 < 127", so 127 becomes the "default" zero thoughout your program.
Thanks but this way is very bulk of code and process!
Is any way in assembly language?
hi,
How have you defined B0, as byte/word ....?
The Basic only uses unsigned BYTE/WORD Integers, but signed DWORD
B0 var word
I use Word!
Code:B0 var word
I use Word!
Code:B0 var word
As a simple test DIM B0 as DWORD.
Perhaps there is an easier way to solve the problem... whats the 'source' of the B0 variable, how is it derived.?
B0 is a output value of DS1820 (1-Wire thermometer )
I use PICBasic Pro v2.45 and your sample code is for Visal Basic!
B0 is a output value of DS1820 (1-Wire thermometer )
As I understand the DS1820, its a WORD output format.?
Have you considered using the Th and TL in the users Alarm registers, bit7 the Sign(S) bit defines neg/pos values.
Also if you are trying to measure down to -55Cdeg, why not just add 55 to the read value and do an unsigned test for negative temperatures.?
if b0 >65000 then ; is negative value!?
If b0 < 65531 then ; Is b0 < -3
lcdout $c0,1,"-"
end if
endif
No, you still cant do "is b0 < -3" if the b0 variable is a word ;-).
you say i use Dword?! PICBASIC haven`t this variable men!
I have downloaded the manual from this site.!
PICBASIC Programming — Evolved | Proton Development Suite
Thats where I got the DWORD from..
You've never explained (and still haven't) exactly what compiler you're using - but it seems pretty likely that it doesn't do negative numbers.