setCurrentLimit triggers Position changed handler, not curr

C, C++, and Visual C++
Post Reply
CatherineHolloway
Phidgetly
Posts: 20
Joined: Mon Mar 04, 2013 9:53 am
Contact:

setCurrentLimit triggers Position changed handler, not curr

Post by CatherineHolloway »

I think there's a problem in the phidgets libraries. When I set the current limit with setCurrentLimit(), the position changed event is triggered, not the current changed event.
CatherineHolloway
Phidgetly
Posts: 20
Joined: Mon Mar 04, 2013 9:53 am
Contact:

Re: setCurrentLimit triggers Position changed handler, not c

Post by CatherineHolloway »

also, it seems that setCurrentLimit has no effect on the value returned by getCurrent()
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: setCurrentLimit triggers Position changed handler, not c

Post by mparadis »

From the C/C++ API:
int CPhidgetStepper_setCurrentLimit (CPhidgetStepperHandle phid, int index, double limit)
Sets the current limit for a motor.

int CPhidgetStepper_getCurrent (CPhidgetStepperHandle phid, int index, double *current)
Gets the current current draw for a motor.
The CurrentLimit sets when the stepper controller's chopper drive cuts out, effectively limiting the current. getCurrent returns the current being drawn by the motor at the time the function is called.

If you want to know what CurrentLimit has been set to, you should use CPhidgetStepper_getCurrentLimit. As for your first question, I'm not sure why you're expecting the current change event to fire when you change the current limit- it's just a maximum, not the actual value. The position change handler shouldn't trigger as a result of changing the current limit either, but might it have triggered because the position changed at that time?
CatherineHolloway
Phidgetly
Posts: 20
Joined: Mon Mar 04, 2013 9:53 am
Contact:

Re: setCurrentLimit triggers Position changed handler, not c

Post by CatherineHolloway »

Yes, you're right, I was interpreting the codebase incorrectly

I'm still not sure why the position handler activated, when the current limit is set, but it's not a biggie and I've found a workaround for the current handler not activating.
bluwavguy
Phidgetsian
Posts: 5
Joined: Thu Feb 09, 2017 1:10 pm
Contact:

Re: setCurrentLimit triggers Position changed handler, not c

Post by bluwavguy »

On this topic, using the 1067 controller and the 3327 Bipolar stepper with rated current at 1.7A, do I need to call the getCurrent 1st, then call setCurrentLimit to set the limit?

Under load tests I know the stepper runs fine a 1.5A using the simple GUI program app that came with the controller....

I plan to modify the Stepper-simple program to build my app and I did not see a call within this program to set the limit. Therefore in reviewing the header file found the api.

I'll need to add the functionality but want to make sure I'm doing this correctly...

Since I am new to most all of this my application is to drive the motor one direction for a set period of time, delay, then drive the motor the opposite direction for a set period of time, delay, then repeat over a 12 hour period.

Therefore, once I set the current limit that's all I care about unless I'm missing something...

thanks in advance, Brian
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: setCurrentLimit triggers Position changed handler, not c

Post by mparadis »

No, you don't need to call getCurrent if you already know what you want the current limit to be. Play around with the current limit, velocity limit, and acceleration in testing to determine which numbers work well for you, and then set those properties when your program begins.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests