07-06-2015 04:07 AM
Hi everyone!
We run a direct drive in position control mode and normally do oscillating movements i.e. +-10°. The Signal we get is a TTL with 120 counts/°. And with those counts we do our control.
But now we want to run the motor permanent one direction for some days (or 4 ever :-). That means that we get sooner or later a overflow on the count variable. So I think we have a problem when the setpoint is on Overflow -32767 and the Position is 32767. ( I know that I can increase the Integer Value but that does not solve it at the end 🙂
How can I handle that?
Is there any programmatic approach?
Thanks for Help!
07-06-2015 04:41 AM
07-06-2015 07:29 AM
Hi GerdW,
Usually yes, but we ar not normal. We do the position control within the FPGA and the drive is in "Torquecontrol" and we don't want to change that!
Thanks Petric
07-06-2015 07:35 AM
Hi Petric,
once you can detect such an numeric overflow you can handle it in software…
First step: detect the overflow. (Using the sign bit might be an option.)
Second step: adapt your counting math to those overflow detection condition! (IF overflow THEN add offset to count difference)
07-06-2015 08:10 AM
Hi Gerd,
Ok, when I got it right, then I should to something like that:
IF overflow
THEN:
Setpoint == Setpoint - (setpoint_Size - x);
Actual Counts == Actual Counts - (Actual Counts_Size - x);
nr_of_overflow == nr_of_overflow + 1;
END
_Size represents the Size of the Variable
I dont know if I have to use x to avount to many calculations when it toggels arrount the overflow!?
With nr_of_overflow, I still can calculate the absolute turns, right?
Kind Regards
Patric
07-06-2015 08:12 AM
07-06-2015 08:22 AM
If all you really care about is how many spots you moved since the last check, you just need to subtract. The overflow sort of just goes away when you do that.
07-07-2015 01:17 AM
Hi crossrulz,
I do not understand what you mean. That's probably because of my little english understanding... Can you please describe it in more details?
Thanks
Petric
07-07-2015 01:38 AM
07-07-2015 02:26 AM
Thanks for the patience with me!
I do see the math but that does not help when I have more then one overflow, right?
The second thing is thil that I got a big issue when the setpoint is jumping due to overflow! I have to handle that primarly.