math help needed
hi ,
i have a math problem and need some help to solve it
i have two numbers :
a=90000000 and b=75000000
both of the numbers are divided in high· and low like
a= 9000 high and 0000 low. the same for b.
i have also a limit level like c=1567
b it will increment if an event happen
i would like to monitor b in a such way that when a-b=c to get an output or alarm or a conditional branch to do something.
thanks
ion
·
i have a math problem and need some help to solve it
i have two numbers :
a=90000000 and b=75000000
both of the numbers are divided in high· and low like
a= 9000 high and 0000 low. the same for b.
i have also a limit level like c=1567
b it will increment if an event happen
i would like to monitor b in a such way that when a-b=c to get an output or alarm or a conditional branch to do something.
thanks
ion
·

Comments
Thanks to Tracy Allen, here is a tutorial on how to do double precision (32 bit) math with the Basic Stamp:
http://www.emesystems.com/BS2math6.htm
Regards,
Bruce Bates
a0 VAR Word a1 VAR Word b0 VAR Word b1 VAR Word c1 VAR Word c0 VAR Word a1 = 9000 : a0 = 0000 b1 = 7500 : b0 = 0000 DO b0=b0+1 IF b0 >= 10000 THEN b0 = b0-10000 : b1= b1+1 ' carry c0 = a0 - b0 IF c0.bit15 THEN c0 = c0 + 10000 : c1 = c1-1 ' borrow IF c0 = 1567 AND c1=0 THEN DEBUG "wowzer!" LOOPIf you let that loop run, it should print "wowzer" on your screen after a wait of about 12 hours!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Iwill go to that site and do my home work. You save me a lot of headeche
Thank again
ion
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
The symbols b0 and b1 would point to the same space in the RAM as a0.byte0 and a1.byte1.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com