This documentation is no longer maintained. For documentation of the current version of emc2, please see http://www.linuxcnc.org/docview/html

SIM_ENCODER

NAME
SYNOPSIS
DESCRIPTION
FUNCTIONS
PINS
PARAMETERS

NAME

sim_encoder − simulated quadrature encoder

SYNOPSIS

loadrt sim_encoder num_chan=num

DESCRIPTION

sim_encoder can generate quadrature signals as if from an encoder. It also generates an index pulse once per revolution. It is mostly used for testing and simulation, to replace hardware that may not be available. It has a limited maximum frequency, as do all software based pulse generators.

sim_encoder supports a maximum of eight channels. The number of channels actually loaded is set by the num_chan argument when the module is loaded. If numchan is not specified, the default value is one.

FUNCTIONS

sim-encoder.make-pulses (no floating-point)

Generates the actual quadrature and index pulses. Must be called as frequently as possible, to maximize the count rate and minimize jitter. Operates on all channels at once.

sim-encoder.update-speed (uses floating-point)

Reads the speed command and other parameters and converts the data into a form that can be used by make-pulses. Changes take effect only when update-speed runs. Can (and should) be called less frequently than make-pulses. Operates on all channels at once.

PINS

sim-encoder.N.phase-A bit out

One of the quadrature outputs.

sim-encoder.N.phase-B bit out

The other quadrature output.

sim-encoder.N.phase-Z bit out

The index pulse.

sim-encoder.N.speed float in

The desired speed of the encoder, in user units per per second. This is divided by scale, and the result is used as the encoder speed in revolutions per second.

PARAMETERS

sim-encoder.N.ppr u32 rw

The pulses per revolution of the simulated encoder. Note that this is pulses, not counts, per revolution. Each pulse or cycle from the encoder results in four counts, because every edge is counted. Default value is 100 ppr, or 400 counts per revolution.

sim-encoder.N.scale float rw

Scale factor for the speed input. The speed value is divided by scale to get the actual encoder speed in revolutions per second. For example, if scale is set to 60, then speed is in revolutions per minute (RPM) instead of revolutions per second. The default value is 1.00.