Next: 6.3 Configuring EMC Up: 6.2 Configuring EMC Previous: 6.2 Configuring EMC Contents Index

## Machine Configuration file emc.ini

The machine configuration file emc.ini follows the Microsoft INI file format, in which values are associated with keywords on single lines, perhaps in sections denoted with square brackets, e.g.,

[SECTION]
; COMMENT
SYMBOL = VALUE

Everything from the first non-whitespace character after the = up to the end of the line is passed as the value, so you can embed spaces in string symbols if you want to.

You can edit the values for each keyword in any text editor. The changes won't take effect until the next time the controller is run. The file should be called emc.ini, but the name can be overridden using a command line argument to the controllers. See the section "Starting Up" for information on how to do this. The following sections detail each section of the configuration file, using sample values for the configuration lines.

[EMC] section. The [EMC] section contains general parameters for the whole controller. These are:

VERSION = $Revision: 1.14 $

The version number for the INI file. This is automatically updated when using the Revision Control System, which looks for the $Revision: 1.14 $ string and appends the revision number. If you want to edit this manually just change the number and leave the other tags alone.

MACHINE = My Controller

This is the name of the controller, which is printed out when it runs. You can put whatever you want here.

NML_FILE = emc.nml

The name of the NML file to use.

DEBUG = 0x00000003

Sets the verbosity of the debugging messages printed out on the text console. Valid options are :

0x00000000 Do not print any debugging messages.

0x00000001 Print invalid messages

0x00000002 Print configuration settings

0x00000004 Print defaults

0x00000008 Print version

0x00000010 Print task messages

0x00000020 Print IO points

0x00000040 Print NML messages

0x00000080 Print time taken for motion to complete

0x00000100 Print interpreter debugging

0x00000200 Print RCS debugging

0x00000400 Print raw trajectory data

0x00000800 Print interpreter list

0x7FFFFFFF Print all debugging messages

The numbers can be combined (logical AND) so that selected information can be printed. i.e. 0x00000003 would print invalid messages AND configuration settings.

RS274NGC_STARTUP_CODE = G21 G90

A string of NC codes that the interpreter is initalised with.

[DISPLAY] section. The [DISPLAY] section contains parameters for the Graphical User Interface.

PLAT = nonrealtime

Only one choice, nonrealtime.

DISLAY = tkemc

The name of the user interface to use. Valid options are :

emcpanel

keystick

tkemc

tkemcts

xemc

yemc

CYCLE_TIME = 0.200

The period, in seconds, at which the display will be updated.

HELP_FILE = doc/help.txt

Location and name of a plain text help file to be used when the GUI HELP button is pressed.

POSITION_OFFSET = RELATIVE

Initial display setting for position, RELATIVE or MACHINE.

POSITION_FEEDBACK = ACTUAL

Initial display setting for position, COMMANDED or ACTUAL.

MAX_FEED_OVERRIDE = 1.2

Highest value that will be allowed for feedrate override. 1.0 = 100%

PROGRAM_PREFIX = programs/

The prefix to be added to any NC program prior to loading.

INTRO_GRAPHIC = emc.gif

File name of the image to be displayed whilst EMC is loaded. This can be commented out if not required.

INTRO_TIME = 5

Time, in seconds, that the intro image is displayed.

BALLOON_HELP = 1

Enable popup balloon help with tk based GUIs.

LINEAR_UNITS = AUTO

Units used for display of linear axis. AUTO, INCH, MM, or CM

ANGULAR_UNITS = AUTO

Units used for display of rotary axis. AUTO, DEG, RAD, or GRAD.

[TASK] section. The [TASK] section contains general parameters for EMCTASK, which includes primarily the NC language interpreter and the sequencing logic for sending commands to EMCMOT and EMCIO.

PLAT = nonrealtime

Only one choice, nonrealtime.

TASK = minimilltask

Name of the task controller program, bridgeporttask or minimilltask. This will need to correspond with IO controller program.

CYCLE_TIME = 0.010

The period, in seconds, at which EMCTASK will run. You can make this as small as you want to increase the throughput. Making it 0.0 or a negative number will tell EMCTASK not to sleep at all. Ultimately the system loading will limit the effective throughput.

