Thanks Richard,

it's the format of the ABS that has been confusing me. According to what I read in the manual, the ABS function for a word variable returns 65536 - value. So if I had a negative number and did the ABS() of that, it could return a number that is larger than the number I was taking the ABS value of. If my number was -40 for example. That would be 1111111111011000 in binary. (-40) If I do the ABS value function I think it returns 0000000000101000 which is 40! Wow, I was subtracting from 65535 not 65536. The light just went on! Thanks again Richard, sorry to ask such a dumb question!