Dear reader,
I gave the chip these tasks to calculate
All variables are WORD
Code:
IF ((Second_Value - First_Value) < 0) THEN
Difference_Between_F_And_S_Value = Second_Value - First_Value
Difference_Between_S_And_T_Value = Third_Value - Second_Value
ELSE
Difference_Between_F_And_S_Value = First_Value - Second_Value
Difference_Between_S_And_T_Value = Second_Value - Third_Value
ENDIF
Difference_Between_Two_Points_As_Reference = Point_Two - Point_One
Steps_Between_F_And_S_Value = (752 * Difference_Between_F_And_S_Value) / Difference_Between_Two_Points_As_Reference
Steps_Between_S_And_T_Value = (752 * Difference_Between_S_And_T_Value) / Difference_Between_Two_Points_As_Reference
These are the values being used
Code:
First_Value 1423
Second_Value 951
Third_Value 931
Point_One 493
Point_Two 1702
Result:
Steps_Between_F_And_S_Value 22
Steps_Between_S_And_T_Value 12
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 ?
Bookmarks