sserial

title: sserial(9)

text:
# sserial(9)

## NAME
hostmot2 - Smart Serial LinuxCNC HAL driver for the Mesa Electronics HostMot2 Smart-Serial remote cards

## SYNOPSIS
The Mesa Smart-Serial interface is a 2.5Mbs proprietary interface between the Mesa Anything-IO cards and a range of subsidiary devices termed "smart-serial remotes". The remote cards perform a variety of functions, but typically they combine various classes of IO. The remote cards are self-configuring, in that they tell the main LinuxCNC Hostmot2 driver what their pin functions are and what they should be named.

Many sserial remotes offer different pinouts depending on the mode they are started up in. This is set using the sserial_port_N= option in the hm2_pci modparam. See the hostmot2 manpage for further details.

It is likely that this documentation will be permanently out of date.

Each Anything-IO board can attach up to 8 sserial remotes to each header (either the 50-pin headers on the 5I20/5I22/5I23/7I43 or the 25-pin connectors on the 5I25, 6I25 and 7I80). The remotes are grouped into "ports" of up to 8 "channels". Typically each header will be a single 8 channel port, but this is not necessarily always the case.

## PORTS
In addition to the per-channel/device pins detailed below there are three per-port pins and three parameters.

Pins:

(bit, in) .sserial.port-N.run: Enables the specific Smart Serial module. Setting this pin low will disable all boards on the port and puts the port in a pass-through mode where device parameter setting is possible. It is necessary to toggle the state of this pin if there is a requirement to alter a remote parameter on a live system. This pin defaults to TRUE and can be left unconnected. However, toggling the pin low-to-high will re-enable a faulted drive so the pin could usefully be connected to the iocontrol.0.user-enable-out pin.

(u32, ro) .run_state: Shows the state of the sserial communications state-machine. This pin will generally show a value of 0x03 in normal operation, 0x07 in setup mode and 0x00 when the "run" pin is false.

(u32, ro) .error-count: Indicates the state of the Smart Serial error handler, see the parameters section for more details.

Parameters:

(u32 r/w) .fault-inc: Any over-run or handshaking error in the SmartSerial communications will increment the .fault-count pin by the amount specified by this parameter. Default = 10.

(u32 r/w) .fault-dec: Every successful read/write cycle decrements the fault counter by this amount. Default = 1.

(u32 r/w) .fault-lim: When the fault counter reaches this threshold the Smart Serial interface on the corresponding port will be stopped and an error printed in dmesg. Together these three pins allow for control over the degree of fault- tolerance allowed in the interface. The default values mean that if more than one transaction in ten fails, more than 20 times, then a hard error will be raised. If the increment were to be set to zero then no error would ever be raised, and the system would carry on regardless. Conversely setting decrement to zero, threshold to 1 and limit to 1 means that absolutely no errors will be tolerated. (This structure is copied directly from vehicle ECU practice.)

Any other parameters than the ones above are created by the card istelf from data in the remote firmware. They may be set in the HAL file using "setp" in the usual way.

NOTE: Because a Smart-Serial remote can only communicate non-process data to the host card in setup mode, it is necessary to stop and re-start the smart-serial port associated with the card to alter the value of a parameter.

ALSO NOTE: in the case of parameters beginning with "nv" (which are stored in non-volatile memory) the effect will not be seen until after the next power cycle of the drive.

Unchanged values will not be re-written so it is safe to leave the "setp" commands in the HAL file or delete them as you see fit.

## DEVICES
The other pins and parameters created in HAL depend on the devices detected. The following list of Smart Serial devices is by no means exhaustive.

### 8I20
The 8I20 is a 2.2 kW three-phase drive for brushless DC motors and AC servo motors. 8I20 pins and parameters have names like "hm2_<BoardType>.<BoardNum>.8i20.<PortNum>.<ChanNum>.<Pin>", for example "hm2_5i23.0.8i20.1.3.current" would set the phase current for the drive connected to the fourth channel of the second sserial port of the first 5I23 board. Note that the sserial ports do not necessarily correlate in layout or number to the physical ports on the card.

Pins:

(float in) angle

The rotor angle of the motor in fractions of a full phase revolution. An angle of 0.5 indicates that the motor is half a turn / 180 degrees / π radians from the zero position. The zero position is taken to be the position that the motor adopts under no load with a poitive voltage applied to the A (or U) phase and both B and C (or V and W) connected to -V or 0 V. A 6 pole motor will have 3 zero positions per physical rotation. Note that the 8I20 drive automatically adds the phase lead/lag angle, and that this pin should see the raw rotor angle. There is a HAL module (bldc) which handles the complexity of differing motor and drive types.

(float, in) current

The phase current command to the drive. This is scaled from -1 to +1 for forwards and reverse maximum currents. The absolute value of the current is set by the max_current parameter.

(float, ro) bus-voltage

The drive bus voltage in V. This will tend to show 25.6 V when the drive is unpowered and the drive will not operate below about 50 V.

(float, ro) temp

The temperature of the driver in degrees C.

(u32, ro) comms

The communication status of the drive. See the manual for more details.

(bit, ro) status and fault.

The following fault/status bits are exported. For further details see the 8I20 manual. fault.U-current / fault.U-current-not fault.V-current / fault.V-current-not fault.W-current / fault.W-current-not fault.bus-high / fault.bus-high-not fault.bus-overv / fault.bus-overv-not fault.bus-underv / fault.bus-underv-not fault.framingr / fault.framingr-not fault.module / fault.module-not fault.no-enable / fault.no-enable-not fault.overcurrent / fault.overcurrent-not fault.overrun / fault.overrun-not fault.overtemp / fault.overtemp-not fault.watchdog / fault.watchdog-not status.brake-old / status.brake-old-not status.brake-on / status.brake-on-not status.bus-underv / status.bus-underv-not status.current-lim / status.current-lim-no status.ext-reset / status.ext-reset-not status.no-enable / status.no-enable-not status.pid-on / status.pid-on-not status.sw-reset / status.sw-reset-not status.wd-reset / status.wd-reset-not

Parameters:

The following parameters are exported. See the PDF documentation downloadable from Mesa for further details.

hm2_5i25.0.8i20.0.1.angle-maxlim

hm2_5i25.0.8i20.0.1.angle-minlim

hm2_5i25.0.8i20.0.1.angle-scalemax

hm2_5i25.0.8i20.0.1.current-maxlim

hm2_5i25.0.8i20.0.1.current-minlim

hm2_5i25.0.8i20.0.1.current-scalemax

hm2_5i25.0.8i20.0.1.nvbrakeoffv

hm2_5i25.0.8i20.0.1.nvbrakeonv

hm2_5i25.0.8i20.0.1.nvbusoverv

hm2_5i25.0.8i20.0.1.nvbusundervmax

hm2_5i25.0.8i20.0.1.nvbusundervmin

hm2_5i25.0.8i20.0.1.nvkdihi

hm2_5i25.0.8i20.0.1.nvkdil

hm2_5i25.0.8i20.0.1.nvkdilo

hm2_5i25.0.8i20.0.1.nvkdp

hm2_5i25.0.8i20.0.1.nvkqihi

hm2_5i25.0.8i20.0.1.nvkqil

hm2_5i25.0.8i20.0.1.nvkqilo

hm2_5i25.0.8i20.0.1.nvkqp

hm2_5i25.0.8i20.0.1.nvmaxcurrent

hm2_5i25.0.8i20.0.1.nvrembaudrate

hm2_5i25.0.8i20.0.1.swrevision

hm2_5i25.0.8i20.0.1.unitnumber

(float, rw) max_current

Sets the maximum drive current in Amps. The default value is the maximum current programmed into the drive EEPROM. The value must be positive, and an error will be raised if a current in excess of the drive maximum is requested.

(u32, ro) serial_number

The serial number of the connected drive. This is also shown on the label on the drive.

### 7I64
The 7I64 is a 24-input 24-output IO card. 7I64 pins and parameters have names like "hm2_<BoardType>.<BoardNum>.7i64.<PortNum>.<ChanNum>.<Pin>", for example hm2_5i23.0.7i64.1.3.output-01 .

Pins:

(bit, in) 7i64.0.0.output-NN: Writing a 1 or TRUE to this pin will enable output driver NN. Note that the outputs are drivers (switches) rather than voltage outputs. The LED adjacent to the connector on the board shows the status. The output can be inverted by setting a parameter.

