I’m totally stumped here.
A little background info: I am using a SNAP-SCM-ST2 module to control a stepper motor. My goal is to be able to control the position of the motor. Since I know the position I want (# of pulses) and speed that I want (freq, delta freq, time slice), I have calculated the time that the motor needs to run in order to reach the desired position and set a downtimer to that time. I have 3 time variables, timea which is the time for the motor to accelerate to its max frequency, timec, the amount of time it runs at the max frequency, and timet, which is simply timea + timec.
Here’s the issue. When the motor is spinning counter-clockwise, timea and timec add together correctly. However, when the motor is spinning clockwise, the result of timea + timec gets rounded to 1 decimal place (see attached images). The inconvenient result of this is that the motor position ends up being just a little bit off of where it should be. What I can’t grasp is how the direction of rotation of the motor has any bearing on the result. Both the equation (timea + timec = timet) and the values of timea and timec are exactly the same either way. Any thoughts?