[RS274NGC] section. Part program interpreter section.

PARAMETER_FILE = emc.var

Name of the file containing variables used for coordinate offsets.

[EMCMOT] section. The [EMCMOT] section contains critical parameters for the motion control module.

PLAT = realtime

Only one choice for most, realtime.

EMCMOT = steppermod.o

The motion control module to be used. Choices are :

steppermod.o The original stepper motor module using the parallel port. Not available with rtai systems.

freqmod.o An improved stepper motor module requiring PERIOD to be set.

smdromod.o freqmod with encoder feedback. Requires DRO_BASE_ADDRESS to be set.

stgmod.o Servo motor control using the Servo To Go card.

stg8mod.o Eight axis version of stgmod

stg2mod.o Servo motor control using the Servo To Go II card.

newstgmod.o Updated version of stgmod for both versions of the Servo To Go card.

vtiisamod.o Servo motor control using the ISA Vigilant Products card.

vtipcimod.o PCI version of vtiisamod. Only available for 2.4.xx based systems.

ppmcmod.o Jon Elson's parallel port motion control system for servo motors.

ppmcmod8.o Eight axis version of ppmcmod

univstepmod.o Stepper motor control via Jon Elson's parallel port system.

simmod.o Simulated motion control module.

minitetra.o Hexapod kinimatics using freqmod.

SHMEM_KEY = 100

Key used for shared memory.

SHMEM_BASE_ADDRESS = 0x3F00000

Base address of physical shared memory. For rtlinux_09J, this must point to memory reserved during boot up via ``mem = 31M'' in /etc/lilo.conf. This is not required for all later realtime linux systems as a different mechanism is used to allocate shared memory.

IO_BASE_ADDRESS = 0x378

Base address for the motion control card or parallel port.

PARPORT_BASE_ADDRESS = 0x378

Obsolete since July 2002 in the CVS sources, and BDI-2.2.18. Use IO_BASE_ADDRESS instead.

STG_BASE_ADDRESS = 0x200

Obsolete since July 2002 in the CVS sources, and BDI-2.2.18. Use IO_BASE_ADDRESS instead.

DRO_BASE_ADDRESS = 0x200

Base address for the Mauch/Kaluga DRO card used by smdromod for encoder feedback.

COMM_TIMEOUT= 1.0

Timeout for comms to emcmot in seconds.

COMM_WAIT = 0.010

Interval between tries of comms to emcmot in seconds.

PERIOD = 0.000020

Base period for output pulses with freqmod in seconds. The shorter the interval, the higher the maximum feedrate becomes, but at the expense of system throughput. Too smaller a period will cause the whole system to lock up.

Do NOT use this parameter with any module other than freqmod or smdromod. The system WILL lock up.

MOTION_IO_ADDRESS = 0x3BC

Port used for IO synchonized with motion start/end.

[TRAJ] section. The [TRAJ] section contains general parameters for the trajectory planning module in EMCMOT.

AXES = 3

The number of controlled axes in the system.

COORDINATES = X Y Z

The names of the axes being controlled. X, Y, Z, A, B, and C are all valid. It is also possible to have X Y Y Z and control ganged slides.

HOME = 0 0 0

Coordinates of the homed position of each axis.

LINEAR_UNITS = 0.03937007874016

The number of linear units per millimeter. For systems executing in native English (inch) units, this value is as shown above. For systems executing in native millimeter units, this value is 1. This does not affect the ability to program in English or metric units in NC code. It is used to determine how to interpret the numbers reported in the controller status by external programs.

ANGULAR_UNITS = 1.0

The number of angular units per degree. For systems executing in native degree units, this value is as shown above. For systems executing in radians, this value is 0.01745329252167, or PI/180.

CYCLE_TIME = 0.010