(bit, out) 7i64.0.0.input-NN: The value of input NN. Note that the inputs are isolated and both pins of each input must be connected, typically to signal and the ground of the signal. (This need not be the ground of the board.)

(bit, out) 7i64.0.0.input-NN-not: An inverted copy of the corresponding input.

(float, out) 7i64.0.0.analog0 & 7i64.0.0.analog1: The two analogue inputs (0 to 3.3 V) on the board.

Parameters:

(bit, rw) 7i64.0.0.output-NN-invert: Setting this parameter to 1 / TRUE will invert the output value, such that writing 0 to .gpio.NN.out will enable the output and vice-versa.

### 7I76
The 7I76 is not really a smart-serial device. It serves as a breakout for a number of other Hostmot2 functions. There are connections for 5 step generators (for which see the main hostmot2 manpage). The stepgen pins are associated with the 5I25 (hm2_5i25.0.stepgen.00....) whereas the smart-serial pins are associated with the 7I76 (hm2_5i25.0.7i76.0.0.output-00).

Pins:

(float out) .7i76.0.0.analogN (modes 1 and 2 only) Analogue input values.

(float out) .7i76.0.0.fieldvoltage (mode 2 only) Field voltage monitoring pin.

(bit in) .7i76.0.0.spindir: This pin provides a means to drive the spindle VFD direction terminals on the 7I76 board.

(bit in) .7i76.0.0.spinena: This pin drives the spindle-enable terminals on the 7I76 board.

(float in) .7i76.0.0.spinout: This controls the analogue output of the 7I76. This is intended as a speed control signal for a VFD.

(bit out) .7i76.0.0.output-NN: (NN = 0 to 15). 16 digital outputs. The sense of the signal can be set via a parameter.

(bit out) .7i76.0.0.input-NN: (NN = 0 to 31) 32 digital inputs.

(bit in) .7i76.0.0.input-NN-not: (NN = 0 to 31) An inverted copy of the inputs provided for convenience. The two complementary pins may be connected to different signal nets.

Parameters:

(u32 ro) .7i76.0.0.nvbaudrate: Indicates the vbaud rate. This probably should not be altered.

(u32 ro) .7i76.0.0.nvunitnumber: Indicates the serial number of the device and should match a sticker on the card. This can be useful for working out which card is which.

(u32 ro) .7i76.0.0.nvwatchdogtimeout: The sserial remote watchdog timeout. This is separate from the Anything-IO card timeout. This is unlikely to need to be changed.

(bit rw) .7i76.0.0.output-NN-invert: Invert the sense of the corresponding output pin.

(bit rw) .7i76.0.0.spindir-invert: Invert the senseof the spindle direction pin.

(bit rw) .7i76.0.0.spinena-invert: Invert the sense of the spindle-enable pin.

(float rw) .7i76.0.0.spinout-maxlim: The maximum speed request allowable

(float rw) .7i76.0.0.spinout-minlim: The minimum speed request.

(float rw) .7i76.0.0.spinout-scalemax: The spindle speed scaling. This is the speed request which would correspond to full-scale output from the spindle control pin. For example with a 10 V drive voltage and a 10000 RPM scalemax a value of 10,000 RPM on the spinout pin would produce 10 V output. However, if spinout-maxlim were set to 5,000 RPM then no voltage above 5 V would be output.

(u32 ro) .7i76.0.0.swrevision: The onboard firmware revision number. Utilities (man setsserial for details) exist to update and change this firmware.

### 7I77
The 7I77 is an 6-axis servo control card. The analogue outputs are smart-serial devices, but the encoders are conventional hostmot2 encoders and further details of them may be found in the hostmot2 manpage.

Pins:

(bit out) .7i77.0.0.input-NN: (NN = 0 to 31) 32 digital inputs.

(bit in) .7i77.0.0.input-NN-not: (NN = 0 to 31) An inverted copy of the inputs provided for convenience. The two complementary pins may be connected to different signal nets.

(bit out) .7i77.0.0.output-NN: (NN = 0 to 15). 16 digital outputs. The sense of the signal can be set via a parameter.

(bit in) .7i77.0.0.spindir: This pin provides a means to drive the spindle VFD direction terminals on the 7I76 board.

(bit in) .7i77.0.0.spinena: This pin drives the spindle-enable terminals on the 7I76 board.

(float in) .7i77.0.0.spinout: This controls the analog output of the 7I77. This is intended as a speed control signal for a VFD.

(bit in) .7i77.0.1.analogena: This pin drives the analog enable terminals on the 7I77 board.

(float in) .7i77.0.1.analogoutN: (N = 0 to 5) This controls the analog output of the 7I77.

Parameters:

(bit rw) .7i77.0.0.output-NN-invert: Invert the sense of the corresponding output pin.

(bit rw) .7i77.0.0.spindir-invert: Invert the sense of the spindle direction pin.

(bit rw) .7i77.0.0.spinena-invert: Invert the sense of the spindle-enable pin.

(float rw) .7i77.0.0.spinout-maxlim: The maximum speed request allowable

(float rw) .7i77.0.0.spinout-minlim: The minimum speed request.

(float rw) .7i77.0.0.spinout-scalemax: The spindle speed scaling. This is the speed request which would correspond to full-scale output from the spindle control pin. For example with a 10 V drive voltage and a 10000 RPM scalemax a value of 10,000 RPM on the spinout pin would produce 10 V output. However, if spinout-maxlim were set to 5,000 RPM then no voltage above 5 V would be output.

(float rw) .7i77.0.0.analogoutN-maxlim: (N = 0 to 5) The maximum speed request allowable

(float rw) .7i77.0.0.analogoutN-minlim: (N = 0 to 5) The minimum speed request.

(float rw) .7i77.0.0.analogoutN-scalemax: (N = 0 to 5) The analog speed scaling. This is the speed request which would correspond to full-scale output from the spindle control pin. For example with a 10 V drive voltage and a 10000 RPM scalemax a value of 10,000 RPM on the spinout pin would produce 10 V output. However, if spinout-maxlim were set to 5,000 RPM then no voltage above 5 V would be output.

### 7I69
The 7I69 is a 48 channel digital IO card. It can be configured in four different modes:

MODE 0: Bidirectional mode (48 bits in 48 bits out)

MODE 1: Input only mode (48 bits in)

MODE 2: Output only mode (48 bits out)

MODE 3: 24/24mode (24 bits in = bits 0..23 and 24 bits out = bits 24..47)

MODE 4: Bidirectional mode (48 bits in 48 bits out) plus 4 MPG encoder channels oninputs 0 through 7

Pins:

(bit in) .7i69.0.0.output-NN: Digital output. Sense can be inverted with the corresponding Parameter.

(bit out) .7i69.0.0.input-NN: Digital input

(bit out) .7i69.0.0.input-NN-not: Digital input, inverted.

Parameters:

(u32 ro) .7i69.0.0.nvbaudrate: Indicates the vbaud rate. This probably should not be altered.

(u32 ro) .7i69.0.0.nvunitnumber: Indicates the serial number of the device and should match a sticker on the card. This can be useful for working out which card is which.

(u32 ro) .7i69.0.0.nvwatchdogtimeout: The sserial remote watchdog timeout. This is separate from the Anything-IO card timeout. This is unlikely to need to be changed.

(bit rw) .7i69.0.0.output-NN-invert: Invert the sense of the corresponding output pin.

(u32 ro) .7i69.0.0.swrevision: The onboard firmware revision number. Utilities exist to update and change this firmware.

### 7I70
The 7I70 is a remote isolated 48 input card. The 7I70 inputs sense positive inputs relative to a common field ground. Input impedance is 10 kΩ and input voltage can range from 5 VDC to 32 VDC. All inputs have LED status indicators. The input common field ground is galvanically isolated from the communications link.

The 7I70 has three software selectable modes. These different modes select different sets of 7I70 data to be transferred between the host and the 7I70 during real time process data exchanges. For high speed applications, choosing the correct mode can reduced the data transfer sizes, resulting in higher maximum update rates.

