EMC2 is capable of controlling a wide range of machinery using many different hardware interfaces. Stepconf is a program which generates EMC configuration files for a specific class of CNC machine: those connected to the PC using a standard parallel port and controlled with step & direction signals. Stepconf is installed when you install EMC2 and is in the CNC menu.
Stepconf places a file in the emc2/config directory to store the choices for each configuration you create. When you change something you need to pick the file that matches your configuration name. The file extension is .stepconf.
Additional signal conditioning or isolation such as optocouplers and RC filters on break out boards can impose timing constraints of their own, in addition to those of the driver. You may find it necessary to add some time to the drive requirements to allow for this.
For each pin, choose the signal which matches your parallel port pin out. Turn on the “invert” check box if the signal is inverted (0V for true/active, 5V for false/inactive).
Include custom PyVCP Panel If selected, the PyVCP control panel panel.xml will be displayed on the right-hand side of the main AXIS window. This will not create a PyVCP panel but will create the blank file in the config folder. To create a PyVCP panel see the PyVCP section of the Integrators Manual.
Charge Pump If your driver board requires a charge pump signal simply select Charge Pump from the drop down list for the output pin you wish to connect to your charge pump input. The charge pump output is connected to the base thread by Stepconf. The charge pump output will be about 1/2 of the maximum step rate shown on the Basic Machine Configuration page.
These options only appear when “Spindle PWM”, “Spindle A” or “Spindle PPR” are chosen in the Parallel port pinout.
If “Spindle PWM” appears on the pinout, the following information should be entered:
When the appropriate signals from a spindle encoder are connected to the parallel port, EMC supports lathe threading. These signals are:
If “Spindle A” and “Spindle PPR” appear on the pinout, the following information should be entered:
Click “Apply” to write the configuration files. Later, you can re-run this program and tweak the settings you entered before.
With Stepconf it is easy to try different values for acceleration and velocity. First, enter the correct figures for Steps per Revolution, Microstepping, Pulley, and Leadscrew. Then enter a provisional value for Velocity. Next, click Test this axis.
Begin with a low Acceleration (e.g., 2 in/s^2 or 50mm/s^2) and the velocity you hope to attain. Using the buttons provided, jog the axis to near the center of travel. Take care because with a low acceleration value, it can take a surprising distance for the axis to decelerate to a stop.
After gauging the amount of travel available, enter a safe distance in Test Area, keeping in mind that after a stall the motor may next start to move in an unexpected direction. Then click Run. The machine will begin to move back and forth along this axis. In this test, it is important that the combination of Acceleration and Test Area allow the machine to reach the selected Velocity and “cruise” for at least a short distance--the more distance, the better this test is. The formula d=.5*v*v/a gives the minimum distance required reach the specified velocity with the given acceleration. If it is convenient and safe to do so, push the table against the direction of motion to simulate cutting forces. If the machine stalls, reduce the speed and start the test again.
If the machine did not obviously stall, click the “Run” button off. The axis now returns to the position where it started. If the position is incorrect, then the axis stalled or lost steps during the test. Reduce Velocity and start the test again.
If the machine doesn't move, stalls, or loses steps no matter how low you turn Velocity, verify the following:
Once you have found a speed at which the axis does not stall or lose steps during this testing procedure, reduce it by 10% and use that as the axis Maximum Velocity.
With the Maximum Velocity you found in the previous step, enter the acceleration value to test. procedure as above, adjusting the Acceleration value up or down as necessary. In this test, it is important that the combination of Acceleration and Test Area allow the machine to reach the selected Velocity. Once you have found a value at which the axis does not stall or lose steps during this testing procedure, reduce it by 10% and use that as the axis Maximum Acceleration.
Enter the following values in the Spindle Configuration page:
|Speed 1:||0||PWM 1:||0|
|Speed 2:||1000||PWM 1:||1|
Finish the remaining steps of the configuration process, then launch EMC with your configuration. Turn the machine on and select the MDI tab. Start the spindle turning by entering: M3 S100. Change the spindle speed by entering a different S-number: S800. Valid numbers range from 1 to 1000.
For two different S-numbers, measure the actual spindle speed in RPM. Record the S-numbers and actual spindle speeds. Run Stepconf again. For “Speed” enter the measured speed, and for “PWM” enter the S-number divided by 1000.
Because most spindle drivers are somewhat nonlinear in their response curves, it is best to:
For instance, if your spindle will go from 0RPM to 8000RPM, but you generally use speeds from 400RPM to 4000RPM, then find the PWM values that give 1600RPM and 2800RPM.
For each axis, there is a limited range of travel. The physical end of travel is called the hard stop.
Before the hard stop there is a limit switch. If the limit switch is encountered during normal operation, EMC shuts down the motor amplifier. The distance between the hard stop and limit switch must be long enough to allow an unpowered motor to coast to a stop.
Before the limit switch there is a soft limit. This is a limit enforced in software after homing. If a MDI command, or gcode program would pass the soft limit, it is not executed. If a jog would pass the soft limit, it is terminated at the soft limit.
The home switch can be placed anywhere within the travel (between hard stops). As long as external hardware does not deactivate the motor amplifiers with the limit switch is reached, one of the limit switches can be used as a home switch.
The zero position is the location on the axis that is 0 in the machine coordinate system. Usually the zero position will be within the soft limits. On lathes, constant surface speed mode requires that machine X=0 correspond to the center of spindle rotation when no tool offset is in effect.
The home position is the location within travel that the axis will be moved to at the end of the homing sequence. This value must be within the soft limits. In particular, the home position should never be exactly equal to a soft limit.
A machine can be operated without limit switches. In this case, only the soft limits stop the machine from reaching the hard stop. Soft limits only operate after the machine has been homed. Since there is no switch, the machine must be moved by eye to the home position before pressing the “Home” or “Home All” button.
A machine can be operated without home switches. If the machine has limit switches, but no home switches, it is best to use a limit switch as the home switch (e.g., choose Minimum Limit + Home X in the pinout). If the machine has no limit switches, or the limit switches cannot be used as home switches for another reason, then the machine must be homed “by eye”. Homing by eye is not as repeatable as homing to switches, but it still allows the soft limits to be useful.
Generating step pulses in software has one very big advantage - it's free. Just about every PC has a parallel port that is capable of outputting step pulses that are generated by the software. However, software step pulses also have some disadvantages:
Latency is how long it takes the PC to stop what it is doing and respond to an external request. In our case, the request is the periodic "heartbeat" that serves as a timing reference for the step pulses. The lower the latency, the faster you can run the heartbeat, and the faster and smoother the step pulses will be.
Latency is far more important than CPU speed. A lowly Pentium II that responds to interrupts within 10 microseconds each and every time can give better results than the latest and fastest P4 Hyperthreading beast.
The CPU isn't the only factor in determining latency. Motherboards, video cards, USB ports, and a number of other things can hurt the latency. The best way to find out what you are dealing with is to run the HAL latency test.
To run the test, from Applications/Accessories/Terminal (Ubuntu) open a shell and run the following command:
You should see something like this:
While the test is running, you should "abuse" the computer. Move windows around on the screen. Surf the web. Copy some large files around on the disk. Play some music. Run an OpenGL program such as glxgears. The idea is to put the PC through its paces while the latency test checks to see what the worst case numbers are.
Do not run EMC2 or Stepconf while the latency test is running.
The important numbers are the “max jitter”. In the example above, that is 17894 nanoseconds, or 17.9 microseconds. Record this number, and enter it in Stepconf when it is requested.
In the example above, latency-test only ran for a few seconds. You should run the test for at least several minutes; sometimes the worst case latency doesn't happen very often, or only happens when you do some particular action. For instance, one Intel motherboard worked pretty well most of the time, but every 64 seconds it had a very bad 300uS latency. Fortunately that was fixable.
For the latest information on fixing SMI issues goto:
"Fixing SMI Issues"
So, what do the results mean? If your Max Jitter number is less than about 15-20 microseconds (15000-20000 nanoseconds), the computer should give very nice results with software stepping. If the max latency is more like 30-50 microseconds, you can still get good results, but your maximum step rate might be a little disappointing, especially if you use microstepping or have very fine pitch leadscrews. If the numbers are 100uS or more (100,000 nanoseconds), then the PC is not a good candidate for software stepping. Numbers over 1 millisecond (1,000,000 nanoseconds) mean the PC is not a good candidate for EMC, regardless of whether you use software stepping or not.
Note that if you get high numbers, there may be ways to improve them. Another PC had very bad latency (several milliseconds) when using the onboard video. But a $5 used Matrox video card solved the problem - EMC does not require bleeding edge hardware.
The ideal wiring for external switches would be one input per switch. However, the PC parallel port only offers a total of 5 inputs, while there are as many as 9 switches on a 3-axis machine. Instead, multiple switches are wired together in various ways so that a smaller number of inputs are required.
The figures below show the general idea of wiring multiple switches to a single input pin. In each case, when one switch is actuated, the value seen on INPUT goes from logic HIGH to LOW. However, EMC expects a TRUE value when a switch is closed, so the corresponding “Invert” box must be checked on the pinout configuration page.
The following combinations of switches are permitted in Stepconf:
The last two combinations are also appropriate when a “home to limit” is used.