On startup. I have to do few calibration steps.
In the default code as soon as gMotorVars.Flag_Run_Identify is made 1 , the controller goes through various steps one of them being the Rs Recalculation step where the force alignment of encoder happens and then Encoder ZeroOffset is calculated.
Since, I am using Index pulse, here is something different that I need to do. I tested it by hand and it works great.
After gMotorVars.Flag_enableSys is made 1, the QEP module is active , so I spun the motor once by hand, this made sure the QEP module found the index pulse and reset the count to zero at index and then after that the encoder count is always an absolute value relative to the stator.
After that, I set the gMotorVars.Flag_Run_Identify to 1, this runs the Rs Recalculation step where the force alignment of encoder happens and then Encoder ZeroOffset is calculated.
then I use Lab 13b, which works as usual except that now I can command it to go to positions that are absolute relative to stator and not just relative to a random position where the rotor was on powerup. gMotorVars.PosStepFrac_MRev is being calculated based on desired encoder count and current encoder rather than entering values directly into gMotorVars.PosStepFrac_MRev. It works pretty good because I have aligned the index on the encoder to a certain point on the stator. so, every rotor position corresponds to a distinct encoder count.
My goal is now to automate the process so I don't have to rotate it by hand.
So, What the best way to make the motor on powerup
1) Rotate at least 1 rev at pretty low speed without using the encoder
2) The motor stops and does a Rs Recalculation step where the force alignment of encoder happens and then Encoder ZeroOffset is calculated.
thanks
subrat
gMotorVars.PosStepFrac_MRev