MODE 0: Input mode (48 bits input data only

MODE 1: Input plus analog mode (48 bits input data plus 6 channels of analog data)

MODE 2: Input plus field voltage

Pins:

(float out) .7i70.0.0.analogN (modes 1 and 2 only) Analogue input values.

(float out) .7i70.0.0.fieldvoltage (mode 2 only) Field voltage monitoring pin.

(bit out) .7i70.0.0.input-NN: (NN = 0 to 47) 48 digital inputs.

(bit in) .7i70.0.0.input-NN-not: (NN = 0 to 47) An inverted copy of the inputs provided for convenience. The two complementary pins may be connected to different signal nets.

Parameters:

(u32 ro) .7i70.0.0.nvbaudrate: Indicates the vbaud rate. This probably should not be altered.

(u32 ro) .7i70.0.0.nvunitnumber: Indicates the serial number of the device and should match a sticker on the card. This can be useful for working out which card is which.

(u32 ro) .7i70.0.0.nvwatchdogtimeout: The sserial remote watchdog timeout. This is separate from the Anything-IO card timeout. This is unlikely to need to be changed.

(u32 ro) .7i69.0.0.swrevision: The onboard firmware revision number. Utilities exist to update and change this firmware.

### 7I71
The 7I71 is a remote isolated 48 output card. The 48 outputs are 8VDC to 28VDC sourcing drivers (common + field power) with 300 mA maximum current capability. All outputs have LED status indicators.

The 7I71 has two software selectable modes. For high speed applications, choosing the correct mode can reduced the data transfer sizes, resulting in higher maximum update rates

MODE 0: Output only mode (48 bits output data only)

MODE 1: Outputs plus read back field voltage

Pins:

(float out) .7i71.0.0.fieldvoltage (mode 2 only) Field voltage monitoring pin.

(bit out) .7i71.0.0.output-NN: (NN = 0 to 47) 48 digital outputs. The sense may be inverted by the invert parameter.

Parameters:

(bit rw) .7i71.0.0.output-NN-invert: Invert the sense of the corresponding output pin.

(u32 ro) .7i71.0.0.nvbaudrate: Indicates the vbaud rate. This probably should not be altered.

(u32 ro) .7i71.0.0.nvunitnumber: Indicates the serial number of the device and should match a sticker on the card. This can be useful for determining which card is which.

(u32 ro) .7i71.0.0.nvwatchdogtimeout: The sserial remote watchdog timeout. This is separate from the Anything-IO card timeout. This is unlikely to need to be changed.

(u32 ro) .7i69.0.0.swrevision: The onboard firmware revision number. Utilities exist to update and change this firmware.

### 7I73
The 7I73 is a remote real time pendant or control panel interface.

The 7I73 supports up to four 50 kHz encoder inputs for MPGs, 8 digital inputs and 6 digital outputs and up to a 64 Key keypad. If a smaller keypad is used, more digital inputs and outputs become available. Up to eight 0.0 V to 3.3 V analog inputs are also provided. The 7I73 can drive a 4 line 20 character LCD for local DRO applications.

The 7I73 has 3 software selectable process data modes. These different modes select different sets of 7I73 data to be transferred between the host and the 7I73 during real time process data exchanges. For high speed applications, choosing the correct mode can reduced the data transfer sizes, resulting in higher maximum update rates

MODE 0: I/O + ENCODER

MODE 1: I/O + ENCODER + ANALOG IN

MODE 2: I/O + ENCODER + ANALOG IN FAST DISPLAY

Pins:

(float out) .7i73.0.0.analoginN: Analogue inputs. Up to 8 channels may be available dependent on software and hardware configuration modes (see the PDF manual downloadable from www.mesanet.com).

(u32 in) .7i73.0.1.display (modes 1 and 2). Data for LCD display. This pin may be conveniently driven by the HAL "lcd" component which allows the formatted display of the values any number of HAL pins and textual content.

(u32 in) .7i73.0.1.display32 (mode 2 only). 4 bytes of data for LCD display. This mode is not supported by the HAL "lcd" component.

(s32 out) .7i73.0.1.encN: The position of the MPG encoder counters.

(bit out) .7i73.0.1.input-NN: Up to 24 digital inputs (dependent on config)

(bit out) .7i73.0.1.input-NN-not: Inverted copy of the digital inputs

(bit in) .7i73.0.1.output-NN: Up to 22 digital outputs (dependent on config)

Parameters:

(u32 ro) .7i73.0.1.nvanalogfilter

(u32 ro) .7i73.0.1.nvbaudrate

(u32 ro) .7i73.0.1.nvcontrast

(u32 ro) .7i73.0.1.nvdispmode

(u32 ro) .7i73.0.1.nvencmode0

(u32 ro) .7i73.0.1.nvencmode1

(u32 ro) .7i73.0.1.nvencmode2

(u32 ro) .7i73.0.1.nvencmode3

(u32 ro) .7i73.0.1.nvkeytimer

(u32 ro) .7i73.0.1.nvunitnumber

(u32 ro) .7i73.0.1.nvwatchdogtimeout

(u32 ro) .7i73.0.1.output-00-invert

For further details of the use of the above see the Mesa manual.

(bit rw) .7i73.0.1.output-01-invert: Invert the corresponding output bit.

(s32 ro) .7i73.0.1.swrevision: The version of firmware installed.


stepgen

package: linuxcnc

title: stepgen(9)

summary: software step pulse generation

text:
# stepgen(9)

## NAME
stepgen - software step pulse generation

## SYNOPSIS
loadrt stepgen step_type=type0[,type1...] [ctrl_type=type0[,type1...]] [user_step_type=#,#...]

## DESCRIPTION
stepgen is used to control stepper motors. The maximum step rate depends on the CPU and other factors, and is usually in the range of 5 kHz to 25 kHz. If higher rates are needed, a hardware step generator is a better choice.

stepgen has two control modes, which can be selected on a channel by channel basis using ctrl_type. Possible values are "p" for position control, and "v" for velocity control. The default is position control, which drives the motor to a commanded position, subject to acceleration and velocity limits. Velocity control drives the motor at a commanded speed, again subject to accel and velocity limits. Usually, position mode is used for machine axes. Velocity mode is reserved for unusual applications where continuous movement at some speed is desired, instead of movement to a specific position. (Note that velocity mode replaces the former component freqgen.)

stepgen can control a maximum of 16 motors. The number of motors/channels actually loaded depends on the number of type values given. The value of each type determines the outputs for that channel. Position or velocity mode can be individually selected for each channel. Both control modes support the same 16 possible step types.

By far the most common step type is '0', standard step and direction. Others include up/down, quadrature, and a wide variety of three, four, and five phase patterns that can be used to directly control some types of motor windings. (When used with appropriate buffers of course.)

Some of the stepping types are described below, but for more details (including timing diagrams) see the stepgen section of the HAL reference manual.

type 0: step/dir

Two pins, one for step and one for direction. make-pulses must run at least twice for each step (once to set the step pin true, once to clear it). This limits the maximum step rate to half (or less) of the rate that can be reached by types 2-14. The parameters steplen and stepspace can further lower the maximum step rate. Parameters dirsetup and dirhold also apply to this step type.

type 1: up/down

Two pins, one for 'step up' and one for 'step down'. Like type 0, make-pulses must run twice per step, which limits the maximum speed.

type 2: quadrature

Two pins, phase-A and phase-B. For forward motion, A leads B. Can advance by one step every time make-pulses runs.

type 3: three phase, full step

Three pins, phase-A, phase-B, and phase-C. Three steps per full cycle, then repeats. Only one phase is high at a time - for forward motion the pattern is A, then B, then C, then A again.

type 4: three phase, half step

Three pins, phases A through C. Six steps per full cycle. First A is high alone, then A and B together, then B alone, then B and C together, etc.

types 5 through 8: four phase, full step

Four pins, phases A through D. Four steps per full cycle. Types 5 and 6 are suitable for use with unipolar steppers, where power is applied to the center tap of each winding, and four open-collector transistors drive the ends. Types 7 and 8 are suitable for bipolar steppers, driven by two H-bridges.

types 9 and 10: four phase, half step

Four pins, phases A through D. Eight steps per full cycle. Type 9 is suitable for unipolar drive, and type 10 for bipolar drive.

types 11 and 12: five phase, full step

Five pins, phases A through E. Five steps per full cycle. See HAL reference manual for the patterns.

types 13 and 14: five phase, half step

Five pins, phases A through E. Ten steps per full cycle. See HAL reference manual for the patterns.

type 15: user-specified

This uses the waveform specified by the user_step_type module parameter, which may have up to 10 steps and 5 phases.

## FUNCTIONS
stepgen.make-pulses (no floating-point)

Generates the step pulses, using information computed by update-freq. Must be called as frequently as possible, to maximize the attainable step rate and minimize jitter. Operates on all channels at once.

stepgen.capture-position (uses floating point)

Captures position feedback value from the high speed code and makes it available on a pin for use elsewhere in the system. Operates on all channels at once.

stepgen.update-freq (uses floating point)

Accepts a velocity or position command and converts it into a form usable by make-pulses for step generation. Operates on all channels at once.

## PINS
stepgen.N.counts s32 out

The current position, in counts, for channel N. Updated by capture-position.

stepgen.N.position-fb float out

The current position, in length units (see parameter position-scale). Updated by capture-position. The resolution of position-fb is much finer than a single step. If you need to see individual steps, use counts.

stepgen.N.enable bit in

Enables output steps - when false, no steps are generated.

stepgen.N.velocity-cmd float in (velocity mode only)

Commanded velocity, in length units per second (see parameter position-scale).

stepgen.N.position-cmd float in (position mode only)

Commanded position, in length units (see parameter position-scale).

stepgen.N.step bit out (step type 0 only)

Step pulse output.

stepgen.N.dir bit out (step type 0 only)

Direction output: low for forward, high for reverse.

stepgen.N.up bit out (step type 1 only)

Count up output, pulses for forward steps.

stepgen.N.down bit out (step type 1 only)

Count down output, pulses for reverse steps.

stepgen.N.phase-A thru phase-E bit out (step types 2-14 only)

Output bits. phase-A and phase-B are present for step types 2-14, phase-C for types 3-14, phase-D for types 5-14, and phase-E for types 11-14. Behavior depends on selected stepping type.

## PARAMETERS
stepgen.N.frequency float ro

The current step rate, in steps per second, for channel N.

stepgen.N.maxaccel float rw

The acceleration/deceleration limit, in length units per second squared.

stepgen.N.maxvel float rw

The maximum allowable velocity, in length units per second. If the requested maximum velocity cannot be reached with the current combination of scaling and make-pulses thread period, it will be reset to the highest attainable value.

stepgen.N.position-scale float rw

The scaling for position feedback, position command, and velocity command, in steps per length unit.

stepgen.N.rawcounts s32 ro

The position in counts, as updated by make-pulses. (Note: this is updated more frequently than the counts pin.)

stepgen.N.steplen u32 rw

The length of the step pulses, in nanoseconds. Measured from rising edge to falling edge.

stepgen.N.stepspace u32 rw (step types 0 and 1 only)

The minimum space between step pulses, in nanoseconds. Measured from falling edge to rising edge. The actual time depends on the step rate and can be much longer. If stepspace is 0, then step can be asserted every period. This can be used in conjunction with hal_parport's auto-resetting pins to output one step pulse per period. In this mode, steplen must be set for one period or less.

stepgen.N.dirsetup u32 rw (step type 0 only)

The minimum setup time from direction to step, in nanoseconds periods. Measured from change of direction to rising edge of step.

stepgen.N.dirhold u32 rw (step type 0 only)

The minimum hold time of direction after step, in nanoseconds. Measured from falling edge of step to change of direction.

stepgen.N.dirdelay u32 rw (step types 1 and higher only)

The minimum time between a forward step and a reverse step, in nanoseconds.

## TIMING
There are five timing parameters which control the output waveform. No step type uses all five, and only those which will be used are exported to HAL. The values of these parameters are in nano-seconds, so no recalculation is needed when changing thread periods. In the timing diagrams that follow, they are identified by the following numbers:

(1) stepgen.n.steplen

(2) stepgen.n.stepspace

(3) stepgen.n.dirhold

(4) stepgen.n.dirsetup

(5) stepgen.n.dirdelay

For step type 0, timing parameters 1 thru 4 are used. The following timing diagram shows the output waveforms, and what each parameter adjusts.

_____ _____ _____

STEP ____/ \_______/ \_____________/ \______

| | | | | |

Time |-(1)-|--(2)--|-(1)-|--(3)--|-(4)-|-(1)-|

|__________________

DIR ________________________________/

For step type 1, timing parameters 1, 2, and 5 are used. The following timing diagram shows the output waveforms, and what each parameter adjusts.

_____ _____

UP __/ \_____/ \________________________________

| | | | |

Time |-(1)-|-(2)-|-(1)-|---(5)---|-(1)-|-(2)-|-(1)-|

|_____| |_____|

DOWN ______________________________/ \_____/ \____

For step types 2 and higher, the exact pattern of the outputs depends on the step type (see the HAL manual for a full listing). The outputs change from one state to another at a minimum interval of steplen. When a direction change occurs, the minimum time between the last step in one direction and the first in the other direction is the sum of steplen and dirdelay.

## SEE ALSO
The HAL User Manual.


steptest

title: steptest(9)

text:
# steptest(9)

## NAME
steptest - Used by Stepconf to allow testing of acceleration and velocity values for an axis.

## SYNOPSIS
loadrt steptest [count=N|names=name1[,name2...]]

## FUNCTIONS
steptest.N (requires a floating-point thread)

## PINS
steptest.N.jog-minus bit in

Drive TRUE to jog the axis in its minus direction

steptest.N.jog-plus bit in

Drive TRUE to jog the axis in its positive direction

steptest.N.run bit in

Drive TRUE to run the axis near its current position_fb with a trapezoidal velocity profile

steptest.N.maxvel float in

Maximum velocity

steptest.N.maxaccel float in

Permitted Acceleration

steptest.N.amplitude float in

Approximate amplitude of positions to command during 'run'

steptest.N.dir s32 in

Direction from central point to test: 0 = both, 1 = positive, 2 = negative

steptest.N.position-cmd float out

steptest.N.position-fb float in

steptest.N.running bit out

steptest.N.run-target float out

steptest.N.run-start float out

steptest.N.run-low float out

steptest.N.run-high float out

steptest.N.pause s32 in (default: 0)

pause time for each end of run in seconds

## PARAMETERS
steptest.N.epsilon float rw (default: .001)

steptest.N.elapsed float r

Current value of the internal timer

## AUTHOR
Jeff Epler

## LICENSE
GPL


streamer

title: streamer(9)

summary: stream file data into HAL in real time

text:
# streamer(9)

## NAME
streamer - stream file data into HAL in real time

## SYNOPSIS
loadrt streamer depth=depth1[,depth2...] cfg=string1[,string2...]

## DESCRIPTION
streamer and halstreamer(1) are used together to stream data from a file into the HAL in real time. streamer is a realtime HAL component that exports HAL pins and creates a FIFO in shared memory. hal_streamer is a non-realtime program that copies data from stdin into the FIFO, so that streamer can write it to the HAL pins.

## OPTIONS
depth=depth1[,depth2...]

Sets the depth of the FIFO that the realtime streamer creates to receive data from the non-realtime hal-streamer. Multiple values of depth (separated by commas) can be specified if you need more than one FIFO (for example if you want to stream data to two different realtime threads).

cfg=string1[,string2...]

Defines the set of HAL pins that streamer exports and later writes data to. One string must be supplied for each FIFO, separated by commas. streamer exports one pin for each character in string. Legal characters are:

•F, f (float pin)

•B, b (bit pin)

•S, s (s32 pin)

•U, u (u32 pin)

## FUNCTIONS
streamer.N

One function is created per FIFO, numbered from zero.

## PINS
streamer.N.pin.M output

Data from column M of the data in FIFO N appears on this pin. The pin type depends on the config string.

streamer.N.curr-depth s32 output

Current number of samples in the FIFO. When this reaches zero, new data will no longer be written to the pins.

streamer.N.empty bit output

TRUE when the FIFO N is empty, FALSE when valid data is available.

streamer.N.enable bit input

When TRUE, data from FIFO N is written to the HAL pins. When false, no data is transferred. Defaults to TRUE.

streamer.N.underruns s32 read/write

The number of times that sampler has tried to write data to the HAL pins but found no fresh data in the FIFO. It increments whenever empty is true, and can be reset by the setp command.

streamer.N.*clock bit input

Clock for data as specified by the clock-mode pin

streamer.N.*clock-mode s32 input

Defines behavior of clock pin:

•0 (default) free run at every iteration

•1 clock on falling edge of clock pin

•2 clock on rising edge of clock pin

•3 clock on any edge of clock pin

## SEE ALSO
halstreamer(1), sampler(9), halsampler(1)

## BUGS
Should an enable HAL pin be added, to allow streaming to be turned on and off?

## AUTHOR
Original version by John Kasunich, as part of the LinuxCNC project. Improvements by several other members of the LinuxCNC development team.

## REPORTING BUGS
Report bugs to jmkasunich AT users DOT sourceforge DOT net

## COPYRIGHT
Copyright © 2006 John Kasunich. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


title: sum2(9)

text:
# sum2(9)

## NAME
sum2 - Sum of two inputs (each with a gain) and an offset

## SYNOPSIS
loadrt sum2 [count=N|names=name1[,name2...]]

## FUNCTIONS
sum2.N (requires a floating-point thread)

## PINS
sum2.N.in0 float in

sum2.N.in1 float in

sum2.N.out float out

out = in0 * gain0 + in1 * gain1 + offset

## PARAMETERS
sum2.N.gain0 float rw (default: 1.0)

sum2.N.gain1 float rw (default: 1.0)

sum2.N.offset float rw

## SEE ALSO
scaled_s32_sums(9), weighted_sum(9)

## AUTHOR
Jeff Epler

## LICENSE
GPL


supply

title: supply(9)

text:
# supply(9)

## NAME
supply - set output pins with values from parameters (obsolete)

## SYNOPSIS
loadrt supply num_chan=num

## DESCRIPTION
supply was used to allow the inputs of other HAL components to be manipulated for testing purposes. When it was written, the only way to set the value of an input pin was to connect it to a signal and connect that signal to an output pin of some other component, and then let that component write the pin value. supply was written to be that "other component". It reads values from parameters (set with the HAL command setp) and writes them to output pins.

Since supply was written, the setp command has been modified to allow it to set unconnected pins as well as parameters. In addition, the sets command was added, which can directly set HAL signals, as long as there are no output pins connected to them. Therefore, supply is obsolete.

supply 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
supply.N.update (uses floating-point)

Updates output pins for channel N.

## PINS
supply.N.q bit out

Output bit, copied from parameter supply.N.d.

supply.N._q bit out

Output bit, inverted copy of parameter supply.N.d.

supply.N.variable float out

Analog output, copied from parameter supply.N.value.

supply.N._variable float out

Analog output, equal to -1.0 times parameter supply.N.value.

supply.N.d bit rw

Data source for q and _q output pins.

supply.N.value bit rw

Data source for variable and _variable output pins.


thc

title: thc(9)

summary: Torch Height Control

text:
# thc(9)

## NAME
thc - Torch Height Control

## SYNOPSIS
loadrt thc

## DESCRIPTION
Torch Height Control Mesa THC > Encoder > LinuxCNC THC component

The Mesa THC sends a frequency based on the voltage detected to the encoder. The velocity from the encoder is converted to volts with the velocity scale parameter inside the THC component.

The THCAD card sends a frequency at 0 volts so the scale offset parameter is used to zero the calculated voltage.

Component Functions If enabled and torch is on and X + Y velocity is within tolerance of set speed allow the THC to offset the Z axis as needed to maintain voltage.

If enabled and torch is off and the Z axis is moving up remove any correction at a rate not to exceed the rate of movement of the Z axis.

If enabled and torch is off and there is no correction pass the Z position and feed back untouched.

If not enabled pass the Z position and feed back untouched.

Physical Connections

Plasma Torch Arc Voltage Signal => 6 x 487k 1% resistors => THC Arc Voltage In

THC Frequency Signal => Encoder #0, pin A (Input)

Plasma Torch Arc OK Signal => input pin

output pin => Plasma Torch Start Arc Contacts

HAL Plasma Connections

encoder.nn.velocity => thc.encoder-vel (tip voltage)

spindle.0.on => output pin (start the arc)

thc.arc-ok <= motion.digital-in-00 <= input pin (arc ok signal)

HAL Motion Connections

thc.requested-vel <= motion.requested-vel

thc.current-vel <= motion.current-vel

## FUNCTIONS
thc (requires a floating-point thread)

## PINS
thc.encoder-vel float in

Connect to hm2_5i20.0.encoder.00.velocity

thc.current-vel float in

Connect to motion.current-vel

thc.requested-vel float in

Connect to motion.requested-vel

thc.volts-requested float in

Tip Volts current_vel >= min_velocity requested

thc.vel-tol float in

Velocity Tolerance (Corner Lock)

thc.torch-on bit in

Connect to spindle.N.on

thc.arc-ok bit in

Arc OK from Plasma Torch

thc.enable bit in

Enable the THC, if not enabled Z position is passed through

thc.z-pos-in float in

Z Motor Position Command in from axis.n.motor-pos-cmd

thc.z-pos-out float out

Z Motor Position Command Out

thc.z-fb-out float out

Z Position Feedback to Axis

thc.volts float out

The Calculated Volts

thc.vel-status bit out

When the THC thinks we are at requested speed

thc.offset-value float out

The Current Offset

## PARAMETERS
thc.vel-scale float rw

The scale to convert the Velocity signal to Volts

thc.scale-offset float rw

The offset of the velocity input at 0 volts

thc.velocity-tol float rw

The deviation percent from planned velocity

thc.voltage-tol float rw

The deviation of Tip Voltage before correction takes place

thc.correction-vel float rw

The amount of change in user units per period to move Z to correct

## AUTHOR
John Thornton

## LICENSE
GPLv2 or greater


thcud

title: thcud(9)

summary: Torch Height Control Up/Down Input

text:
# thcud(9)

## NAME
thcud - Torch Height Control Up/Down Input

## SYNOPSIS
loadrt thcud

## DESCRIPTION
Torch Height Control This THC takes either an up or a down input from a THC

If enabled and torch is on and X + Y velocity is within tolerance of set speed allow the THC to offset the Z axis as needed to maintain voltage.

If enabled and torch is off and the Z axis is moving up remove any correction at a rate not to exceed the rate of movement of the Z axis.

If enabled and torch is off and there is no correction pass the Z position and feed back untouched.

If not enabled pass the Z position and feed back untouched.

Typical Physical Connections using a Parallel Port

Parallel Pin 12 <= THC controller Plasma Up

Parallel Pin 13 <= THC controller Plasma Down

Parallel Pin 15 <= Plasma Torch Arc Ok Signal

Parallel Pin 16 => Plasma Torch Start Arc Contacts

HAL Plasma Connections

net torch-up thcud.torch-up <= parport.0.pin-12-in

net torch-down thcud.torch-down <= parport.0.pin-13-in

net torch-on spindle.0.on => parport.0.pin-16-out (start the arc)

net arc-ok thcud.arc-ok <= motion.digital-in-00 <= parport.0.pin-15-in (arc ok signal)

HAL Motion Connections

net requested-vel thcud.requested-vel <= motion.requested-vel

net current-vel thcud.current-vel <= motion.current-vel

PyVCP Connections In the XML file you need something like:

<pyvcp>

<checkbutton>

<text>"THC Enable"</text>

<halpin>"thc-enable"</halpin>

</checkbutton>

</pyvcp>

Connect the PyVCP pins in the postgui.hal file like this:

net thc-enable thcud.enable <= pyvcp.thc-enable

## FUNCTIONS
thcud (requires a floating-point thread)

## PINS
thcud.torch-up bit in

Connect to an input pin

thcud.torch-down bit in

Connect to input pin

thcud.current-vel float in

Connect to motion.current-vel

thcud.requested-vel float in

Connect to motion.requested-vel

thcud.torch-on bit in

Connect to spindle.N.on

thcud.arc-ok bit in

Arc Ok from Plasma Torch

thcud.enable bit in

Enable the THC, if not enabled Z position is passed through

thcud.z-pos-in float in

Z Motor Position Command in from axis.n.motor-pos-cmd

thcud.z-pos-out float out

Z Motor Position Command Out

thcud.z-fb-out float out

Z Position Feedback to Axis

thcud.cur-offset float out

The Current Offset

thcud.vel-status bit out

When the THC thinks we are at requested speed

thcud.removing-offset bit out

Pin for testing

thcud.correction-vel float in

The Velocity to move Z to correct

## PARAMETERS
thcud.velocity-tol float rw

The deviation percent from planned velocity

## AUTHOR
John Thornton

## LICENSE
GPLv2 or greater


threads

title: threads(9)

summary: creates hard realtime HAL threads

text:
# threads(9)

## NAME
threads - creates hard realtime HAL threads

## SYNOPSIS
loadrt threads name1=name period1=period [fp1=<0|1>] [<thread-2-info>] [<thread-3-info>]

## DESCRIPTION
threads is used to create hard realtime threads which can execute HAL functions at specific intervals. It is not a true HAL component, in that it does not export any functions, pins, or parameters of its own. Once it has created one or more threads, the threads stand alone, and the threads component can be unloaded without affecting them. In fact, it can be unloaded and then reloaded to create additional threads, as many times as needed.

threads can create up to three realtime threads. Threads must be created in order, from fastest to slowest. Each thread is specified by three arguments. name1 is used to specify the name of the first thread (thread 1). period1 is used to specify the period of thread 1 in nanoseconds. Both name and period are required. The third argument, fp1 is optional, and is used to specify if thread 1 will be used to execute floating point code. If not specified, it defaults to 1, which means that the thread will support floating point. Specify 0 to disable floating point support, which saves a small amount of execution time by not saving the FPU context. For additional threads, name2, period2, fp2, name3, period3, and fp3 work exactly the same. If more than three threads are needed, unload threads, then reload it to create more threads.

## FUNCTIONS
None

## PINS
None

## PARAMETERS
None

## BUGS
The existence of threads might be considered a bug. Ideally, creation and deletion of threads would be done directly with halcmd commands, such as "newthread name period", "delthread name", or similar. However, limitations in the current HAL implementation require thread creation to take place in kernel space, and loading a component is the most straightforward way to do that.


threadtest

title: threadtest(9)

text:
# threadtest(9)

## NAME
threadtest - LinuxCNC HAL component for testing thread behavior

## SYNOPSIS
loadrt threadtest [count=N|names=name1[,name2...]]

## FUNCTIONS
threadtest.N.increment

threadtest.N.reset

## PINS
threadtest.N.count u32 out

## AUTHOR
Jeff Epler

## LICENSE
GPL


time

title: time(9)

summary: Time on in Hours, Minutes, Seconds

text:
# time(9)

## NAME
time - Time on in Hours, Minutes, Seconds

## SYNOPSIS
loadrt time [count=N|names=name1[,name2...]]

## DESCRIPTION
Time

When either the time.N.start or time.N.pause bits goes true the cycle timer resets and starts to time until time.N.start AND time.N.pause go false. When the time.N.pause bit goes true timing is paused until time.N.pause goes false. If you connect time.N.start to halui.program.is-running and leave time.N.pause unconnected the timer will reset during a pause. See the example connections below for more information.

Time returns the hours, minutes, and seconds that time.N.start is true.

Sample PyVCP code to display the hours:minutes:seconds.

<pyvcp>

<hbox>

<text>"Cycle Time"</text>

("Helvetica",14)

<u32>

<halpin>"time-hours"</halpin>

("Helvetica",14)

<format>"2d"</format>

</u32>

<text>":"</text>

("Helvetica",14)

<u32>

<halpin>"time-minutes"</halpin>

("Helvetica",14)

<format>"2d"</format>

</u32>

<text>":"</text>

("Helvetica",14)

<u32>

<halpin>"time-seconds"</halpin>

("Helvetica",14)

<format>"2d"</format>

</u32>

</hbox> </pyvcp>

In your post-gui.hal file you might use one of the following to connect this timer:

For a new config:

loadrt time

addf time.0 servo-thread

net cycle-timer time.0.start <= halui.program.is-running

net cycle-timer-pause time.0.pause <= halui.program.is-paused

net cycle-seconds pyvcp.time-seconds <= time.0.seconds

net cycle-minutes pyvcp.time-minutes <= time.0.minutes

net cycle-hours pyvcp.time-hours <= time.0.hours

Previous to this version if you wanted the timer to continue running

during a pause instead of resetting, you had to use a HAL NOT component

to invert the halui.program.is-idle pin and connect to time.N.start as

shown below:

loadrt time

loadrt not

addf time.0 servo-thread

addf not.0 servo-thread

net prog-running not.0.in <= halui.program.is-idle

net cycle-timer time.0.start <= not.0.out

net cycle-seconds pyvcp.time-seconds <= time.0.seconds

net cycle-minutes pyvcp.time-minutes <= time.0.minutes

net cycle-hours pyvcp.time-hours <= time.0.hours

For those who have this setup already, you can simply add a net connecting

time.N.pause to halui.program.is-paused:

net cycle-timer-pause time.0.pause <= halui.program.is-paused

## FUNCTIONS
time.N (requires a floating-point thread)

## PINS
time.N.start bit in

Timer On

time.N.pause bit in (default: 0)

Pause

time.N.seconds u32 out

Seconds

time.N.minutes u32 out

Minutes

time.N.hours u32 out

Hours

## AUTHOR
John Thornton, itaib, Moses McKnight

## LICENSE
GPL


timedelay

title: timedelay(9)

summary: The equivalent of a time-delay relay

text:
# timedelay(9)

## NAME
timedelay - The equivalent of a time-delay relay

## SYNOPSIS
loadrt timedelay [count=N|names=name1[,name2...]]

## FUNCTIONS
timedelay.N (requires a floating-point thread)

## PINS
timedelay.N.in bit in

timedelay.N.out bit out

Follows the value of in after applying the delays on-delay and off-delay.

timedelay.N.on-delay float in (default: 0.5)

The time, in seconds, for which in must be true before out becomes true

timedelay.N.off-delay float in (default: 0.5)

The time, in seconds, for which in must be false before out becomes false

timedelay.N.elapsed float out

Current value of the internal timer

## AUTHOR
Jeff Epler, based on works by Stephen Wille Padnos and John Kasunich

## LICENSE
GPL


timedelta

title: timedelta(9)

text:
# timedelta(9)

## NAME
timedelta - LinuxCNC HAL component that measures thread scheduling timing behavior

## SYNOPSIS
loadrt timedelta [count=N|names=name1[,name2...]]

## FUNCTIONS
timedelta.N

## PINS
timedelta.N.jitter s32 out (default: 0)

Worst-case scheduling error (in ns). This is the largest discrepancy between ideal thread period, and actual time between sequential runs of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter.

timedelta.N.current-jitter s32 out (default: 0)

Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter.

timedelta.N.current-error s32 out (default: 0)

Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This does not use the absolute value of the error, so 'got run too early' shows up as negative error and 'got run too late' shows up as positive error.

timedelta.N.min s32 out (default: 0)

Minimum time (in ns) between sequential runs of this component.

timedelta.N.max s32 out (default: 0)

Maximum time (in ns) between sequential runs of this component.

timedelta.N.reset bit in

Set this pin to True, then back to False, to reset some of the statistics.

timedelta.N.out s32 out

Time (in ns) since the previous run of this component. This should ideally be equal to the thread period.

timedelta.N.err s32 out (default: 0)

Cumulative time error (in ns). Probably not useful.

timedelta.N.avg-err float out (default: 0)

The average scheduling error (in ns).

## AUTHOR
Jeff Epler

## LICENSE
GPL


tof

title: tof(9)

text:
# tof(9)

## NAME
tof - IEC TOF timer - delay falling edge on a signal

## SYNOPSIS
loadrt tof [count=N|names=name1[,name2...]]

## FUNCTIONS
tof.N (requires a floating-point thread)

Update the timer

## PINS
tof.N.in bit in

Input signal

tof.N.q bit out

Output signal

tof.N.et float out

Elapsed time since falling edge in seconds

## PARAMETERS
tof.N.pt float rw

Delay time in seconds

## AUTHOR
Chad Woitas

## LICENSE
GPL


toggle

title: toggle(9)

text:
# toggle(9)

## NAME
toggle - 'push-on, push-off' from momentary pushbuttons

## SYNOPSIS
loadrt toggle [count=N|names=name1[,name2...]]

## DESCRIPTION

┐ ┏──┐ ┏──┐

in : └─────┛ └────────┛ └──

┐ ┌───────────┐

out: └─────┘ └─────

## FUNCTIONS
toggle.N

## PINS
toggle.N.in bit in

button input

toggle.N.out bit io

on/off output

## PARAMETERS
toggle.N.debounce u32 rw (default: 2)

debounce delay in periods

## AUTHOR
John Kasunich

## LICENSE
GPL


title: toggle2nist(9)

summary: toggle button to nist logic

text:
# toggle2nist(9)

## NAME
toggle2nist - toggle button to nist logic

## SYNOPSIS
loadrt toggle2nist [count=N|names=name1[,name2...]]

## DESCRIPTION
Toggle2nist can be used with a momentary push button to control a device that has separate on and off inputs and an is-on output.

• On a rising edge on pin in when is-on is low: It sets on until is-on becomes high.

• On a rising edge on pin in when is-on is high: It sets off until is-on becomes low.

┐ ┏─────xxxxxxxxxxxx┐ ┏─────xxxxxxxxxxxx┐

in : └─────┛ xxxxxxxxxxxx└───────────┛ xxxxxxxxxxxx└─────

┐ ┌───────────┐

on : └─────┘ └─────────────────────────────────────────

┐ ┌───────────┐

off : └───────────────────────────────────┘ └───────────

┐ ┌─────────────────────────────┐

is-on: └─────────────────┘ └───────────

## FUNCTIONS
toggle2nist.N

## PINS
toggle2nist.N.in bit in

toggle2nist.N.is-on bit in

toggle2nist.N.on bit out

toggle2nist.N.off bit out

## AUTHOR
Anders Wallin

## LICENSE
GPL


ton

title: ton(9)

text:
# ton(9)

## NAME
ton - IEC TON timer - delay rising edge on a signal

## SYNOPSIS
loadrt ton [count=N|names=name1[,name2...]]

## FUNCTIONS
ton.N (requires a floating-point thread)

Update the timer

## PINS
ton.N.in bit in

Input signal

ton.N.q bit out

Output signal

ton.N.et float out

Elapsed time since rising edge in seconds

## PARAMETERS
ton.N.pt float rw

Delay time in seconds

## AUTHOR
Chad Woitas

## LICENSE
GPL


tp

title: tp(9)

text:
# tp(9)

## NAME
tp - IEC TP timer - generate a high pulse of defined duration on rising edge

## SYNOPSIS
loadrt tp [count=N|names=name1[,name2...]]

## FUNCTIONS
tp.N (requires a floating-point thread)

Update the timer

## PINS
tp.N.in bit in

Input signal

tp.N.q bit out

Output signal

tp.N.et float out

Elapsed time since start of pulse in seconds

## PARAMETERS
tp.N.pt float rw

Pulse time in seconds

## AUTHOR
Chad Woitas

## LICENSE
GPL


tpcomp

title: tpcomp(9)

text:
# tpcomp(9)

## NAME
tpcomp - Trajectory Planning (tp) module skeleton

## SYNOPSIS
Custom Trajectory Planning module loaded with [TRAJ]TPMOD=tpcomp

## DESCRIPTION
Example of a trajectory planning (tp) module buildable with halcompile.

The tpcomp.comp file (src/hal/components/tpcomp.comp) illustrates a method to use halcompile to build a trajectory planning module based on the files used for the default trajectory planner (tpmod).

The example tpcomp.comp is not usable until modified for the user environment. To create a runnable tpcomp module, the tpcomp.comp file must be edited to supply 1) a valid '#define TOPDIR' and 2) references to valid source code file names for all files used.

