PDA

View Full Version : newToMicroPAnd Loving it but filled with problems



micropgirl
- 11th April 2005, 07:03
I would like to know how to carry out the modulus operations on the pic, i would like to devide a number by 4 and use the remainer look up the value in a look up table and return the result at the value.

lookupQuad addwf PCL, F
retlw 1st
retlw 2nd
retlw 3rd
retlw 4th

but note the the remainders are going to be fractions, between 0 and 1, so i want if the number i.e. the remainder of the calculation is between 0-0.25 inclusive, i want the lookupQuad to return 1st, if the remainder is between 0.25-0.50 inclusive i want the return value to be 2nd,if the remainder is between 0.50-0.75 inclusive i want the return value to be 3rd and if the remainder is between 0.75-1.00 inclusive i want the return value to be 4th.


Can you help, or suggest any other way of acheiving this.

NavMicroSystems
- 11th April 2005, 09:57
micropgirl,


MyNumber VAR WORD
Remainder VAR BYTE
Remainder = MyNumber//4


See PBP Manual Section 4.17