The period in seconds at which trajectory calculations are performed. This is a multiple of the period at which servo calculations are performed, as set in the [AXIS_#] CYCLE_TIME entry. Trajectory calculations are called at multiples of the servo period to plan linear or circular motion in Cartesian space. These values are interpolated at the servo period and run through the inverse kinematics.

DEFAULT_VELOCITY = 1.0

The initial velocity used for axis or coordinated axis motion, in user units per second.

DEFAULT_ACCELERATION = 100.0

The initial acceleration used for axis or coordinated axis motion, in user units per second per second.

MAX_VELOCITY = 5.0

The maximum velocity for any axis or coordinated move, in user units per second.

MAX_ACCELERATION = 100.0

The maximum acceleration for any axis or coordinated axis move, in user units per second per second.

PROBE_INDEX = 0

Input index of the probe used in CMM applications. See the [EMCIO] section for details of _INDEX.

PROBE_POLARITY = 1

Polarity of the probe when triggered. See the [EMCIO] section for details of INDEX.

[AXIS_#] Sections. The [AXIS_0], [AXIS_1], etc. sections contains general parameters for the individual axis control modules in EMCMOT. The axis section names begin numbering at 0, and run through the number of axes specified in the [TRAJ] AXES entry minus 1.

TYPE = LINEAR

The type of axes, either LINEAR or ANGULAR. Values for the position of LINEAR axes are in the units (per millimeter) specified in the [AXIS_#] UNITS entry. Values for the position of ANGULAR axes are in the units (per degree) specified in the same entry.

UNITS = 0.03937007874016

Units per millimeter for a LINEAR axis, as defined in the [AXIS_#] TYPE section, or units per degree for an ANGULAR axis as defined in the same section. The following parameters P, I, D, FF0, FF1, FF2 are used by the servo compensation algorithm to optimize performance while tracking trajectory set-points. See Tuning Servos for information on setting up a servomotor system.

P = 50

The proportional gain for the axis servo. This value multiplies the error between commanded and actual position in user units, resulting in a contribution to the computed voltage for the motor amplifier. The units on the P gain are volts per user unit.

I = 0

The integral gain for the axis servo. The value multiplies the cumulative error between commanded and actual position in user units, resulting in a contribution to the computed voltage for the motor amplifier. The units on the I gain are volts per user unit-seconds.

D = 0

The derivative gain for the axis servo. The value multiplies the difference between the current and previous errors, resulting in a contribution to the computed voltage for the motor amplifier. The units on the D gain are volts per user unit per second.

FF0 = 0

The 0-th order feedforward gain. This number is multiplied by the commanded position, resulting in a contribution to the computed voltage for the motor amplifier. The units on the FF0 gain are volts per user unit.

FF1 = 0

The 1st order feedforward gain. This number is multiplied by the change in commanded position per second, resulting in a contribution to the computed voltage for the motor amplifier. The units on the FF1 gain are volts per user unit per second.

FF2 = 0

The 2nd order feedforward gain. This number is multiplied by the change in commanded position per second per second, resulting in a contribution to the computed voltage for the motor amplifier. The units on the FF2 gain are volts per user unit per second per second.

CYCLE_TIME = 0.001

This is the period in seconds at which servo calculations will run. The values can be different between different axes, and the lowest will be used for all. This ensures that the calculations will occur at least as fast as they are specified here. The value should be an integer submultiple of the trajectory cycle time specified in the [TRAJ] CYCLE_TIME entry, so that an integer number of interpolations will occur. If this is not the case the times will be forced so that the interpolation interval is the next highest integer.

INPUT_SCALE = 40000 0

These two values are the scale and offset factors for the axis input from the raw feedback device, e.g., an incremental encoder. The second value (offset) is subtracted from raw input (e.g., encoder counts), and divided by the first value (scale factor), before being used as feedback. The units on the scale value are in raw units (e.g., counts) per user units (e.g., inch). The units on the offset value are in raw units (e.g., counts).

Specifically, when reading inputs, the EMC first reads the raw sensor values. The units on these values are the sensor units, typically A/D counts, or encoder ticks. These units, and the location of their 0 value, will not in general correspond to the quasi-SI units used in the EMC. Hence a scaling is done immediately upon sampling:

input = (raw - offset) / scale

The value for scale can be obtained analytically by doing a unit analysis, i.e., units are [sensor units]/[desired input SI units]. For example, on a 2000 counts per rev encoder, and 10 revs/inch gearing, and desired units of mm, we have

[scale units] = 2000 [counts/rev] * 10 [rev/inch] * 1/25.4 [inch/mm] = 787.4 counts/mm

and, as a result,

input [mm] = (encoder [counts] - offset [counts]) / 787.4 [counts/mm]

Note that the units of the offset are in sensor units, e.g., counts, and they are pre-subtracted from the sensor readings. The value for this offset is obtained by finding the value of counts for which you want your user units to read 0.0. This is normally accomplished automatically during a homing procedure.

OUTPUT_SCALE = 1 0

These two values are the scale and offset factors for the axis output to the motor amplifiers. The second value (offset) is subtracted from the computed output (in volts), and divided by the first value (scale factor), before being written to the D/A converters. The units on the scale value are in true volts per DAC output volts. The units on the offset value are in volts. These can be used to linearize a DAC.

Specifically, when writing outputs, the EMC first converts the desired output in quasi-SI units to raw actuator values, e.g., volts for an amplifier DAC. This scaling looks like:

raw = (output - offset) / scale

The value for scale can be obtained analytically by doing a unit analysis, i.e., units are [output SI units]/[actuator units]. For example, on a machine with a velocity mode amplifier such that 1 volt results in 250 mm/sec velocity, we have:

[scale units] = 250 [mm/sec] / 1 [volts] = 250 mm/sec/volt

and, as a result,

amplifier [volts] = (output [mm/sec] - offset [mm/sec]) / 250 [mm/sec/volt]

Note that the units of the offset are in user units, e.g., mm/sec, and they are pre-subtracted from the sensor readings. The value for this offset is obtained by finding the value of your output which yields 0.0 for the actuator output. If the DAC is linearized, this offset is normally 0.0.

The scale and offset can be used to linearize the DACs as well, resulting in values that reflect the combined effects of amplifier gain, DAC non-linearity, DAC units, etc. To do this, follow this procedure:

a. Build a calibration table for the output, driving the DACs with a desired voltage and measuring the result, e.g.,

RAW MEAS -- -- -10 -9.93 -9 V -8.83 0 -0.03 1 0.96 9 9.87 10 10.87

b. Do a least-squares linear fit to get coefficients a, b such that

meas = a * raw + b

c. Note that we want raw output such that our measured result is identical to the commanded output. This means

cmd = a * raw + b

raw = (cmd - b) / a

As a result, the a and b coefficients from the linear fit can be used as the scale and offset for the controller directly.

MIN_LIMIT = -1000

The minimum limit (soft limit) for axis motion, in user units. When this limit is exceeded, the controller aborts axis motion.

MAX_LIMIT = 1000

The maximum limit (soft limit) for axis motion, in user units. When this limit is exceeded, the controller aborts axis motion.

MIN_OUTPUT = -10

The minimum value for the output of the PID compensation that is written to the motor amplifier, in volts. The computed output value is clamped to this limit. The limit is applied before scaling to raw output units.

MAX_OUTPUT = 10

The maximum value for the output of the PID compensation that is written to the motor amplifier, in volts. The computed output value is clamped to this limit. The limit is applied before scaling to raw output units.

FERROR = 1.0 MIN_FERROR = 0.010

FERROR is the maximum allowable following error, in user units. If the difference between commanded and sensed position exceeds this amount, the controller disables servo calculations, sets all the outputs to 0.0, and disables the amplifiers. If MIN_FERROR is present in the .ini file, velocity-proportional following errors are used. Here, the maximum allowable following error is proportional to the speed, with FERROR applying to the rapid rate set by [TRAJ] MAX_VELOCITY, and proportionally smaller following errors for slower speeds. The maximum allowable following error will always be greater than MIN_FERROR. This prevents small following errors for stationary axes from inadvertently aborting motion. Small following errors will always be present due to vibration, etc. The following polarity values determine how inputs are interpreted and how outputs are applied. They can usually be set via trial-and-error since there are only two possibilities. The EMCMOT utility program USRMOT can be used to set these interactively and verify their results so that the proper values can be put in the INI file with a minimum of trouble.

ENABLE_POLARITY = 0

The polarity for enabling the amplifiers. Set this to 0 or 1 for the proper polarity. This value can be determined by following all the electronics back from the amplifier, through any driver circuitry, etc. or it can be set through a simple trial-and-error. Normally, for amplifiers which are enabled active-low (0 volts enables), this is a 0.

MIN_LIMIT_SWITCH_POLARITY = 1

The polarity for detecting minimum-travel hardware limit switch trips. Set this depending on how your switches are wired up to the digital inputs on the I/O board.

MAX_LIMIT_SWITCH_POLARITY = 1

The polarity for detecting maximum-travel hardware limit switch trips. Set this depending on how your switches are wired up to the digital inputs on the I/O board.

HOME_SWITCH_POLARITY = 1

The polarity for detecting homing switch trips. Set this depending on how your switches are wired up to the digital inputs on the I/O board.

HOMING_POLARITY = 1

The direction in which homing moves are initiated. 0 means in the negative direction, 1 means in the positive direction.

FAULT_POLARITY = 1

The polarity for detecting amplifier faults. Set this to 0 or 1 depending upon how the amplifier sets the logic level for its fault condition.

The following entries are used to set the parameters for the DC servomotor simulations. These are only used when running the EMC in simulation.

TORQUE_UNITS = OZ_IN

The units used to interpret subsequent values for ROTOR_INERTIA and DAMPING_FRICTION_COEFFICIENT. This can be OZ_IN for ounce-inches, LB_FT for pound-feet, or N_M for newton-meters.

ARMATURE_RESISTANCE = 1.10

The resistance, in ohms, of the motor.

ARMATURE_INDUCTANCE = 0.0120

The inductance, in henries, of the motor.

BACK_EMF_CONSTANT = 0.0254

The back EMF constant, or torque constant, in volts per radian per second.

ROTOR_INERTIA = 0.0104

The rotor inertia, in torque units * seconds2.

DAMPING_FRICTION_COEFFICIENT = 0.083

The damping coefficient, in torque units per radian per second.

SHAFT_OFFSET = 0

The angular offset, in radians, between the the motor initial position and the encoder initial position. Normally this is 0, but can be made any arbitrary value if the simulated motor shaft position is interpreted as the actual axis position and should be something other than 0 when the encoder reports 0.

REVS_PER_UNIT = 10

The amount of motor shaft revolutions per user unit of position. For example, for a 1/10 inch lead screw, where 10 rotations equals 1 inch, this would be 10. The following entry is used to set the parameters for the amplifier simulations. These are only used when running the EMC in simulation.

AMPLIFIER_GAIN = 1

The gain of the amplifier, which multiplies the input voltage to generate an output voltage which drives the motor.

MAX_OUTPUT_CURRENT = 10

The maximum output current of the amplifier, in amps.

LOAD_RESISTANCE = 1.10

The resistance, in ohms, of the load on the amplifier. This is normally the same as the motor armature resistance, but it may not be, for example, if there is additional resistive load between the amplifier and the motor itself. The following entry is used to set the parameters for the encoder simulations. These are only used when running the EMC in simulation.

COUNTS_PER_REV = 4096

The number of encoder counts per motor shaft revolution. If there is gearing between the encoder shaft and the motor shaft, this value should include this.

[EMCIO] section. The [EMCIO] section contains control values and setup parameters for the digital and analog I/O points in EMCIO.

The following entries set general parameters for the I/O controller.

PLAT = nonrealtime

Only one choice, nonrealtime.

EMCIO = minimillio

Name of the IO controller program. Valid options are :

bridgeportio Used with bridgeporttask in [TASK] section.

minimillio Used with minimilltask in [TASK] section.

ppmcio Used with bridgeporttask in [TASK] section.

simio Can be used with either minimilltask or bridgeporttask.

CYCLE_TIME = 0.100

The period, in seconds, at which EMCIO will run. You can make this as small as you want to increase the throughput. Making it 0.0 or a negative number will tell EMCIO not to sleep at all. Ultimately the system loading will limit the effective throughput.

TOOL_TABLE = tool.tbl

The file which contains tool information. The format of the file is POC FMS LEN DIAM COMMENT 1 1 0 0 2 2 0 0

where the first line is a comment (in this case the name of the columns), and the subsequent lines contain the pocket number in which the tool is located, the tool ID of the tool itself, the length, the diameter, and an optional comment. The length and diameter are in user units.

The following entries set parameters for spindle control.

IO_BASE_ADDRESS = 0x278

Base address for the port used for IO.

PARPORT_BASE_ADDRESS = 0x278

Obsolete since July 2002 in the CVS sources, and BDI-2.2.18. Use IO_BASE_ADDRESS instead.

SPINDLE_OFF_WAIT = 1.0

How long, in seconds, to wait after the spindle has been turned off before applying the brake.

SPINDLE_ON_WAIT = 1.5

How long, in seconds, to wait after the spindle brake has been released before turning the spindle on.

The following entries set the bit indices for the digital I/O so that the controller knows the mapping to I/O point wiring. The indices start at 0 for the least significant bit in the digital I/O map. See Setting up the External Interfaces for information on interfacing I/O boards to the software.

ESTOP_SENSE_INDEX = 1

The location of the input bit which is used to detect whether the system is in ESTOP.

LUBE_SENSE_INDEX = 2

The location of the input bit which is used to detect whether the lubrication level is OK or low.

SPINDLE_FORWARD_INDEX = 1

The location of the output bit which is used to drive the spindle forward. Only applicable to manual spindles.

SPINDLE_REVERSE_INDEX = 0

The location of the output bit which is used to drive the spindle in reverse. Only applicable to manual spindles.

MIST_COOLANT_INDEX = 6

The location of the output bit which is used to turn mist coolant on or off.

FLOOD_COOLANT_INDEX = 7

The location of the output bit which is used to turn flood coolant on or off.

SPINDLE_DECREASE_INDEX = 8

The location of the output bit which is used to decrease the spindle speed. Only applicable to manual spindles.

SPINDLE_INCREASE_INDEX = 9

The location of the output bit which is used to increase the spindle speed. Only applicable to manual spindles.

ESTOP_WRITE_INDEX = 10

The location of the output bit which is used to cause an ESTOP.

SPINDLE_BRAKE_INDEX = 11

The location of the output bit which is used to engage or release the spindle brake.

The following entries set the polarities for the digital I/O points. These can be set by trial-and-error, or by noting the levels and any inverting done by the electronics between the sensors and actuators and the electronics.

ESTOP_SENSE_POLARITY = 1

The polarity of the sensed estop input bit.

LUBE_SENSE_POLARITY = 1

The polarity of the sensed lube level bit.

SPINDLE_FORWARD_POLARITY = 0

The polarity of the sensed spindle forward bit.

SPINDLE_REVERSE_POLARITY = 0

The polarity of the sensed spindle reverse bit.

MIST_COOLANT_POLARITY = 0

The polarity of the sensed mist coolant bit.

FLOOD_COOLANT_POLARITY = 0

The polarity of the sensed flood coolant bit.

SPINDLE_DECREASE_POLARITY = 1

The polarity of the sensed spindle decrease bit.

SPINDLE_INCREASE_POLARITY = 1

The polarity of the sensed spindle increase bit.

ESTOP_WRITE_POLARITY = 1

The polarity of the sensed estop activation bit.

SPINDLE_BRAKE_POLARITY = 0

The polarity of the sensed spindle brake bit.

[EMCSERVER] section

EMCSERVER = emcsvr

Name of NML server, e.g., emcsvr; if not found then none will run.

[EMCSTRIP] section. Section for emc stripchart parameters.

EMCSTRIP = emcstripchart

Name of strip chart display program e.g. emcstripchart, if not found then none will run.

OPTIONS = -f emcstrip.conf.ferror

Options for emcstripchart ussually -f something.conf. This file says which variables to plot, colors etc. -u changes the update rate.

Next: 6.3 Configuring EMC Up: 6.2 Configuring EMC Previous: 6.2 Configuring EMC Contents Index