To avoid updates that overwrite tpcomp.comp, best practice is to rename the file and its component name (example: user_tpcomp.comp creates module: user_tpcomp).

The (renamed) component can be built and installed with halcompile and then substituted for the default tp module (tpmod) using:

$ linuxcnc -t user_tpcomp someconfig.ini

or by inifile setting: [TRAJ]TPMOD=user_tpcomp

Note:If using a deb install:

1) halcompile is provided by the deb package linuxcnc-dev

2) This source file for BRANCHNAME (master,2.9,etc) is downloadable from github:

https://github.com/LinuxCNC/linuxcnc/blob/BRANCHNAME/src/hal/components/tpcomp.comp

## PINS
tpcomp.N.is-module bit out (default: 1)

## AUTHOR
Dewey Garrett

## LICENSE
GPL


tripodkins

title: tripodkins(9)

text:
# tripodkins(9)

See the file man9/kins.9.


title: tristate_bit(9)

text:
# tristate_bit(9)

## NAME
tristate_bit - Place a signal on an I/O pin only when enabled, similar to a tristate buffer in electronics

## SYNOPSIS
loadrt tristate_bit [count=N|names=name1[,name2...]]

## FUNCTIONS
tristate-bit.N

If enable is TRUE, copy in to out.

## PINS
tristate-bit.N.in bit in

