#LyX 1.3 created this file. For more info see http://www.lyx.org/ \lyxformat 221 \textclass book \begin_preamble \usepackage[plainpages=false,pdfpagelabels,colorlinks=true,linkcolor=blue]{hyperref} \end_preamble \language english \inputencoding default \fontscheme bookman \graphics default \float_placement !htbp \paperfontsize default \spacing single \papersize letterpaper \paperpackage a4 \use_geometry 1 \use_amsmath 0 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \leftmargin 1in \topmargin 1in \rightmargin 0.8in \bottommargin 0.8in \secnumdepth 1 \tocdepth 5 \paragraph_separation skip \defskip smallskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Chapter Basic configurations for a stepper based system \layout Section \begin_inset LatexCommand \label{sec:Introduction} \end_inset Introduction \layout Standard This chapter describes some of the more common settings that users want to change when setting up EMC2. Because of the various possibilities of configuring EMC2, it is very hard to document them all, and keep this document relatively short. \layout Standard The most common EMC2 usage (as reported by our users) is for stepper based systems. These systems are using stepper motors with drives that accept step & direction signals. \layout Standard It is one of the simpler setups, because the motors run open-loop (no feedback comes back from the motors), yet the system needs to be configured properly so the motors don't stall or lose steps. \layout Standard Most of this chapter is based on the sample config released along with EMC2. The config is called stepper \begin_inset LatexCommand \index{stepper} \end_inset , and usually it is found in \family typewriter /etc/emc2/sample-configs/stepper \family default . \layout Section \begin_inset LatexCommand \label{sec:Maximum-step-rate} \end_inset Maximum step rate \begin_inset LatexCommand \index{step rate} \end_inset \layout Standard With software step generation, the maximum step rate is one step per two BASE_PERIODs for step-and-direction output. The maximum requested step rate is the product of an axis's MAX_VELOCITY and its INPUT_SCALE. If the requested step rate is not attainable, following errors will occur, particularly during fast jogs and G0 moves. \layout Standard If your stepper driver can accept quadrature input, use this mode. With a quadrature signal, one step is possible for each BASE_PERIOD, doubling the maximum step rate. \layout Standard The other remedies are to decrease one or more of: the BASE_PERIOD (setting this too low will cause the machine to become unresponsive or even lock up), the INPUT_SCALE (if you can select different step sizes on your stepper driver, change pulley ratios, or leadscrew pitch), or the MAX_VELOCITY and STEPGEN_MAXVEL. \layout Standard If no valid combination of BASE_PERIOD, INPUT_SCALE, and MAX_VELOCITY is acceptable, then hardware step generation (such as with the emc2-supported Universal Stepper Controller) \layout Section \begin_inset LatexCommand \label{sec:Pinout} \end_inset Pinout \begin_inset LatexCommand \index{pinout} \end_inset \layout Standard One of the majour flaws in EMC was that you couldn't specify the pinout without recompiling the source code. EMC2 is far more flexible, and now (thanks to the Hardware Abstraction Layer) you can easily specify which signal goes where. (read the \begin_inset LatexCommand \ref{sec:What-is-HAL?} \end_inset section for more information about the HAL \begin_inset LatexCommand \index{HAL} \end_inset ). \layout Standard As it is described in the HAL Introduction and tutorial, we have signals, pins and parameters inside the HAL. \layout Standard The ones relevant for our pinout are \begin_inset Foot collapsed true \layout Standard Note: we are only presenting one axis to keep it short, all others are similar. \end_inset : \layout LyX-Code signals: Xstep, Xdir & Xen \newline pins: parport.0.pin-XX-out & parport.0.pin-XX-in \begin_inset Foot collapsed true \layout Standard Refer to section \begin_inset LatexCommand \ref{sec:Parport} \end_inset for additional information \end_inset \layout Standard Depending on what you have chosen in your ini file you are using either standard_pinout.hal or xylotex_pinout.hal. These are two files that instruct the HAL how to link the various signals & pins. Furtheron we'll investigate the standard_pinout.hal. \layout Subsection \begin_inset LatexCommand \label{sub:standard_pinout.hal} \end_inset standard_pinout.hal \begin_inset LatexCommand \index{standard pinout} \end_inset \layout Standard This file contains several HAL commands, and usually looks like this: \layout LyX-Code \begin_inset Include \verbatiminput{../../../configs/stepper/standard_pinout.hal} preview false \end_inset \layout Standard The files starting with '#' are comments, and their only purpose is to guide the reader through the file. \layout Subsection \begin_inset LatexCommand \label{sub:Overview-standard_pinout.hal} \end_inset Overview of the standard_pinout.hal \layout Standard There are a couple of operations that get executed when the standard_pinout.hal gets executed / interpreted: \layout Enumerate The Parport driver gets loaded (see \begin_inset LatexCommand \ref{sec:Parport} \end_inset for details) \layout Enumerate The read & write functions of the parport driver get assigned to the Base thread \begin_inset Foot collapsed true \layout Standard the fastest thread in the EMC2 setup, usually the code gets executed every few microseconds \end_inset \layout Enumerate The step & direction signals for axes X,Y,Z get linked to pins on the parport \layout Enumerate Further IO signals get connected (estop loopback, toolchanger loopback) \layout Enumerate A spindle On signal gets defined and linked to a parport pin \layout Subsection \begin_inset LatexCommand \label{sub:Changing-standard_pinout.hal} \end_inset Changing the standard_pinout.hal \layout Standard If you want to change the standard_pinout.hal file, all you need is a text editor. Open the file and locate the parts you want to change. \layout Standard If you want for example to change the pin for the X-axis Step & Directions signals, all you need to do is to change the number in the 'parport.0.pin-XX-out' name: \layout LyX-Code linksp Xstep parport.0.pin-03-out \newline linksp Xdir parport.0.pin-02-out \layout Standard can be changed to: \layout LyX-Code linksp Xstep parport.0.pin-02-out \newline linksp Xdir parport.0.pin-03-out \layout Standard or basicly any other numbers you like. \layout Standard Hint: make sure you don't have more than one signal connected to the same pin. \layout Subsection \begin_inset LatexCommand \label{sub:Changing-the-polarity} \end_inset Changing the polarity of a signal \begin_inset LatexCommand \index{signal polarity} \end_inset \layout Standard If external hardware expects an \begin_inset Quotes eld \end_inset active low \begin_inset Quotes erd \end_inset signal, set the corresponding \family typewriter -invert \family default parameter. For instance, to invert the spindle control signal: \layout LyX-Code setp parport.0.pin-09-invert TRUE \layout Subsection \begin_inset LatexCommand \label{sub:PWM-Spindle-Speed} \end_inset Adding PWM Spindle Speed Control \begin_inset LatexCommand \index{spindle speed control} \end_inset \layout Standard If your spindle can be controlled by a PWM signal, use the \family typewriter pwmgen \family default component to create the signal: \layout LyX-Code loadrt pwmgen output_type=0 \newline addf pwmgen.update servo-thread \newline addf pwmgen.make-pulses base-thread \newline net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value \newline net spindle-on motion.spindle-on => pwmgen.0.enable \newline net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out \newline setp pwmgen.0.scale 1800 # Change to your spindle's top speed in RPM \layout Standard This assumes that the spindle controller's response to PWM is simple: 0% PWM gives 0RPM, 10% PWM gives 180 RPM, etc. If there is a minimum PWM required to get the spindle to turn, follow the example in the \emph on nist-lathe \emph default sample configuration to use a \family typewriter scale \family default component. \layout Subsection \begin_inset LatexCommand \label{sub:Adding-enable-signal} \end_inset Adding an enable signal \begin_inset LatexCommand \index{enable signal} \end_inset \layout Standard Some amplifiers (drives) require an enable signal before they accept and command movement of the motors. For this reason there are already defined signals called 'Xen', 'Yen', 'Zen'. \layout Standard To connect them use the following example: \layout LyX-Code linksp Xen parport.0.pin-08-out \layout Standard You can either have one single pin that enables all drives, or several, depending on the setup you have. Note however that usually when one axis faults, all the other ones will be disabled aswell, so having only one signal / pin is perfectly safe. \layout Subsection Adding an external ESTOP \begin_inset LatexCommand \index{ESTOP} \end_inset button \layout Standard As you can see in \begin_inset LatexCommand \ref{sub:standard_pinout.hal} \end_inset by default the stepper configuration assumes no external ESTOP button. \begin_inset Foot collapsed true \layout Standard An extensive explanation of hooking up ESTOP circuitry is explained in the wiki.linuxcnc.org and in the Integrator Manual \end_inset \layout Standard To add a simple external button you need to replace the line: \layout LyX-Code linkpp iocontrol.0.user-enable-out iocontrol.0.emc-enable-in \layout Standard with \layout LyX-Code linkpp parport.0.pin-01-in iocontrol.0.emc-enable-in \layout Standard This assumes an ESTOP switch connected to pin 01 on the parport. As long as the switch will stay pushed \begin_inset Foot collapsed true \layout Standard make sure you use a maintained switch for ESTOP. \end_inset , EMC2 will be in the ESTOP state. When the external button gets released EMC2 will imediately switch to the ESTOP-RESET state, and all you need to do is switch to Machine On \begin_inset LatexCommand \index{machine on} \end_inset and you'll be able to continue your work with EMC2. \the_end