Log in

View Full Version : Found something strange (BUG???)



GrandPa
- 14th November 2007, 19:28
Hi,

I'm having strange result using DIV32 after constants multiplication, but changing both to variables give correct result.

Here is the example code:



C1 con 80
C2 con 200
V1 var word
V2 var word
X1 var word
X2 var word

v1 = 80
v2 = 200

X1 = c1 * c2
X1 = div32 100

X2 = v1 * v2
X2 = div32 100

lcdout $FE, $80, #X1
lcdout $FE, $C0, #X2



Result for X1 is 65535, which is incorrect of course.
Result for X2 is 160, which is correct.

Any idea why?

J-P

mat janssen
- 14th November 2007, 19:50
maybe you forgot to tell that C1 and C2 are "word"'s and no "Byte"'s

Acetronics2
- 14th November 2007, 19:50
Salut le Canada !!!

the answer is here :

http://www.picbasic.co.uk/forum/showthread.php?t=6931&highlight=DIV32

Alain