Input value

tristate-bit.N.out bit io

Output value

tristate-bit.N.enable bit in

When TRUE, copy in to out

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: tristate_float(9)

text:
# tristate_float(9)

## NAME
tristate_float - Place a signal on an I/O pin only when enabled, similar to a tristate buffer in electronics

## SYNOPSIS
loadrt tristate_float [count=N|names=name1[,name2...]]

## FUNCTIONS
tristate-float.N (requires a floating-point thread)

If enable is TRUE, copy in to out.

## PINS
tristate-float.N.in float in

Input value

tristate-float.N.out float io

Output value

tristate-float.N.enable bit in

When TRUE, copy in to out

## AUTHOR
Jeff Epler

## LICENSE
GPL


trivkins

title: trivkins(9)

text:
# trivkins(9)

See the file man9/kins.9.


updown

title: updown(9)

text:
# updown(9)

## NAME
updown - Counts up or down, with optional limits and wraparound behavior

## SYNOPSIS
loadrt updown [count=N|names=name1[,name2...]]

## FUNCTIONS
updown.N

Process inputs and update count if necessary

## PINS
updown.N.countup bit in

Increment count when this pin goes from 0 to 1

updown.N.countdown bit in

Decrement count when this pin goes from 0 to 1

updown.N.reset bit in

