Integer overflow. 1423 - 951 = 472 951 - 931 = 20 1702 - 493 = 1209 752 * 472 = 354944, This is > 65535, so it is truncated to 27264 27264 / 1209 = 22 752 * 20 = 15040 15040 / 1209 = 12 Also, > IF ((Second_Value - First_Value) < 0) THEN should be > IF (Second_Value > First_Value) THEN According to my hand calculator and the PC's calculator >Steps_Between_F_And_S_Value and Steps_Between_S_And_T_Value contain >wrong results. What could be the reason for that ? > >Regards > >Thilo Klein -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist