Log in

View Full Version : Maths again...



Ioannis
- 21st September 2010, 21:32
Hi.

Can the DIV32 be used with constants? I have to make the division myvar=217770/adval and was thinking in using this:

con1 con 21777
con2 con 10
dummy var word

dummy=con1*con2
myvar=div32 adval

Is this OK?

Ioannis

Darrel Taylor
- 21st September 2010, 22:11
DIV32 can use a constant.
But in your multiplication prior to the DIV32, one of the values have to be a WORD.
Otherwise the constants are multiplied at compile time and the PBP system registers aren't loaded with the proper values at Run-Time.

You can also use the PutMulResult macro I posted back in 2003.
http://www.picbasic.co.uk/forum/showthread.php?t=24&p=50#post50

Ioannis
- 21st September 2010, 22:51
Ooops. What a stupid idea to mult. 2 constants!

Thanks Darrel.

Ioannis