Reset count when this pin goes from 0 to 1

updown.N.count s32 out

The current count

## PARAMETERS
updown.N.clamp bit rw

If TRUE, then clamp the output to the min and max parameters.

updown.N.wrap bit rw

If TRUE, then wrap around when the count goes above or below the min and max parameters. Note that wrap implies (and overrides) clamp.

updown.N.max s32 rw (default: 0x7FFFFFFF)

If clamp or wrap is set, count will never exceed this number

updown.N.min s32 rw

If clamp or wrap is set, count will never be less than this number

## AUTHOR
Stephen Wille Padnos

## LICENSE
GPL


userkins

title: userkins(9)

summary: Template for user-built kinematics

text:
# userkins(9)

## NAME
userkins - Template for user-built kinematics

## SYNOPSIS
loadrt userkins [count=N|names=name1[,name2...]]

## DESCRIPTION
The userkins.comp file is a template for creating kinematics that can be user-built using halcompile.

The unmodified userkins component can be used as a kinematics file for a machine with identity kinematics for an xyz machine employing 3 joints (motors).

USAGE:

1) Copy the userkins.comp file to a user-owned

directory (mydir).

Note: The userkins.comp file can be downloaded from:

where '2.8' is the branch name (use 'master' for

the master branch)

For a RIP (run-in-place) build, the file is located in

