
Originally Posted by
jmelson
First, Axis has nothing to do with this, it is only the on-screen GUI. You are probably using the stepgen component of EMC, which is not a servo system. You need to use a step generator that can work in the servo mode of operation. Second, you need a method to read the encoder inputs into the computer. While you can do this with an extra parallel port and the HAL encoder component, there is an upper limit to the rate at which the software can read the encoder without losing counts. You can calculate the upper limit from the BASE_THREAD rate. You never want the encoder to be sending counts in at a rate faster than every couple BASE_THREAD ticks.
So, if the BASE_THREAD is 50000, or 50 microseconds, that is 20 KHz. So, you don't want more than 10000 encoder counts per second. If the encoder has a resolution of .0004" (metric scale of ,01mm) or 2540 counts/inch, and you are moving at 60 IPM or one inch per second, then that is only 2540 counts/second, so that should work.
But, it eats up most of a whole parallel port doing this. So, you might look at some of the hardware "accelerators" available for EMC.
Anyway, I know how to do this using my Universal PWM Controller, I'm not sure of the exact details of doing this using all EMC-Hal components, but you definitely need to add in the PID component, which is the central part of closing a servo loop. You can look at the univstep configs files that are on your EMC system to see how all this is hooked up.
ppmc.0.encoder.00.position is the scaled position out of the encoder counter. ppmc.0.stepgen.00.velocity is the step rate output to the hardware step generator.
Jon