|
|
View previous topic :: View next topic |
Author |
Message |
Dax12R
Joined: 19 Dec 2010 Posts: 4 Location: Surrey
|
Driving a PIC18F4431 servo controller with Step/Dir signals |
Posted: Sun Dec 19, 2010 1:54 pm |
|
|
I am using the Pic18F4431 with a similar setup to Microchip's 00696a.pdf
application note.
Is there a simple way to accumulate step/dir pulses to drive a such servo system? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Sun Dec 19, 2010 2:48 pm |
|
|
You need to think about several factors here.
How fast are the pulses going to come (worst case)?.
What relationship are you going to se between 'steps', and encoder counts?. - Remember that a servo, will usually be able to move much faster than a stepper will manage.
What is the nature of the stepper pulses?. Can you adjust the cceleration and speed?.
How will the stepper system 'know' that the servo has reached the specified point?.
At heart, yes this can be done. If you are not using the CCP's for your servo, then use these, gating one as an 'up' counter, and the other as 'down'. If you are already using the the CCP's, then consider adding an external counter (simple CMOS up/down counter), Then you can just read the current CCP values (and subtract the 'down' count from the 'up'), or just read the value from the external counter using a port. Then use the value read as your next target for the servo.
Your problems will be choosing acceleration rates, and factors for the PID, that don't result in hunting. By far the 'easiest' way, is to have the stepper control not using any acceleration/decelleration, and have the servo signal back when it has completed.
Best Wishes |
|
|
Dax12R
Joined: 19 Dec 2010 Posts: 4 Location: Surrey
|
|
Posted: Sun Dec 19, 2010 3:14 pm |
|
|
I am using the QEI module for the encoder.
So as far as I know the CCPs are free.
I believe I will be able to record the step pulses at the rate I need.
I am currently using a DOS program call TurboCnc on a CNC mill/drill conversion
The step pulses for the TurboCNC have a Backlash, Acceleration and Deacceleration phases in the step rate.
All tha Axis keep pace with each other for linear X,Y moves.
The troulble with my aging brain, is the more I think about the problem the more complex it seems.
Thanks Martin |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Mon Dec 20, 2010 9:55 am |
|
|
Key thing to understand, is that using step/direction, to control a servo, probably throws away most of the servo advantages....
Making it 'emulate' a stepper, means starting by making the decision already mentioned about the relationship between 'steps', and encoder counts. Then looking at the maximum speed of the system, and setting the maximum step rate to match the speed the motor can do at this point (with the 'factor' applied if necessary between steps and counts). Then reducing massively the 'D' term in the servo's PID, and increasing the 'P' term, and then adjusting the accelerations used in the stepper controller to be close to those that the servo (under load) can manage.
Basically, when the steps arrive, the servo starts 'chasing' the value from the step/direction input, but because the D term is turned down, accepts that it'll probably overshoot a bit. However because the pulse train is initially accelerating this doesn't happen too badly, and with careful adjustment, it can be made to work.
However. In most cases, software of this type, _can_ be fed extra inputs (I don't know about Turbo CNC). On the systems I have used, you can set a step rate up to a very high level, turn acceleration and deceleration _off_, and tell it to not assume the move has completed till it sees an acknowledgment on another input. Then you simply send it at high speed a pulse train corresponding to 'how far to move' (steps), and direction, and the servo can behave normally just responding with a 'move complete' once it reaches the target. This is _far_ easier to do.
I know DAK, do their own servo control board that integrates with TurboCNC, so you might see if someone has posted details of how this is interfaced to the software.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|