the git tree as:

src/hal/components/userkins.comp

2) Edit the functions kinematicsForward() and

kinematicsInverse() as required

3) If required, add hal pins following examples in

the template code

4) Build and install the component using halcompile:

$ cd mydir

$ [sudo] halcompile --install userkins.comp

\# Note:

\# sudo is required when using a deb install

\# sudo is not required for run-in-place builds

\# $ man halcompile for more info

5) Specify userkins in an ini file as:

[KINS]

KINEMATICS=userkins

JOINTS=3

\# the number of JOINTS must agree with the

\# number of joints used in your modified userkins.comp

6) Note: the manpage for userkins is not updated by

halcompile --install

7) To use a different component name, rename the file

(example mykins.comp) and change all instances of

'userkins' to 'mykins'

NOTES:

1 The fpin pin is included to satisfy the requirements of

the halcompile utility but it is not accessible to kinematics

functions.

2 Hal pins and parameters needed in kinematics functions

(kinematicsForward(), kinematicsInverse()) must

be setup in a function (userkins_setup()) invoked

by the initial motion module call to kinematicsType().

## FUNCTIONS
userkins.N.fdemo (requires a floating-point thread)

## PINS
userkins.N.fpin s32 out (default: 0)

pin to demonstrate use of a conventional (non-kinematics) function fdemo

## AUTHOR
Dewey Garrett

## LICENSE
GPL


watchdog

title: watchdog(9)

summary: monitor multiple inputs for a heartbeat

text:
# watchdog(9)

## NAME
watchdog - monitor multiple inputs for a "heartbeat"

## SYNOPSIS
loadrt watchdog num_inputs=N

You must specify the number of inputs, from 1 to 32. Each input has a separate timeout value.

## FUNCTIONS
process

Check all input pins for transitions, clear the ok-out pin if any input has no transition within its timeout period. This function does not use floating point, and should be added to a fast thread.

set-timeouts

Check for timeout changes, and convert the float timeout inputs to int values that can be used in process. This function also monitors enable-in for false to true transitions, and re-enables monitoring when such a transition is detected. This function does use floating point, and it is appropriate to add it to the servo thread.

## PINS
watchdog.input-n bit in

Input number n. The inputs are numbered from 0 to num_inputs-1.

watchdog.enable-in bit in (default: FALSE)

If TRUE, forces out-ok to be false. Additionally, if a timeout occurs on any input, this pin must be set FALSE and TRUE again to re-start the monitoring of input pins.

watchdog.ok-out bit out (default: FALSE)

OK output. This pin is true only if enable-in is TRUE and no timeout has been detected. This output can be connected to the enable input of a charge_pump or stepgen (in v mode), to provide a heartbeat signal to external monitoring hardware.

## PARAMETERS
watchdog.timeout-n float in

Timeout value for input number n. The inputs are numbered from 0 to num_inputs-1. The timeout is in seconds, and may not be below zero. Note that a timeout of 0.0 will likely prevent ok-out from ever becoming true. Also note that excessively long timeouts are relatively useless for monitoring purposes.

## LICENSE
GPL


wcomp

title: wcomp(9)

summary: Window comparator

text:
# wcomp(9)

## NAME
wcomp - Window comparator

## SYNOPSIS
loadrt wcomp [count=N|names=name1[,name2...]]

## FUNCTIONS
wcomp.N (requires a floating-point thread)

## PINS
wcomp.N.in float in

Value being compared

wcomp.N.min float in

Low boundary for comparison

wcomp.N.max float in

High boundary for comparison

wcomp.N.out bit out

True if in is strictly between min and max

wcomp.N.under bit out

True if in is less than or equal to min

wcomp.N.over bit out

True if in is greater than or equal to max

## NOTES
If max <= min then the behavior is undefined.

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: weighted_sum(9)

summary: convert a group of bits to an integer

text:
# weighted_sum(9)

## NAME
weighted_sum - convert a group of bits to an integer

## SYNOPSIS
loadrt weighted_sum wsum_sizes=size[,size,...]

Creates weighted sum groups each with the given number of input bits (size).

## DESCRIPTION
The weighted_sum converts a group of bits to an integer. The conversion is the sum of the weights of the bits that are on plus any offset. The weight of the m-th bit is 2^m. This is similar to a binary coded decimal but with more options. The hold bit stops processing the input changes so the sum will not change.

The default value for each weight is 2^m where m is the bit number. This results in a binary to unsigned conversion.

There is a limit of 8 weighted summers and each may have up to 16 input bits.

## FUNCTIONS
process_wsums (requires a floating point thread)

Read all input values and update all output values.

## PINS
wsum.N.bit.M.in bit in

The m'th input of weighted summer n.

wsum.N.hold bit in

When TRUE, the sum output does not change. When FALSE, the sum output tracks the bit inputs according to the weights and offset.

wsum.N.sum signed out

The output of the weighted summer

wsum.N.bit.M.weight signed rw

The weight of the m'th input of weighted summer n. The default value is 2^m.

wsum.N.offset signed rw

The offset is added to the weights corresponding to all TRUE inputs to give the final sum.

## SEE ALSO
scaled_s32_sums(9), sum2(9).


title: xhc_hb04_util(9)

summary: xhc-hb04 convenience utility

text:
# xhc_hb04_util(9)

## NAME
xhc_hb04_util - xhc-hb04 convenience utility

## SYNOPSIS
loadrt xhc_hb04_util [count=N|names=name1[,name2...]]

## DESCRIPTION
Provides logic for a start/pause button and an interface to halui.program.is_paused, is_idle, is_running to generate outputs for halui.program.pause, resume, run.

Includes 4 simple lowpass filters with coef and scale pins. The coef value should be 0 <= coef <=1, smaller coef values slow response. See the lowpass manpage for calculating the filter time constant ($ man lowpass).

## FUNCTIONS
xhc-hb04-util.N (requires a floating-point thread)

## PINS
xhc-hb04-util.N.start-or-pause bit in

xhc-hb04-util.N.is-paused bit in

xhc-hb04-util.N.is-idle bit in

xhc-hb04-util.N.is-running bit in

xhc-hb04-util.N.pause bit out

xhc-hb04-util.N.resume bit out

xhc-hb04-util.N.run bit out

xhc-hb04-util.N.in0 s32 in

xhc-hb04-util.N.in1 s32 in

xhc-hb04-util.N.in2 s32 in

xhc-hb04-util.N.in3 s32 in

xhc-hb04-util.N.out0 s32 out

xhc-hb04-util.N.out1 s32 out

xhc-hb04-util.N.out2 s32 out

xhc-hb04-util.N.out3 s32 out

xhc-hb04-util.N.scale0 float in (default: 1.0)

xhc-hb04-util.N.scale1 float in (default: 1.0)

xhc-hb04-util.N.scale2 float in (default: 1.0)

xhc-hb04-util.N.scale3 float in (default: 1.0)

xhc-hb04-util.N.coef0 float in (default: 1.0)

xhc-hb04-util.N.coef1 float in (default: 1.0)

xhc-hb04-util.N.coef2 float in (default: 1.0)

xhc-hb04-util.N.coef3 float in (default: 1.0)

xhc-hb04-util.N.divide-by-k-in float in

xhc-hb04-util.N.divide-by-k-out float out

xhc-hb04-util.N.k float in (default: 1.0)

## AUTHOR
Dewey Garrett

## LICENSE
GPL


title: xor2(9)

summary: Two-input XOR (exclusive OR) gate

text:
# xor2(9)

## NAME
xor2 - Two-input XOR (exclusive OR) gate

## SYNOPSIS
loadrt xor2 [count=N|names=name1[,name2...]]

## FUNCTIONS
xor2.N

## PINS
xor2.N.in0 bit in

xor2.N.in1 bit in

xor2.N.out bit out

out is computed from the value of in0 and in1 according to the following rule:

in0=TRUE in1=FALSE

in0=FALSE in1=TRUE

out=TRUE

Otherwise,

out=FALSE

## SEE ALSO
and2(9), logic(9), lut5(9), not(9), or2(9).

## AUTHOR
John Kasunich

## LICENSE
GPL


title: xyzab_tdr_kins(9)

text:
# xyzab_tdr_kins(9)

## NAME
xyzab_tdr_kins - Switchable kinematics for 5 axis machine with rotary table A and B

## SYNOPSIS
loadrt xyzab_tdr_kins [count=N|names=name1[,name2...]]

## DESCRIPTION
This is a switchable kinematics module for a 5-axis milling configuration using 3 cartesian linear joints (XYZ) and 2 rotary table joints (AB).

The module contains two kinematic models:

type0 (default) is a trivial XYZAB configuration with joints 0..4 mapped to axes XYZAB respectively.

type1 is a XYZAB configuration with tool center point (TCP) compensation.

For an example configuration, run the sim config: '/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini'.

Further explanations can be found in the README in '/configs/sim/axis/vismach/5axis/table-dual-rotary/'.

xyzab_tdr_kins.comp was constructed by modifying the template file: userkins.comp.

For more information on how to modify userkins.comp run: $ man userkins. Also, see additional information inside: 'userkins.comp'.

For information on kinematics in general see the kinematics document chapter (docs/src/motion/kinematics.txt) and for switchable kinematics in particular see the switchkins document chapter (docs/src/motion/switchkins.txt)

## PINS
xyzab-tdr-kins.N.dummy s32 out (default: 0)

one pin needed to satisfy halcompile requirement

## AUTHOR
David Mueller

## LICENSE
GPL