abs

package: linuxcnc

title: abs(9)

text:
# abs(9)

## NAME
abs - Compute the absolute value and sign of the input signal

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

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

## PINS
abs.N.in float in

Analog input value

abs.N.out float out

Analog output value, always positive

abs.N.sign bit out

Sign of input, false for positive, true for negative

abs.N.is-positive bit out

TRUE if input is positive, FALSE if input is 0 or negative

abs.N.is-negative bit out

TRUE if input is negative, FALSE if input is 0 or positive

## AUTHOR
John Kasunich

## LICENSE
GPL

branch: sisyphus


title: abs_s32(9)

text:
# abs_s32(9)

## NAME
abs_s32 - Compute the absolute value and sign of the input signal

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

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

## PINS
abs-s32.N.in s32 in

input value

abs-s32.N.out s32 out

output value, always non-negative

abs-s32.N.sign bit out

Sign of input, false for positive, true for negative

abs-s32.N.is-positive bit out

TRUE if input is positive, FALSE if input is 0 or negative

abs-s32.N.is-negative bit out

TRUE if input is negative, FALSE if input is 0 or positive

## AUTHOR
Sebastian Kuzminsky

## LICENSE
GPL


title: and2(9)

summary: Two-input AND gate

text:
# and2(9)

## NAME
and2 - Two-input AND gate

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

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

## PINS
and2.N.in0 bit in

and2.N.in1 bit in

and2.N.out bit out

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

in0=TRUE in1=TRUE

out=TRUE

Otherwise,

out=FALSE

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

## AUTHOR
Jeff Epler

## LICENSE
GPL


anglejog

title: anglejog(9)

summary: Jog two axes (or joints) at an angle

text:
# anglejog(9)

## NAME
anglejog - Jog two axes (or joints) at an angle

## SYNOPSIS
This component accepts a dynamic counts-in input (typically from a manual pulse generator (MPG)) and static angle and scale factor settings. It computes the counts and scale values required to jog two (M,N) axes (or joints) at an angle. The corresponding output pins must be connected to the candidate axis.[MN].jog* (or joint.[MN].jog*) pins to create motion at the current angle. Hal pins are provided to set the vector velocity and acceleration and to enable the computations.

Notes:

1. The max-vel, max-accel settings should be less than or equal to the smallest settings for both of the target axes.

2. The scale-in pin is sampled only when the enable-in pin is false. The value in use is output on the current-scale pin.

3. The angle-degrees-in pin is sampled only when the enable-in pin is false. The value in use is output on the current-angle-degrees pin.

4. The value of the iscale-factor pin multiplies counts-in internally to support integer (s32) calculations for counting. The current-scale-out is divided by the same amount. The pin is sampled only when the enable-in pin is false. The default value should work in most applications.

5. For identity kins machines that support both world jogging (axis letter) and joint jogging (joint number), connections are needed for both the axis pins: axis.[MN].jog-enable,jog-scale,jog-counts and the corresponding joint pins: joint.[mn].jog-enable,jog-scale,jog-counts where [mn] are the joint numbers corresponding to the [MN] axis letters. 6. The current-scale pin is for information, the required output scaling pin is current-scale-out as it depends on the iscale-factor setting.

Simulation Config: configs/sim/axis/anglejog/anglejog.in

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

## PINS
anglejog.N.enable-in bit in

enables motion (disables alteration of angle and scale)

anglejog.N.counts-in s32 in

MPG (wheel) counts

anglejog.N.angle-degrees-in float in

vector angle

anglejog.N.iscale-factor s32 in (default: 10000)

integer scaling factor (>1)

anglejog.N.scale-in float in

magnitude units/count (mag = counts * scale)

anglejog.N.max-vel float in

vector max velocity magnitude

anglejog.N.max-accel float in

vector max acceleration magnitude

anglejog.N.accel-fraction-in float in (default: 1)

acceleration fraction input

anglejog.N.enable-out bit out

to: axis.M.jog-enable AND axis.N.jog-enable

anglejog.N.current-scale float out

effective scale (informational)

anglejog.N.current-scale-out float out

to: axis.M.jog-scale AND axis.N.jog-scale

anglejog.N.coscounts s32 out

to: axis.M.jog-counts (cosine counts)

anglejog.N.sincounts s32 out

to: axis.N.jog-counts (sine counts)

anglejog.N.cos-accel-fraction float out

to: axis.M.jog-accel-fraction

anglejog.N.sin-accel-fraction float out

to: axis.N.jog-accel-fraction

anglejog.N.active bit out

angle jog move in progress

anglejog.N.current-angle-degrees float out

current angle

anglejog.N.current-mag float out

current vector magnitude

anglejog.N.current-vel float out

current vector speed

## AUTHOR
Dewey Garrett

## LICENSE
GPL


title: at_pid(9)

summary: obsolete pid HAL component

text:
# at_pid(9)

## NAME
at_pid - obsolete pid HAL component

## DESCRIPTION
The functionality of the at_pid component has been merged into the pid component.

## SEE ALSO
pid(9)


axis

title: axis(9)

text:
# axis(9)

See the file man9/motion.9.


axistest

title: axistest(9)

text:
# axistest(9)

## NAME
axistest - Used to allow testing of an axis. Used IN PnCconf.

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

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

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

Drive TRUE to jog the axis in its negative ('minus') direction.

axistest.N.jog-plus bit in

Drive TRUE to jog the axis in its positive direction.

axistest.N.run bit in

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

axistest.N.maxvel float in

Maximum velocity

axistest.N.amplitude float in

Approximate amplitude of positions to command during 'run'

axistest.N.dir s32 in

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

axistest.N.position-cmd float out

axistest.N.position-fb float in

axistest.N.running bit out

axistest.N.run-target float out

axistest.N.run-start float out

axistest.N.run-low float out

axistest.N.run-high float out

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

Pause time for each end of run in seconds

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

axistest.N.elapsed float r

Current value of the internal timer

## AUTHOR
Chris S. Morley

## LICENSE
GPL


title: bin2gray(9)

text:
# bin2gray(9)

## NAME
bin2gray - convert a number to the gray-code representation

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

## DESCRIPTION
Converts a number into gray-code

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

## PINS
bin2gray.N.in u32 in

binary code in

bin2gray.N.out u32 out

gray code out

## AUTHOR
Andy Pugh

## LICENSE
GPL


biquad

title: biquad(9)

summary: Biquad IIR filter

text:
# biquad(9)

## NAME
biquad - Biquad IIR filter

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

## DESCRIPTION
Biquad IIR filter. Implements the following transfer function: H(z) = (n0 + n1z-1 + n2z-2) / (1+ d1z-1 + d2z-2)

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

## PINS
biquad.N.in float in

Filter input.

biquad.N.out float out

Filter output.

biquad.N.enable bit in (default: 0)

Filter enable. When false, the in pin is passed to the out pin without any filtering. A transition from false to true causes filter coefficients to be calculated according to the current type and the describing pin and parameter settings

biquad.N.valid bit out (default: 0)

When false, indicates an error occurred when calculating filter coefficients (require 2>Q>0.5 and f0>sampleRate/2)

biquad.N.type u32 in (default: 0)

Filter type determines the type of filter coefficients calculated. When 0, coefficients must be loaded directly from the n0,n1,n2,d1 params. When 1, a low pass filter is created specified by the f0,Q pins. When 2, a notch filter is created specified by the f0,Q pins.

biquad.N.f0 float in (default: 250.0)

The corner frequency of the filter.

biquad.N.Q float in (default: 0.7071)

The Q of the filter.

biquad.N.s1 float out (default: 0.0)

1st-delayed internal state (for debug only)

biquad.N.s2 float out (default: 0.0)

2nd-delayed internal state (for debug only)

## PARAMETERS
biquad.N.d1 float rw (default: 0.0)

1st-delayed denominator coef

biquad.N.d2 float rw (default: 0.0)

2nd-delayed denominator coef

biquad.N.n0 float rw (default: 1.0)

non-delayed numerator coef

biquad.N.n1 float rw (default: 0.0)

1st-delayed numerator coef

biquad.N.n2 float rw (default: 0.0)

2nd-delayed numerator coef

## AUTHOR
Peter G. Vavaroutsos

## LICENSE
GPL


bitslice

title: bitslice(9)

text:
# bitslice(9)

## NAME
bitslice - Converts an unsigned-32 input into individual bits

## SYNOPSIS
loadrt bitslice [count=N|names=name1[,name2...]] [personality=P1,P2,...]

## DESCRIPTION
This component creates individual bit-outputs for each bit of an unsigned-32 input. The number of bits can be limited by the "personality" modparam. The inverse process can be performed by the weighted_sum HAL component.

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

## PINS
bitslice.N.in u32 in

The input value

bitslice.N.out-MM bit out (MM=00..personality)

## AUTHOR
Andy Pugh

## LICENSE
GPL2+


bitwise

title: bitwise(9)

text:
# bitwise(9)

## NAME
bitwise - Computes various bitwise operations on the two input values

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

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

## PINS
bitwise.N.in0 u32 in

First input value

bitwise.N.in1 u32 in

Second input value

bitwise.N.out-and u32 out

The bitwise AND of the two inputs

bitwise.N.out-or u32 out

The bitwise OR of the two inputs

bitwise.N.out-xor u32 out

The bitwise XOR of the two inputs

bitwise.N.out-nand u32 out

The inverse of the bitwise AND

bitwise.N.out-nor u32 out

The inverse of the bitwise OR

bitwise.N.out-xnor u32 out

The inverse of the bitwise XOR

## AUTHOR
Andy Pugh

## LICENSE
GPL 2+


bldc

title: bldc(9)

summary: BLDC and AC-servo control component

text:
# bldc(9)

## NAME
bldc - BLDC and AC-servo control component

## SYNOPSIS
loadrt bldc cfg=qi6,aH

## DESCRIPTION
This component is designed as an interface between the most common forms of three-phase motor feedback devices and the corresponding types of drive. However, there is no requirement that the motor and drive should necessarily be of inherently compatible types.

Each instance of the component is defined by a group of letters describing the input and output types. A comma separates individual instances of the component. For example loadrt bldc cfg=qi6,aH.

## Tags
Input type definitions are all lower-case.

n No motor feedback. This mode could be used to drive AC induction motors, but is also potentially useful for creating free-running motor simulators for drive testing.

h Hall sensor input. Brushless DC motors (electronically commutated permanent magnet 3-phase motors) typically use a set of three Hall sensors to measure the angular position of the rotor. A lower-case h in the cfg string indicates that these should be used.

a Absolute encoder input. (Also possibly used by some forms of Resolver conversion hardware). The presence of this tag over-rides all other inputs. Note that the component still requires to be be connected to the rawcounts encoder pin to prevent loss of commutation on index-reset.

q Incremental (quadrature) encoder input. If this input is used then the rotor will need to be homed before the motor can be run.

i Use the index of an incremental encoder as a home reference.

f Use a 4-bit Gray-scale patttern to determine rotor alignment. This scheme is only used on the Fanuc "Red Cap" motors. This mode could be used to control one of these motors using a non-Fanuc drive.

Output type descriptions are all upper-case.

Defaults The component will always calculate rotor angle, phase angle and the absolute value of the input value for interfacing with drives such as the Mesa 8I20. It will also default to three individual, bipolar phase output values if no other output type modifiers are used.

B Bit level outputs. Either 3 or 6 logic-level outputs indicating which high or low gate drivers on an external drive should be used.

6 Create 6 rather than the default 3 outputs. In the case of numeric value outputs these are separate positive and negative drive amplitudes. Both have positive magnitude.

H Emulated Hall sensor output. This mode can be used to control a drive which expects 3x Hall signals, or to convert between a motor with one hall pattern and a drive which expects a different one.

F Emulated Fanuc Red Cap Gray-code encoder output. This mode might be used to drive a non-Fanuc motor using a Fanuc drive intended for the "Red-Cap" motors.

T Force Trapezoidal mode.

## OPERATING MODES
The component can control a drive in either Trapezoidal or Sinusoidal mode, but will always default to sinusoidal if the input and output modes allow it. This can be over-ridden by the T tag. Sinusoidal commutation is significantly smoother (trapezoidal commutation induces 13% torque ripple).

## ROTOR HOMING.
To use an encoder for commutation a reference 0-degrees point must be found. The component uses the convention that motor zero is the point that an unloaded motor aligns to with a positive voltage on the A (or U) terminal and the B & C (or V and W) terminals connected together and to -ve voltage. There will be two such positions on a 4-pole motor, 3 on a 6-pole and so on. They are all functionally equivalent as far as driving the motor is concerned. If the motor has Hall sensors then the motor can be started in trapezoidal commutation mode, and will switch to sinusoidal commutation when an alignment is found. If the mode is qh then the first Hall state-transition will be used. If the mode is qhi then the encoder index will be used. This gives a more accurate homing position if the distance in encoder counts between motor zero and encoder index is known. To force homing to the Hall edges instead simply omit the i.

Motors without Hall sensors may be homed in synchronous/direct mode. The better of these options is to home to the encoder zero using the iq config parameter. When the init pin goes high the motor will rotate (in a direction determined by the rev pin) until the encoder indicates an index-latch (the servo thread runs too slowly to rely on detecting an encoder index directly). If there is no encoder index or its location relative to motor zero can not be found, then an alternative is to use magnetic homing using the q config. In this mode the motor will go through an alignment sequence ending at motor zero when the init pin goes high It will then set the final position as motor zero. Unfortunately the motor is rather springy in this mode and so alignment is likely to be fairly sensitive to load.

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

## PINS
bldc.N.hall1 bit in [if personality & 0x01]

Hall sensor signal 1

bldc.N.hall2 bit in [if personality & 0x01]

Hall sensor signal 2

bldc.N.hall3 bit in [if personality & 0x01]

Hall sensor signal 3

bldc.N.hall-error bit out [if personality & 0x01]

Indicates that the selected hall pattern gives inconsistent rotor position data. This can be due to the pattern being wrong for the motor, or one or more sensors being unconnected or broken. A consistent pattern is not neceesarily valid, but an inconsistent one can never be valid.

bldc.N.C1 bit in [if ( personality & 0x10 )]

Fanuc Gray-code bit 0 input

bldc.N.C2 bit in [if ( personality & 0x10 )]

Fanuc Gray-code bit 1 input

bldc.N.C4 bit in [if ( personality & 0x10 )]

Fanuc Gray-code bit 2 input

bldc.N.C8 bit in [if ( personality & 0x10 )]

Fanuc Gray-code bit 3 input

bldc.N.value float in

PWM master amplitude input

bldc.N.lead-angle float in [if personality & 0x06] (default: 90)

The phase lead between the electrical vector and the rotor position in degrees

bldc.N.rev bit in

Set this pin true to reverse the motor. Negative PWM amplitudes will alsoreverse the motor and there will generally be a Hall pattern that runs the motor in each direction too.

bldc.N.frequency float in [if ( personality & 0x0F ) == 0]

Frequency input for motors with no feedback at all, or those with only an index (which is ignored)

bldc.N.initvalue float in [if personality & 0x04] (default: 0.2)

The current to be used for the homing sequence in applications where an incremental encoder is used with no hall-sensor feedback

bldc.N.rawcounts s32 in [if personality & 0x06] (default: 0)

Encoder counts input. This must be linked to the encoder rawcounts pin or encoder index resets will cause the motor commutation to fail.

bldc.N.index-enable bit io [if personality & 0x08]

This pin should be connected to the associated encoder index-enable pin to zero the encoder when it passes index. This is only used indicate to the bldc control component that an index has been seen.

bldc.N.init bit in [if ( personality & 0x05 ) == 4]

A rising edge on this pin starts the motor alignment sequence. This pin should be connected in such a way that the motors re-align any time that encoder monitoring has been interrupted. Typically this will only be at machine power-off. The alignment process involves powering the motor phases in such a way as to put the motor in a known position. The encoder counts are then stored in the offset parameter. The alignment process will tend to cause a following error if it is triggered while the axis is enabled, so should be set before the matching axis.N.enable pin. The complementary init-done pin can be used to handle the required sequencing. Both pins can be ignored if the encoder offset is known explicitly, such as is the case with an absolute encoder. In that case the offset parameter can be set directly in the HAL file.

bldc.N.init-done bit out [if ( personality & 0x05 ) == 4] (default: 0)

Indicates homing sequence complete.

bldc.N.A-value float out [if ( personality & 0xF00 ) == 0]

Output amplitude for phase A

bldc.N.B-value float out [if ( personality & 0xF00 ) == 0]

Output amplitude for phase B

bldc.N.C-value float out [if ( personality & 0xF00 ) == 0]

Output amplitude for phase C

bldc.N.A-on bit out [if ( personality & 0xF00 ) == 0x100]

Output bit for phase A

bldc.N.B-on bit out [if ( personality & 0xF00 ) == 0x100]

Output bit for phase B

bldc.N.C-on bit out [if ( personality & 0xF00 ) == 0x100]

Output bit for phase C

bldc.N.A-high float out [if ( personality & 0xF00 ) == 0x200]

High-side driver for phase A

bldc.N.B-high float out [if ( personality & 0xF00 ) == 0x200]

High-side driver for phase B

bldc.N.C-high float out [if ( personality & 0xF00 ) == 0x200]

High-side driver for phase C

bldc.N.A-low float out [if ( personality & 0xF00 ) == 0x200]

Low-side driver for phase A

bldc.N.B-low float out [if ( personality & 0xF00 ) == 0x200]

Low-side driver for phase B

bldc.N.C-low float out [if ( personality & 0xF00 ) == 0x200]

Low-side driver for phase C

bldc.N.A-high-on bit out [if ( personality & 0xF00 ) == 0x300]

High-side driver for phase A

bldc.N.B-high-on bit out [if ( personality & 0xF00 ) == 0x300]

High-side driver for phase B

bldc.N.C-high-on bit out [if ( personality & 0xF00 ) == 0x300]

High-side driver for phase C

bldc.N.A-low-on bit out [if ( personality & 0xF00 ) == 0x300]

Low-side driver for phase A

bldc.N.B-low-on bit out [if ( personality & 0xF00 ) == 0x300]

Low-side driver for phase B

bldc.N.C-low-on bit out [if ( personality & 0xF00 ) == 0x300]

Low-side driver for phase C

bldc.N.hall1-out bit out [if ( personality & 0x400 )]

Hall 1 output

bldc.N.hall2-out bit out [if ( personality & 0x400 )]

Hall 2 output

bldc.N.hall3-out bit out [if ( personality & 0x400 )]

Hall 3 output

bldc.N.C1-out bit out [if ( personality & 0x800 )]

Fanuc Gray-code bit 0 output

bldc.N.C2-out bit out [if ( personality & 0x800 )]

Fanuc Gray-code bit 1 output

bldc.N.C4-out bit out [if ( personality & 0x800 )]

Fanuc Gray-code bit 2 output

bldc.N.C8-out bit out [if ( personality & 0x800 )]

Fanuc Gray-code bit 3 output

bldc.N.phase-angle float out (default: 0)

Phase angle including lead/lag angle after encoder zeroing, etc. Useful for angle/current drives. This value has a range of 0 to 1 and measures electrical revolutions. It will have two zeros for a 4 pole motor, three for a 6-pole, etc.

bldc.N.rotor-angle float out (default: 0)

Rotor angle after encoder zeroing etc. Useful for angle/current drives which add their own phase offset such as the 8I20. This value has a range of 0 to 1 and measures electrical revolutions. It will have two zeros for a 4 pole motor, three for a 6-pole, etc.

bldc.N.out float out

Current output, including the effect of the dir pin and the alignment sequence.

bldc.N.out-dir bit out

Direction output, high if /fBvalue/fR is negative XOR /fBrev/fR is true.

bldc.N.out-abs float out

Absolute value of the input value

## PARAMETERS
bldc.N.in-type s32 r (default: -1)

state machine output, will probably hide after debug

bldc.N.out-type s32 r (default: -1)

state machine output, will probably hide after debug

bldc.N.scale s32 rw [if personality & 0x06] (default: 512)

The number of encoder counts per rotor revolution.

bldc.N.poles s32 rw [if personality & 0x06] (default: 4)

The number of motor poles. The encoder scale will be divided by this value to determine the number of encoder counts per electrical revolution.

bldc.N.encoder-offset s32 rw [if personality & 0x0A] (default: 0)

The offset, in encoder counts, between the motor electrical zero and the encoder zero modulo the number of counts per electrical revolution

bldc.N.offset-measured s32 r [if personality & 0x04] (default: 0)

The encoder offset measured by the homing sequence (in certain modes)

bldc.N.drive-offset float rw (default: 0)

The angle, in degrees, applied to the commanded angle by the drive in degrees. This value is only used during the homing sequence of drives with incremental encoder feedback. It is used to back-calculate from commanded angle to actual phase angle. It is only relevant to drives which expect rotor-angle input rather than phase-angle demand. Should be 0 for most drives.

bldc.N.output-pattern u32 rw [if personality & 0x400] (default: 25)

Commutation pattern to be output in Hall Signal translation mode. See the description of /fBpattern/fR for details.

bldc.N.pattern u32 rw [if personality & 0x01] (default: 25)

Commutation pattern to use, from 0 to 47. Default is type 25. Every plausible combination is included. The table shows the excitation pattern along the top, and the pattern code on the left hand side. The table entries are the hall patterns in H1, H2, H3 order. Common patterns are: 0 (30 degree commutation) and 26, its reverse. 17 (120 degree). 18 (alternate 60 degree). 21 (300 degree, Bodine). 22 (240 degree). 25 (60 degree commutation). Note that a number of incorrect commutations will have non-zero net torque which might look as if they work, but don't really.

If your motor lacks documentation it might be worth trying every pattern.

Phases, Source - Sink

pat

B-A

C-A

C-B

A-B

A-C

B-C

0

000

001

011

111

110

100

1

001

000

010

110

111

101

2

000

010

011

111

101

100

3

001

011

010

110

100

101

4

010

011

001

101

100

110

5

011

010

000

100

101

111

6

010

000

001

101

111

110

7

011

001

000

100

110

111

8

000

001

101

111

110

010

9

001

000

100

110

111

011

10

000

010

110

111

101

001

11

001

011

111

110

100

000

12

010

011

111

101

100

000

13

011

010

110

100

101

001

14

010

000

100

101

111

011

15

011

001

101

100

110

010

16

000

100

101

111

011

010

17

001

101

100

110

010

011

18

000

100

110

111

011

001

19

001

101

111

110

010

000

20

010

110

111

101

001

000

21

011

111

110

100

000

001

22

010

110

100

101

001

011

23

011

111

101

100

000

010

24

100

101

111

011

010

000

25

101

100

110

010

011

001

26

100

110

111

011

001

000

27

101

111

110

010

000

001

28

110

111

101

001

000

010

29

111

110

100

000

001

011

30

110

100

101

001

011

010

31

111

101

100

000

010

011

32

100

101

001

011

010

110

33

101

100

000

010

011

111

34

100

110

010

011

001

101

35

101

111

011

010

000

100

36

110

111

011

001

000

100

37

111

110

010

000

001

101

38

110

100

000

001

011

111

39

111

101

001

000

010

110

40

100

000

001

011

111

110

41

101

001

000

010

110

111

42

100

000

010

011

111

101

43

101

001

011

010

110

100

44

110

010

011

001

101

100

45

111

011

010

000

100

101

46

110

010

000

001

101

111

47

111

011

001

000

100

110

## AUTHOR
Andy Pugh

## LICENSE
GPL


blend

title: blend(9)

text:
# blend(9)

## NAME
blend - Perform linear interpolation between two values

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

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

## PINS
blend.N.in1 float in

First input. If select is equal to 1.0, the output is equal to in1

blend.N.in2 float in

Second input. If select is equal to 0.0, the output is equal to in2

blend.N.select float in

Select input. For values between 0.0 and 1.0, the output changes linearly from in2 to in1

blend.N.out float out

Output value.

## PARAMETERS
blend.N.open bit rw

If true, select values outside the range 0.0 to 1.0 give values outside the range in2 to in1. If false, outputs are clamped to the the range in2 to in1

## AUTHOR
Jeff Epler

## LICENSE
GPL


carousel

title: carousel(9)

text:
# carousel(9)

## NAME
carousel - Orient a toolchanger carousel using various encoding schemes

## SYNOPSIS
loadrt carousel pockets=N[,N] encoding=ssss[,sss] num_sense=N[,N] dir=N[,N]

pockets The number of pockets in each toolchanger.

Use up to 8 numbers separated by commas to create multiple carousel components.

encoding The position encoding.

gray, binary, bcd, index, edge, counts or single. Default = 'gray'

num_sense The number of position sense pins.

Default = 4.

dir Set to 1 for unidirectional or 2 for bidirectional operation.

Default = bidirectional

parity Set to 1 for odd parity, 0 for even parity checking.

Default = 0 (even)

## DESCRIPTION
This component is intended to help operate various types of carousel-type toolchangers.

The component can be configured to operate with binary, binary-coded decimal (BCD) or gray-coded position feedback ('binary;, 'bcd' and 'gray' modes) It can alternatively work with an individual sensor for each tool position ('single' mode) or with a sensor at each tool position and a separate index ('index' mode). Systems using a stepper motor or quadrature encoder are also supported ('counts' mode). edge is a special case of index mode for tool changers with pockets on both the rising and falling edges of the position sensor. (Seen on at least one Denford Orac.)

Both unidirectional and bidirectional systems are supported and those that reverse against a stop when in position.

The number of carousel component instances created depends on the number of entries in the 'pockets' modparam. For example

loadrt carousel pockets=10,10,8

Would create 3 carousel instances with 10, 10 and 8 pockets. The other parameters are optional. If absent then defaults will be used. Any missing entry will assume the previous value.

When the enable pin is set to true the component will immediately set the "active" pin to true and then (for a bidirectional instance) calculate the shortest path to the requested pocket number. The appropriate motor direction output pins will then be set. Bit outputs for forward and reverse are provided as well as a three-state velocity output for driving a DC motor PWM or a velocity-mode stepgen.

The component will monitor the carousel position and, when the correct position is reached, set the motor-control pins to 0, set "active" to 0 and set "ready" to 1.

In 'index', 'edge' or 'counts'mode there is a need to find the initial home position of the carousel. The first time that the "enable" pin is set; the carousel will rotate forwards searching for a home signal. In 'index' and 'edge' mode this is when both the index and pulse inputs are true. In 'counts' mode only the index input needs to be set to set home. Additionally in 'counts' mode the usual index-enable logic of the encoder counters is supported.

With some carousel designs the carousel will not stop immediately. To allow for this set the align-dc pin to a low velocity to be used for a final latching move, and set the decel-time to a suitable value. Once the decel-time has expired the carousel will, if it was moving forwards, reverse back on to the position marker, off of the marker and then back on to the FWD edge. If moving in reverse it will continue off the marker and then reverse slowly on to the FWD edge. This alignment is only possible with a motor-vel controlled bidirectional carousel, Other combinations will be acepted but probably will not have the desired behaviour. Some tuning will be needed of align-dc and decel-time to achieve reliable operation.

In the unusual case that the index and pulse signals do not align it is possible to use HAL logic to achieve the desired pin switching during homing.

Setting "enable" low does not halt the homing move, so if homing on first tool change is not needed then the enable pin can be toggled by an axis homing pin or a script and the homing process will continue even if that driving signal resets during the carousel homing move.

To operate the component with an encoder or stepgen use mode "C". The scale pin should be the number of steps or encoder counts between pocket centres. The width pin can be used to stop the motor some distance before the centre of the pocket to allow the motor time to decelerate. In mode "C" it is possible to use either the speed/direction control used in other modes or to use direct position mode using the counts-target pin. The internal scaling of the encoder or stepgen should be set to 1.0. A PID hal component will be needed for encoder applications whereas stepgen configurations can use a stepgen in position control mode or in velocity control mode with a PID.

For tool changers which lock the carousel against a stop the rev-pulse pin can be set to a non-zero value. The motor-rev pin will then be set for this many seconds at the completion of the tool search and at the same time the reverse duty/cycle velocity value will be sent to the motor-vel pin.

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

## PINS
carousel.N.pocket-number s32 in

The pocket to move to when the .enable pin goes high. If the value passed is higher than the number of pockets specified in the "pockets" modparam then modulo arithmetic is used. This is intended to allow the use of multiple tools in the same holder, as is sometimes useful with lathes.

carousel.N.enable bit in

Set this pin high to start movement. Setting it low will stop movement

carousel.N.active bit out

indicates that the component is active

carousel.N.ready bit out

This pin goes high when the carousel is in-position

carousel.N.strobe bit in (default: 1)

Use this pin to indicate that the position feedback is valid. Often provided by binary encoders

carousel.N.parity bit in

Some encoders supply a parity bit, if this is connected then the parity-error output bit will indicate parity errors

carousel.N.sense-M bit in (M=0..personality)

Carousel position feedback pins. In 'index' mode there will be only 2 pins. sense-0 is the index and sense-1 is the pocket sensor.

carousel.N.rev-pulse float in

The duration in seconds for which a ratchet changer (Boxford, Emco) should pulse the reverse pin to lock the holder

carousel.N.fwd-dc float in

Velocity or duty cycle when forwards rotation is desired

carousel.N.rev-dc float in

Velocity or duty cycle when reverse rotation is desired

carousel.N.hold-dc float in

Duty cycle when carousel is in-position (to hold against stop)

carousel.N.align-dc float in

Use this pin to set the speed of a slower alignment move once the changer is in position. Such a system almost certainly needs decel-time setting too

carousel.N.decel-time float in

Time to wait for carousel to stop before final alignment and position check

carousel.N.counts s32 in

Connect to the rawcounts of an encoder or a stepgen in 'counts' mode

carousel.N.scale s32 in (default: 100)

The number of stepgen or encoder counts between successive pockets

carousel.N.width s32 in (default: 10)

How far each side of the exact scale to signal a new pocket

carousel.N.home-offset s32 in (default: 0)

The offset (in counts) between the index and pocket 1

carousel.N.index-enable bit io

Used to home to an encoder index

carousel.N.jog-fwd bit in

Jog the carousel forwards one tool position

carousel.N.jog-rev bit in

Jog the carousel in reverse (only if dir = 2). It is very important that these pins should be debounced and should probably also be interlocked to only operate when the machine is idle.

carousel.N.motor-fwd bit out

Indicates the motor should run forwards (bigger numbers)

carousel.N.motor-rev bit out

Indicates the motor should run reverse.

carousel.N.parity-error bit out

Indicates a parity error

carousel.N.current-position s32 out

This pin indicates the current position feedback

carousel.N.motor-vel float out

The duty-cycle or velocity to drive a DC motor or stepgen

carousel.N.homed bit out (default: 0)

Shows that homing is complete. Only used in index and edge modes

carousel.N.unhome bit in (default: 0)

Should only really be necessary for testing

carousel.N.counts-target float out

Target position for a stepgen or external PID controller

## PARAMETERS
carousel.N.state s32 r (default: 0)

Current component state

carousel.N.homing bit r (default: 0)

Shows that homing is in progress. Only used for index mode

carousel.N.timer float r

Shows the value of the internal timer

carousel.N.motor-dir s32 r

Internal tag for search direction

carousel.N.counts-offset s32 r

Internal offset of index pin

carousel.N.debounce u32 rw

How many thread cycles to wait for the position to stabilise

carousel.N.target s32 r

Current target pocket, debug

carousel.N.base-counts s32 r (default: 0)

## AUTHOR
Andy Pugh

## LICENSE
GPL


title: charge_pump(9)

text:
# charge_pump(9)

## NAME
charge_pump - Create a square-wave for the 'charge pump' input of some controller boards

## SYNOPSIS
loadrt charge_pump

## DESCRIPTION
The 'Charge Pump' should be added to the base thread function. When enabled the output is on for one period and off for one period. To calculate the frequency of the output 1/(period time in seconds x 2) = Hz. For example if you have a base period of 100,000ns that is 0.0001 seconds and the formula would be 1/(0.0001 x 2) = 5,000 Hz or 5 kHz. Two additional outputs are provided that run a factor of 2 and 4 slower for hardware that requires a lower frequency.

## FUNCTIONS
charge-pump (requires a floating-point thread)

Toggle the output bit (if enabled)

## PINS
charge-pump.out bit out

Square wave if 'enable' is TRUE or unconnected, low if 'enable' is FALSE

charge-pump.out-2 bit out

Square wave at half the frequency of 'out'

charge-pump.out-4 bit out

Square wave at a quarter of the frequency of 'out'

charge-pump.enable bit in (default: TRUE)

If FALSE, forces all 'out' pins to be low

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: clarke2(9)

summary: Two input version of Clarke transform

text:
# clarke2(9)

## NAME
clarke2 - Two input version of Clarke transform

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

## DESCRIPTION
The Clarke transform can be used to translate a vector quantity from a three phase system (three components 120 degrees apart) to a two phase Cartesian system.

clarke2 implements a special case of the Clarke transform, which only needs two of the three input phases. In a three wire three phase system, the sum of the three phase currents or voltages must always be zero. As a result only two of the three are needed to completely define the current or voltage. clarke2 assumes that the sum is zero, so it only uses phases A and B of the input. Since the H (homopolar) output will always be zero in this case, it is not generated.

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

## PINS
clarke2.N.a float in

clarke2.N.b float in

first two phases of three phase input

clarke2.N.x float out

clarke2.N.y float out

cartesian components of output

## SEE ALSO
clarke3(9) for the general case, clarkeinv(9) for the inverse transform.

## AUTHOR
John Kasunich

## LICENSE
GPL


title: clarke3(9)

summary: Clarke (3 phase to cartesian) transform

text:
# clarke3(9)

## NAME
clarke3 - Clarke (3 phase to cartesian) transform

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

## DESCRIPTION
The Clarke transform can be used to translate a vector quantity from a three phase system (three components 120 degrees apart) to a two phase Cartesian system (plus a homopolar component if the three phases don't sum to zero).

clarke3 implements the general case of the transform, using all three phases. If the three phases are known to sum to zero, see clarke2 for a simpler version.

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

## PINS
clarke3.N.a float in

clarke3.N.b float in

clarke3.N.c float in

three phase input vector

clarke3.N.x float out

clarke3.N.y float out

cartesian components of output

clarke3.N.h float out

homopolar component of output

## SEE ALSO
clarke2(9) for the 'a+b+c=0' case, clarkeinv(9) for the inverse transform.

## AUTHOR
John Kasunich

## LICENSE
GPL


clarkeinv

title: clarkeinv(9)

summary: Inverse Clarke transform

text:
# clarkeinv(9)

## NAME
clarkeinv - Inverse Clarke transform

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

## DESCRIPTION
The inverse Clarke transform can be used rotate a vector quantity and then translate it from Cartesian coordinate system to a three phase system (three components 120 degrees apart).

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

## PINS
clarkeinv.N.x float in

clarkeinv.N.y float in

cartesian components of input

clarkeinv.N.h float in

homopolar component of input (usually zero)

clarkeinv.N.theta float in

rotation angle: 0.00 to 1.00 = 0 to 360 degrees

clarkeinv.N.a float out

clarkeinv.N.b float out

clarkeinv.N.c float out

three phase output vector

## SEE ALSO
clarke2(9) and clarke3(9) for the forward transform.

## AUTHOR
John Kasunich

## LICENSE
GPL


classicladder

title: classicladder(9)

text:
# classicladder(9)

## NAME
ClassicLadder - realtime software plc based on ladder logic

## SYNOPSIS
loadrt classicladder_rt [numRungs=N] [numBits=N] [numWords=N] [numTimers=N] [numMonostables=N] [numCounters=N] [numPhysInputs=N] [numPhysOutputs=N] [numArithmExpr=N] [numSections=N] [numSymbols=N] [numS32in=N] [numS32out=N] [numFloatIn=N] [numFloatOut=N]

loadusr classicladder <file name> [--nogui]

## DESCRIPTION
This component consist of a realtime part and a non-realtime part. The non-realtime part loads the programmable ladder description, while the realtime part provides the pins. The file name of the configuration can be changed using an argument to the non-realtime part. By default the non-realtime part provides a graphical visualisation of the loaded ladder, which can be disabled using the '--nogui' option to the non-realtime part.

These pins and parameters are created by the realtime classicladder_rt module. Each period (minimum 1000000 ns), ClassicLadder reads the inputs, evaluates the ladder logic defined in the GUI, and then writes the outputs.

## PINS
classicladder.0.in-NN IN bit

These bit signal pins map to %INN variables in ClassicLadder.

classicladder.0.out-NN OUT bit

These bit signal pins map to %QNN variables in ClassicLadder. Output from ClassicLadder.

classicladder.0.s32in-NN IN s32

Integer input from ClassicLadder. These s32 signal pins map to %IWNN variables in ClassicLadder.

classicladder.0.s32out-NN OUT s32

Integer output from ClassicLadder. These s32 signal pins map to %QWNN variables in ClassicLadder.

classicladder.0.floatin-NN IN float

Integer input from ClassicLadder. These float signal pins map to %IFNN variables in ClassicLadder. These are truncated to S32 values internally. eg 7.5 will be 7.

classicladder.0.floatout-NN OUT float

Float output from ClassicLadder. These float signal pins map to %QFNN variables in ClassicLadder.

classicladder.0.hide_gui IN bit

This bit pin hides the ClassicLadder window, while still having the non-realtime code run. This is usually desirable when modbus is used, as modbus requires the non-realtime code to run.

## PARAMETERS
classicladder.0.refresh.time RO s32

Tells you how long the last refresh took.

classicladder.0.refresh.tmax RW s32

Tells you how long the longest refresh took.

classicladder.0.ladder-state RO s32

Tells you if the program is running or not

## FUNCTIONS
classicladder.0.refresh FP

The rung update rate. Add this to the servo thread. You can added it to a faster thread but it. Will update no faster than once every 1 millisecond (1000000 ns).

## BUGS
See http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ClassicLadder_Ver_7.124 for the latest.

## SEE ALSO
ClassicLadder chapters in the LinuxCNC documentation for a full description of the ClassicLadder syntax and examples.

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ClassicLadder_Ver_7.124


comp

title: comp(9)

summary: Two input comparator with hysteresis

text:
# comp(9)

## NAME
comp - Two input comparator with hysteresis

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

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

Update the comparator

## PINS
comp.N.in0 float in

Inverting input to the comparator

comp.N.in1 float in

Non-inverting input to the comparator

comp.N.out bit out

Normal output. True when in1 > in0 (see parameter hyst for details)

comp.N.equal bit out

Match output. True when difference between in1 and in0 is less than hyst/2

## PARAMETERS
comp.N.hyst float rw (default: 0.0)

Hysteresis of the comparator (default 0.0) With zero hysteresis, the output is true when in1 > in0. With nonzero hysteresis, the output switches on and off at two different values, separated by distance hyst around the point where in1 = in0. Keep in mind that floating point calculations are never absolute and it is wise to always set hyst if you intend to use equal

## AUTHOR
Jeff Epler

## LICENSE
GPL


constant

title: constant(9)

text:
# constant(9)

## NAME
constant - Use a parameter to set the value of a pin

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

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

## PINS
constant.N.out float out

## PARAMETERS
constant.N.value float rw

## AUTHOR
John Kasunich

## LICENSE
GPL


title: conv_bit_float(9)

summary: Convert a value from bit to float

text:
# conv_bit_float(9)

## NAME
conv_bit_float - Convert a value from bit to float

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

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

Update 'out' based on 'in'

## PINS
conv-bit-float.N.in bit in

conv-bit-float.N.out float out

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_bit_s32(9)

summary: Convert a value from bit to s32

text:
# conv_bit_s32(9)

## NAME
conv_bit_s32 - Convert a value from bit to s32

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

## FUNCTIONS
conv-bit-s32.N (requires a floating-point thread)

Update 'out' based on 'in'

## PINS
conv-bit-s32.N.in bit in

conv-bit-s32.N.out s32 out

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_bit_u32(9)

summary: Convert a value from bit to u32

text:
# conv_bit_u32(9)

## NAME
conv_bit_u32 - Convert a value from bit to u32

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

## FUNCTIONS
conv-bit-u32.N (requires a floating-point thread)

Update 'out' based on 'in'

## PINS
conv-bit-u32.N.in bit in

conv-bit-u32.N.out u32 out

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_float_s32(9)

summary: Convert a value from float to s32

text:
# conv_float_s32(9)

## NAME
conv_float_s32 - Convert a value from float to s32

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

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

Update 'out' based on 'in'

## PINS
conv-float-s32.N.in float in

conv-float-s32.N.out s32 out

conv-float-s32.N.out-of-range bit out

TRUE when 'in' is not in the range of s32

## PARAMETERS
conv-float-s32.N.clamp bit rw

If TRUE, then clamp to the range of s32. If FALSE, then allow the value to "wrap around".

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_float_u32(9)

summary: Convert a value from float to u32

text:
# conv_float_u32(9)

## NAME
conv_float_u32 - Convert a value from float to u32

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

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

Update 'out' based on 'in'

## PINS
conv-float-u32.N.in float in

conv-float-u32.N.out u32 out

conv-float-u32.N.out-of-range bit out

TRUE when 'in' is not in the range of u32

## PARAMETERS
conv-float-u32.N.clamp bit rw

If TRUE, then clamp to the range of u32. If FALSE, then allow the value to "wrap around".

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_s32_bit(9)

summary: Convert a value from s32 to bit

text:
# conv_s32_bit(9)

## NAME
conv_s32_bit - Convert a value from s32 to bit

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

## FUNCTIONS
conv-s32-bit.N (requires a floating-point thread)

Update 'out' based on 'in'

## PINS
conv-s32-bit.N.in s32 in

conv-s32-bit.N.out bit out

conv-s32-bit.N.out-of-range bit out

TRUE when 'in' is not in the range of bit

## PARAMETERS
conv-s32-bit.N.clamp bit rw

If TRUE, then clamp to the range of bit. If FALSE, then allow the value to "wrap around".

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_s32_float(9)

summary: Convert a value from s32 to float

text:
# conv_s32_float(9)

## NAME
conv_s32_float - Convert a value from s32 to float

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

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

Update 'out' based on 'in'

## PINS
conv-s32-float.N.in s32 in

conv-s32-float.N.out float out

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_s32_u32(9)

summary: Convert a value from s32 to u32

text:
# conv_s32_u32(9)

## NAME
conv_s32_u32 - Convert a value from s32 to u32

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

## FUNCTIONS
conv-s32-u32.N (requires a floating-point thread)

Update 'out' based on 'in'

## PINS
conv-s32-u32.N.in s32 in

conv-s32-u32.N.out u32 out

conv-s32-u32.N.out-of-range bit out

TRUE when 'in' is not in the range of u32

## PARAMETERS
conv-s32-u32.N.clamp bit rw

If TRUE, then clamp to the range of u32. If FALSE, then allow the value to "wrap around".

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_u32_bit(9)

summary: Convert a value from u32 to bit

text:
# conv_u32_bit(9)

## NAME
conv_u32_bit - Convert a value from u32 to bit

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

## FUNCTIONS
conv-u32-bit.N (requires a floating-point thread)

Update 'out' based on 'in'

## PINS
conv-u32-bit.N.in u32 in

conv-u32-bit.N.out bit out

conv-u32-bit.N.out-of-range bit out

TRUE when 'in' is not in the range of bit

## PARAMETERS
conv-u32-bit.N.clamp bit rw

If TRUE, then clamp to the range of bit. If FALSE, then allow the value to "wrap around".

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_u32_float(9)

summary: Convert a value from u32 to float

text:
# conv_u32_float(9)

## NAME
conv_u32_float - Convert a value from u32 to float

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

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

Update 'out' based on 'in'

## PINS
conv-u32-float.N.in u32 in

conv-u32-float.N.out float out

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: conv_u32_s32(9)

summary: Convert a value from u32 to s32

text:
# conv_u32_s32(9)

## NAME
conv_u32_s32 - Convert a value from u32 to s32

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

## FUNCTIONS
conv-u32-s32.N (requires a floating-point thread)

Update 'out' based on 'in'

## PINS
conv-u32-s32.N.in u32 in

conv-u32-s32.N.out s32 out

conv-u32-s32.N.out-of-range bit out

TRUE when 'in' is not in the range of s32

## PARAMETERS
conv-u32-s32.N.clamp bit rw

If TRUE, then clamp to the range of s32. If FALSE, then allow the value to "wrap around".

## AUTHOR
Jeff Epler

## LICENSE
GPL


title: corexy_by_hal(9)

summary: CoreXY kinematics

text:
# corexy_by_hal(9)

## NAME
corexy_by_hal - CoreXY kinematics

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

## DESCRIPTION
Implement CoreXY forward and inverse transformations in HAL. This component provides an alternative method for implementing CoreXY kinematics.

In the INI file, use:

[KINS]KINEMATICS=trivkins coordinates=xyz kinstype=both

This component accepts two joint (j0,j1) motor position commands for a trivkins coordinates=xyz configuration and computes equivalent CoreXY motor commands for two motors identified as alpha,beta. Similarly, the component accepts feedback values for the alpha,beta motor controllers and converts to equivalent joint (j0,j1) motor position feedback values.

Notes:

1) Using trivkins with this module allows home switches to trigger according to the Cartesian x,y positions

2) Joint pin names are based on coordinates=xyz and the corresponding joint number assignments used by trivkins so j0==x, j1==y (man trivkins for more information)

3) CoreXY kinematics can also be implemented using the kinematics module named corexykins with home switches triggered by the j0,j1 motor positions. (man kins for more information)

## FUNCTIONS
corexy-by-hal.N (requires a floating-point thread)

## PINS
corexy-by-hal.N.alpha-fb float in

typ: feedback from alpha motor controller

corexy-by-hal.N.beta-fb float in

typ: feedback from beta motor controller

corexy-by-hal.N.j0-motor-pos-cmd float in

typ: from joint.0.motor-pos-cmd

corexy-by-hal.N.j1-motor-pos-cmd float in

typ: from joint.1.motor-pos-cmd

corexy-by-hal.N.j0-motor-pos-fb float out

typ: to joint.0.motor-pos-fb

corexy-by-hal.N.j1-motor-pos-fb float out

typ: to joint.1.motor-pos-fb

corexy-by-hal.N.alpha-cmd float out

typ: command to alpha motor

corexy-by-hal.N.beta-cmd float out

typ: command to beta ts motor

## AUTHOR
Dewey Garrett based on forum post from nbremond

## LICENSE
GPL


counter

title: counter(9)

summary: counts input pulses (DEPRECATED)

text:
# counter(9)

## NAME
counter - counts input pulses (DEPRECATED)

## SYNOPSIS
loadrt counter [num_chan=N]

## DESCRIPTION
counter is a deprecated HAL component and will be removed in a future release. Use the encoder component with encoder.X.counter-mode set to TRUE.

counter is a HAL component that provides software- based counting that is useful for spindle position sensing and maybe other things. Instead of using a real encoder that outputs quadrature, some lathes have a sensor that generates a simple pulse stream as the spindle turns and an index pulse once per revolution. This component simply counts up when a "count" pulse (phase-A) is received, and if reset is enabled, resets when the "index" (phase-Z) pulse is received.

This is of course only useful for a unidirectional spindle, as it is not possible to sense the direction of rotation.

counter conforms to the "canonical encoder" interface described in the HAL manual.

## FUNCTIONS
counter.capture-position (uses floating-point)

Updates the counts, position and velocity outputs based on internal counters.

counter.update-counters

Samples the phase-A and phase-Z inputs and updates internal counters.

## PINS
counter.N.phase-A bit in

The primary input signal. The internal counter is incremented on each rising edge.

counter.N.phase-Z bit in

The index input signal. When the index-enable pin is TRUE and a rising edge on phase-Z is seen, index-enable is set to FALSE and the internal counter is reset to zero.

counter.N.index-enable bit io

counter.N.reset bit io

counter.N.counts signed out

counter.N.position float out

counter.N.velocity float out

These pins function according to the canonical digital encoder interface.

counter.N.position-scale float rw

This parameter functions according to the canonical digital encoder interface.

counter.N.rawcounts signed ro

The internal counts value, updated from update-counters and reflected in the output pins at the next call to capture-position.

## SEE ALSO
encoder(9). in the LinuxCNC documentation.


dbounce

title: dbounce(9)

summary: alternative debounce component

text:
# dbounce(9)

## NAME
dbounce - alternative debounce component

## SYNOPSIS
This component is similar to the debounce component

(man debounce) but uses settable delay pins for each instance

and supports count= or names= parameters

(groups are not used)

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

## PINS
dbounce.N.in bit in

dbounce.N.out bit out

dbounce.N.delay u32 in (default: 5)

## AUTHOR
Dewey Garrett

## LICENSE
GPL


ddt

title: ddt(9)

text:
# ddt(9)

## NAME
ddt - Compute the derivative of the input function

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

## DESCRIPTION
For every function call from the real time thread, calculate the difference between the old and current input value divided by the timer elapsed since the last call.

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

## PINS
ddt.N.in float in

ddt.N.out float out

## NOTES
As this only work on two consecutive input values, it will only work well if the input change every function call, and not work so well if the rate of change is very low and the input change do not happen every time the real time function is called.

## AUTHOR
Jeff Epler

## LICENSE
GPL


deadzone

title: deadzone(9)

text:
# deadzone(9)

## NAME
deadzone - Return the center if within the threshold

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

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

Update out based on in and the parameters.

## PINS
deadzone.N.in float in

deadzone.N.out float out

## PARAMETERS
deadzone.N.center float rw (default: 0.0)

The center of the dead zone

deadzone.N.threshold float rw (default: 1.0)

The dead zone is center ± (threshold/2)

## AUTHOR
Jeff Epler

## LICENSE
GPL


debounce

title: debounce(9)

summary: filter noisy digital inputs

text:
# debounce(9)

## NAME
debounce - filter noisy digital inputs

## SYNOPSIS
loadrt debounce cfg=size[,size,...]

Creates debounce groups with the number of filters specified by (size). Every filter in the same group has the same sample rate and delay. For example cfg=2,3 creates two filter groups with 2 filters in the first group and 3 filters in the second group.

## NOTE
An alternate component named dbounce implements similar functionality using conventional count= and names= parameters. Delay settings are implemented by a delay pin for each instance instead of using filter groups.

## DESCRIPTION
The debounce filter works by incrementing a counter whenever the input is true, and decrementing the counter when it is false. If the counter decrements to zero, the output is set false and the counter ignores further decrements. If the counter increments up to a threshold, the output is set true and the counter ignores further increments. If the counter is between zero and the threshold, the output retains its previous state. The threshold determines the amount of filtering: a threshold of 1 does no filtering at all, and a threshold of N requires a signal to be present for N samples before the output changes state.

## FUNCTIONS
debounce.G

Sample all the input pins in group G and update the output pins.

## PINS
debounce.G.F.in bit in

The F'th input pin in group G.

debounce.G.F.out bit out

The F'th output pin in group G. Reflects the last "stable" input seen on the corresponding input pin.

debounce.G.delay signed rw

Sets the amount of filtering for all pins in group G.


demux

title: demux(9)

text:
# demux(9)

## NAME
demux - Select one of several output pins by integer and/or or individual bits.

## SYNOPSIS
loadrt demux [count=N|names=name1[,name2...]] [personality=P1,P2,...]

## DESCRIPTION
This component creates a number of output bits defined by the "personality" command-line parameter. One of these bits will be set based on interpreting the bit-inputs as a binary number and then adding on the integer input. Most uses will use only one or the other, but it is possible to use the bits as a ""shift"" if required. An optional operating mode is enabled by setting the "bargraph" parameter to true, in this case all bits up to the selected bit will be set, as might be required for an LED bargraph display.

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

## PINS
demux.N.sel-bit-MM bit in (MM=00..04)

Binary-number bit selectors

demux.N.sel-u32 u32 in

Integer selection input

demux.N.out-MM bit out (MM=00..personality)

The set of output bits

## PARAMETERS
demux.N.bargraph bit rw (default: 0)

## SEE ALSO
select8(9)

## AUTHOR
Andy Pugh

## LICENSE
GPL 2+


differential

title: differential(9)

text:
# differential(9)

## NAME
differential - kinematics for a differential transmission

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

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

## PINS
differential.N.roll-cmd float in

position command for roll (in degrees)

differential.N.pitch-cmd float in

position command for pitch (in degrees)

differential.N.roll-fb float out

position feedback for roll (in degrees)

differential.N.pitch-fb float out

position feedback for pitch (in degrees)

differential.N.motor0-cmd float out

position command to motor0 (based on roll & pitch inputs)

differential.N.motor1-cmd float out

position command to motor1 (based on roll & pitch inputs)

differential.N.motor0-fb float in

position feedback from motor0

differential.N.motor1-fb float in

position feedback from motor1

## AUTHOR
Sebastian Kuzminsky

## LICENSE
GPL


title: div2(9)

summary: Quotient of two floating point inputs

text:
# div2(9)

## NAME
div2 - Quotient of two floating point inputs

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

## DESCRIPTION
A very simple comp to divide a floating point number by another floating point number, to get a floating point result. Remember, not to use a zero divisor. A zero divisor creates an indefinte result. This is simple mathematics.

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

## PINS
div2.N.in0 float in

the Dividend

div2.N.in1 float in

the Divisor

div2.N.out float out

the Quotient out = in0 / in1

## PARAMETERS
div2.N.deadband float rw

The out will be zero if in is between -deadband and +deadband

## SEE ALSO
mult2(9), invert(9)

## AUTHOR
Noel Rodes

## LICENSE
GPL


edge

title: edge(9)

summary: Edge detector

text:
# edge(9)

## NAME
edge - Edge detector

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

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

Produce output pulses from input edges

## PINS
edge.N.in bit in

edge.N.out bit out

Goes high when the desired edge is seen on 'in'

edge.N.out-invert bit out

Goes low when the desired edge is seen on 'in'

## PARAMETERS
edge.N.both bit rw (default: FALSE)

If TRUE, selects both edges. Otherwise, selects one edge according to in-edge

edge.N.in-edge bit rw (default: TRUE)

If both is FALSE, selects the one desired edge: TRUE means falling, FALSE means rising

edge.N.out-width-ns s32 rw (default: 0)

Time in nanoseconds of the output pulse

edge.N.time-left-ns s32 r

Time left in this output pulse

edge.N.last-in bit r

Previous input value

## AUTHOR
Jeff Epler

## LICENSE
GPL


encoder

title: encoder(9)

text:
# encoder(9)

## NAME
encoder - software counting of quadrature encoder signals

## SYNOPSIS
loadrt encoder [num_chan=num | names=name1[,name2...]]

## DESCRIPTION
encoder is used to measure position by counting the pulses generated by a quadrature encoder. As a software-based implementation it is much less expensive than hardware, but has a limited maximum count rate. The limit is in the range of 10 kHz to 50 kHz, depending on the computer speed and other factors. If better performance is needed, a hardware encoder counter is a better choice. Some hardware-based systems can count at MHz rates.

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. Alternatively, specify names= and unique names separated by commas.

The num_chan= and names= specifiers are mutually exclusive. If neither num_chan= nor names= are specified, or if num_chan=0 is specified, the default value is three.

encoder has a one-phase, unidirectional mode called counter. In this mode, the phase-B input is ignored; the counts increase on each rising edge of phase-A. This mode may be useful for counting a unidirectional spindle with a single input line, though the noise-resistant characteristics of quadrature are lost.

If used in counter-mode it is also possible to enable the missing-teeth index mode, where a gap in the pulse train of one or more teeth is used as in index marker. This system is used extensively for automotive crank position sensors.

## FUNCTIONS
encoder.update-counters (no floating-point)

Does the actual counting, by sampling the encoder signals and decoding the quadrature waveforms. Must be called as frequently as possible, preferably twice as fast as the maximum desired count rate. Operates on all channels at once.

encoder.capture-position (uses floating point)

Captures the raw counts from update-counters and performs scaling and other necessary conversion, handles counter rollover, etc. Can (and should) be called less frequently than update-counters. Operates on all channels at once.

## NAMING
The names for pins and parameters are prefixed as:

encoder.N. for N=0,1,...,num-1 when using num_chan=num

nameN. for nameN=name1,name2,... when using names=name1,name2,...

The encoder.N. format is shown in the following descriptions.

## PINS
encoder.N.counter-mode bit i/o

Enables counter mode. When true, the counter counts each rising edge of the phase-A input, ignoring the value on phase-B. This is useful for counting the output of a single channel (non-quadrature) sensor. When false (the default), it counts in quadrature mode.

encoder.N.counts s32 out

Position in encoder counts.

encoder.N.index-enable bit i/o

When true, counts and position are reset to zero on the next rising edge of Phase-Z. At the same time, index-enable is reset to zero to indicate that the rising edge has occurred.

encoder.N.min-speed-estimate float in (default: 1.0)

Determine the minimum speed at which velocity will be estimated as nonzero and postition-interpolated will be interpolated. The units of min-speed-estimate are the same as the units of velocity. Setting this parameter too low will cause it to take a long time for velocity to go to 0 after encoder pulses have stopped arriving.

encoder.N.phase-A bit in

Quadrature input for encoder channel N.

encoder.N.phase-B bit in

Quadrature input.

encoder.N.phase-Z bit in

Index pulse input.

encoder.N.position float out

Position in scaled units (see position-scale)

encoder.N.position-interpolated float out

Position in scaled units, interpolated between encoder counts. Only valid when velocity is approximately constant and above min-speed-estimate. Do not use for position control.

encoder.N.position-scale float i/o

Scale factor, in counts per length unit. For example, if position-scale is 500, then 1000 counts of the encoder will be reported as a position of 2.0 units.

encoder.N.missing-teeth s32 in

The number of teeth missing from the index gap. For example a 60 tooth gear with two teeth shortened to form an index so that there are 58 pulses per revolution would use a position-scale of 60 and a missing-teeth of 2.

encoder.N.rawcounts s32 out

The raw count, as determined by update-counters. This value is updated more frequently than counts and position. It is also unaffected by reset or the index pulse.

encoder.N.reset bit in

When true, counts and position are reset to zero immediately.

encoder.N.velocity float out

Velocity in scaled units per second. encoder uses an algorithm that greatly reduces quantization noise as compared to simply differentiating the position output. When the magnitude of the true velocity is below min-speed-estimate, the velocity output is 0.

encoder.N.velocity-rpm float out

Velocity in scaled units per minute. Simply encoder.N.velocity scaled by a factor of 60 for convenience.

encoder.N.x4-mode bit i/o

Enables times-4 mode. When true (the default), the counter counts each edge of the quadrature waveform (four counts per full cycle). When false, it only counts once per full cycle. In counter-mode, this parameter is ignored.

encoder.N.latch-input bit in

encoder.N.latch-falling bit in (default: TRUE)

encoder.N.latch-rising bit in (default: TRUE)

encoder.N.counts-latched s32 out

encoder.N.position-latched float out

Update counts-latched and position-latched on the rising and/or falling edges of latch-input as indicated by latch-rising and latch-falling.

encoder.N.counter-mode bit rw

Enables counter mode. When true, the counter counts each rising edge of the phase-A input, ignoring the value on phase-B. This is useful for counting the output of a single channel (non-quadrature) sensor. When false (the default), it counts in quadrature mode. encoder.N.capture-position.tmax s32 rw Maximum number of CPU cycles it took to execute this function.

## PARAMETERS
The encoder component has no HAL Parameters.


title: encoder_ratio(9)

text:
# encoder_ratio(9)

## NAME
encoder_ratio - an electronic gear to synchronize two axes

## SYNOPSIS
loadrt encoder_ratio [num_chan=num | names=name1[,name2...]]

## DESCRIPTION
encoder_ratio can be used to synchronize two axes (like an "electronic gear"). It counts encoder pulses from both axes in software, and produces an error value that can be used with a PID loop to make the slave encoder track the master encoder with a specific ratio.

This module supports up to eight axis pairs. The number of pairs is set by the module parameter num_chan. Alternatively, specify names= and unique names separated by commas.

The num_chan= and names= specifiers are mutually exclusive. If neither num_chan= nor names= are specified, the default value is one.

## FUNCTIONS
encoder-ratio.sample

Read all input pins. Must be called at twice the maximum desired count rate.

encoder-ratio.update (uses floating-point)

Updates all output pins. May be called from a slower thread.

## NAMING
The names for pins and parameters are prefixed as:

encoder-ratio.N. for N=0,1,...,num-1 when using num_chan=num

nameN. for nameN=name1,name2,... when using names=name1,name2,...

The encoder-ratio.N. format is shown in the following descriptions.

## PINS
encoder-ratio.N.master-A bit in

encoder-ratio.N.master-B bit in

encoder-ratio.N.slave-A bit in

encoder-ratio.N.slave-B bit in

The encoder channels of the master and slave axes

encoder-ratio.N.enable bit in

When the enable pin is FALSE, the error pin simply reports the slave axis position, in revolutions. As such, it would normally be connected to the feedback pin of a PID block for closed loop control of the slave axis. Normally the command input of the PID block is left unconnected (zero), so the slave axis simply sits still. However when the enable input goes TRUE, the error pin becomes the slave position minus the scaled master position. The scale factor is the ratio of master teeth to slave teeth. As the master moves, error becomes non-zero, and the PID loop will drive the slave axis to track the master.

encoder-ratio.N.error float out

The error in the position of the slave (in revolutions)

## PARAMETERS
encoder-ratio.N.master-ppr unsigned rw

encoder-ratio.N.slave-ppr unsigned rw

The number of pulses per revolution of the master and slave axes

encoder-ratio.N.master-teeth unsigned rw

encoder-ratio.N.slave-teeth unsigned rw

The number of "teeth" on the master and slave gears.

## SEE ALSO
encoder(9)


enum

title: enum(9)

summary: enumerate integer values into bits

text:
# enum(9)

## NAME
enum - enumerate integer values into bits

## SYNOPSIS
loadrt enum enums=E;enum1pin1;enum1pin2;;;enum1pin3,D;;;enum2pin1;enum2pin2 [names=name1,name2]

## DESCRIPTION
enum converts integer values into bits and vice versa.

The component is especially suitable for encoding and decoding register values for modbus devices, where control commands and status are frequently encoded as enumerations rather than bits. For example 0 = stop, 1 = forwards, 2 = backwards, 3 = jog-forwards etc.

The pins created and the behaviour of the component are controlled by the load-time modparams "enums=" and "names="

The enums= parameter should be a comma-separated list of semicolon- separated pin labels. The enumerated values will increase in sequence starting at zero. To skip a value use a zero-length label, ie two consecutive semicolons, as shown in the examples.

There should be no spaces in the "enums=" list.

"names=" is an optional list of component instance names. If "names=" is omitted the functions and pins will be named "enum-decode...." or "enum-encode...."

Taking the example configuration above, if enum-decode.01.enum2pin1-in is set to TRUE then the output pin enum-decode.01.output will be set to the value 2. If enum-decode.01.enum2pin2-in is set to true then the output would be 3.

Conversely, if enum-encode.00.input is set to 4 then the pin enum-encode.00.enum1pin3-out will be set to TRUE.

## OPTIONS
Preceding the list of labels should be the control-codes "D" for decode or "E" for encode. A D-type enum will set the value of HAL bit pins in response to changes to the enum-decode.NN.input value, whereas an E-type enum will set the value of the enum-encode.NN.output integer depending on which enum-encode.NN.label-bit value is set.

If more than one label-bit input pin is set the output value will correspond to the pin label later in the list.

E and D-type enumerations may be freely mixed in separate instances.

## FUNCTIONS
enum-decode.NN - if instance type = "D"

enum-encode.NN - if instance type = "E"

## PINS
enum-decode.NN.input - The integer value to be decoded

enum-decode.NN.label-out - output bits of a decode instance

enum-decode.NN.label-val - The enumeration value corresponding to each specific bit output. These are populated in sequence during loading but may be over-ridden in HAL if convenient.

enum-encode.NN.label-in - input bits of a decode instance

enum-encode.NN.label-val - The enumeration value corresponding to each specified bit input. These are populated in sequence during loading but may be over-ridden in HAL if convenient.

enum-decode.NN.output - The integer value corresponding to the set bit input.

## BUGS
If no bits are set the output value will be zero even if zero is a defined enumeration.

## AUTHOR
Andy Pugh

## REPORTING BUGS
Report bugs to at the LinuxCNC github issues list: https://github.com/LinuxCNC/linuxcnc/issues

## COPYRIGHT
Copyright © 2023 Andy Pugh. 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: eoffset_per_angle(9)

summary: Compute External Offset Per Angle

text:
# eoffset_per_angle(9)

## NAME
eoffset_per_angle - Compute External Offset Per Angle

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

## DESCRIPTION
An offset is computed (from one of several functions) based on an input angle in degrees. The angle could be a rotary coordinate value or a spindle angle.

The computed offset is represented as an s32 kcounts output pin that is a compatible input to external offset pins like axis.L.eoffset-counts where L is the coordinate letter. Scaling of the s32 kcounts is controlled by the input (k) -- its reciprocal value is presented on an output pin (kreciprocal) for connection to axis.L.eoffset-scale. The default value for k should be suitable for most uses.

The built-in functions use pins fmult and rfraction to control the output frequency (or number of polygon sides) and amplitude respectively. The rfraction pin controls the offset amplitude as a fraction of the radius-ref pin.

One of the four built-in functions is specified by the fnum pin:

0: f0 inside polygon (requires fmult == nsides >= 3)

1: f1 outside polygon (requires fmult == nsides >= 3)

2: f2 sinusoid

3: f3 square wave

Unsupported fnum values default to use function f0.

## FUNCTIONS
eoffset-per-angle.N (requires a floating-point thread)

## PINS
eoffset-per-angle.N.active bit in (default: 0)

From: motion.eoffset-active

eoffset-per-angle.N.is-on bit in (default: 0)

From: halui.machine.is-on

eoffset-per-angle.N.enable-in bit in (default: 0)

Enable Input

eoffset-per-angle.N.radius-ref float in (default: 1)

Radius reference (see notes)

eoffset-per-angle.N.angle float in (default: 0)

Input angle (in degrees)

eoffset-per-angle.N.start-angle float in (default: 0)

Start angle (in degrees)

eoffset-per-angle.N.fnum s32 in (default: 0)

Function selector (default 0)

eoffset-per-angle.N.rfraction float in (default: 0.1)

Offset amplitude (+/- fraction of radius_ref)

eoffset-per-angle.N.fmult float in (default: 6)

Offset frequency multiplier

eoffset-per-angle.N.k u32 in (default: 10000)

Scaling Factor (if 0, use 10000)

eoffset-per-angle.N.is-off bit out

invert is_on (for convenience)

eoffset-per-angle.N.enable-out bit out

To: axis.L.eoffset-enable

eoffset-per-angle.N.clear bit out

To: axis.L.eoffset-clear

eoffset-per-angle.N.kcounts s32 out

To: axis.L.eoffset-counts

eoffset-per-angle.N.kreciprocal float out

To: axis.L.eoffset-scale (1/k)

eoffset-per-angle.N.eoffset-dbg float out

offset (debug pin--use kcounts & kreciprocal)

eoffset-per-angle.N.state-dbg u32 out

state (debug pin)

## EXAMPLES
An example simulation configuration is provided at: configs/sim/axis/external_offsets/opa.ini. A simulated XZC machine uses the C coordinate angle to offset the transverse X coordinate according to the selected fnum function.

## NOTES
radius-ref: The computed offsets are based on the radius-ref pin value. This pin may be set to a constant radius value or controlled by a user interface or by g code program (using M68 and a motion.analog-out-NN pin for instance).

Stopping: When the enable-in pin is deasserted, the offset is returned to zero respecting the allocated acceleration and velocity limits. The allocations for coordinate L are typically controlled by an ini file setting: [AXIS_L]OFFSET_AV_RATIO.

If unsupported parameters are supplied to a function (for instance a polygon with fewer than three sides), the current offset will be returned to zero (respecting velocity and acceleration constraints). After correcting the offending parameter, the enable-in pin must be toggled to resume offset computations.

## AUTHOR
Dewey Garrett

## LICENSE
GPL


title: estop_latch(9)

summary: Software ESTOP latch

text:
# estop_latch(9)

## NAME
estop_latch - Software ESTOP latch

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

## DESCRIPTION
This component can be used as a part of a simple software ESTOP chain.

It has two states: "OK" and "Faulted".

The initial state is "Faulted". When faulted, the out-ok output is false, the fault-out output is true, and the watchdog output is unchanging.

The state changes from "Faulted" to "OK" when all these conditions are true:

- fault-in is false

- ok-in is true

- reset changes from false to true

When "OK", the out-ok output is true, the fault-out output is false, and the watchdog output is toggling.

The state changes from "OK" to "Faulted" when any of the following are true:

- fault-in is true

- ok-in is false

To facilitate using only a single fault source, ok-in and fault-en are both set to the non-fault-causing value when no signal is connected. For estop-latch to ever be able to signal a fault, at least one of these inputs must be connected.

Typically, an external fault or estop input is connected to fault-in, iocontrol.0.user-request-enable is connected to reset, and ok-out is connected to iocontrol.0.emc-enable-in.

In more complex systems, it may be more appropriate to use classicladder to manage the software portion of the estop chain.

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

## PINS
estop-latch.N.ok-in bit in (default: true)

estop-latch.N.fault-in bit in (default: false)

estop-latch.N.reset bit in

estop-latch.N.ok-out bit out (default: false)

estop-latch.N.fault-out bit out (default: true)

estop-latch.N.watchdog bit out

## AUTHOR
John Kasunich

## LICENSE
GPL


feedcomp

title: feedcomp(9)

text:
# feedcomp(9)

## NAME
feedcomp - Multiply the input by the ratio of current velocity to the feed rate.

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

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

## PINS
feedcomp.N.out float out

Proportionate output value

feedcomp.N.in float in

Reference value

feedcomp.N.enable bit in

Turn compensation on or off.

feedcomp.N.vel float in

Current velocity

## PARAMETERS
feedcomp.N.feed float rw

Feed rate reference value

## NOTES
Note that if enable is false, out = in.

## AUTHOR
Eric H. Johnson

## LICENSE
GPL


title: filter_kalman(9)

text:
# filter_kalman(9)

## NAME
filter_kalman - Unidimensional Kalman filter, also known as linear quadratic estimation (LQE)

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

## DESCRIPTION
Useful for reducing input signal noise (e.g. from the voltage or temperature sensor).

More information can be found at https://en.wikipedia.org/wiki/Kalman_filter.

Adjusting Qr and Qk covariances:

Default values of Rk and Qk are given for informational purpose only. The nature of the filter requires the parameters to be individually computed.

One of the possible and quite practical method (probably far from being the best) of estimating the Rk covariance is to collect the raw data from the sensor by either asserting the debug pin or using halscope and then compute the covariance using cov() function from Octave package. Ready to use script can be found at https://github.com/dwrobel/TrivialKalmanFilter/blob/master/examples/DS18B20Test/covariance.m.

Adjusting Qk covariance mostly depends on the required response time of the filter. There is a relationship between Qk and response time of the filter that the lower the Qk covariance is the slower the response of the filter is.

Common practice is also to conservatively set Rk and Qk slightly larger then computed ones to get robustness.

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

Update xk-out based on zk input.

## PINS
filter-kalman.N.debug bit in (default: FALSE)

When asserted, prints out measured and estimated values.

filter-kalman.N.passthrough bit in (default: FALSE)

When asserted, copies measured value into estimated value.

filter-kalman.N.reset bit in (default: FALSE)

When asserted, resets filter to its initial state and returns 0 as an estimated value (reset pin has higher priority than passthrough pin).

filter-kalman.N.zk float in

Measured value.

filter-kalman.N.xk-out float out

Estimated value.

## PARAMETERS
filter-kalman.N.Rk float rw (default: 1.17549e-38)

Estimation of the noise covariances (process).

filter-kalman.N.Qk float rw (default: 1.17549e-38)

Estimation of the noise covariances (observation).

## AUTHOR
Dmian Wrobel <dwrobel@ertelnet.rybnik.pl>

## LICENSE
GPL-2.0-or-later


flipflop

title: flipflop(9)

summary: D type flip-flop

text:
# flipflop(9)

## NAME
flipflop - D type flip-flop

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

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

## PINS
flipflop.N.data bit in

data input

flipflop.N.clk bit in

clock, rising edge writes data to out

flipflop.N.set bit in

when true, force out true

flipflop.N.reset bit in

when true, force out false; overrides set

flipflop.N.out bit io

output

flipflop.N.out-not bit io

inverted output

## AUTHOR
John Kasunich

## LICENSE
GPL


gantry

title: gantry(9)

text:
# gantry(9)

## NAME
gantry - LinuxCNC HAL component for driving multiple joints from a single axis.

## SYNOPSIS
loadrt gantry [count=N|names=name1[,name2...]] [personality=P1,P2,...]

## DESCRIPTION
--- Deprecation Notice

gantry - Superseded by the general purpose 'trivkins' kinematics module.

To specify a gantry with non-identity kinematics: use trivkins with the kinstype parameter set for KINEMATICS_BOTH. Example:

loadrt trivkins coordinates=xyyz kinstypes=BOTH Drives multiple physical motors (joints) from a single axis input

--- End deprecation notice Drives multiple physical motors (joints) from a single axis input

The `personality' value is the number of joints to control. Two is typical, but up to seven is supported (a three joint setup has been tested with hardware).

All controlled joints track the commanded position (with a per-joint offset) unless in the process of homing. Homing is when the commanded position is moving towards the homing switches (as determined by the sign of search-vel) and the joint home switches are not all in the same state. When the system is homing and a joint home switch activates, the command value sent to that joint is "frozen" and the joint offset value is updated instead. Once all home switches are active, there are no more adjustments made to the offset values and all joints run in lock-step once more.

For best results, set HOME_SEARCH_VEL and HOME_LATCH_VEL to the same direction and as slow as practical. When a joint home switch trips, the commanded velocity will drop immediately from HOME_SEARCH_VEL to zero, with no limit on acceleration.

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

Update position-fb and home/limit outputs based on joint values.

gantry.N.write (requires a floating-point thread)

Update joint pos-cmd outputs based on position-cmd in.

## PINS
gantry.N.joint.MM.pos-cmd float out (MM=00..personality)

Per-joint commanded position

gantry.N.joint.MM.pos-fb float in (MM=00..personality)

Per-joint position feedback

gantry.N.joint.MM.home bit in (MM=00..personality)

Per-joint home switch

gantry.N.joint.MM.offset float out (MM=00..personality)

(debugging) Per-joint offset value, updated when homing.

gantry.N.position-cmd float in

Commanded position from motion

gantry.N.position-fb float out

Position feedback to motion

gantry.N.home bit out

Combined home signal, true if all joint home inputs are true.

gantry.N.limit bit out

Combined limit signal, true if any joint home input is true.

gantry.N.search-vel float in

HOME_SEARCH_VEL from INI file

## AUTHOR
Charles Steinkuehler

## LICENSE
GPL


gantrykins

title: gantrykins(9)

text:
# gantrykins(9)

## NAME
gantrykins - Superseded by the general purpose trivkins kinematics module.

To specify a gantry with non-identity kinematics: use trivkins with the kinstype parameter set for KINEMATICS_BOTH. Example:

loadrt trivkins coordinates=xyyz kinstypes=BOTH

## SEE ALSO
trivkins(9)


gearchange

title: gearchange(9)

summary: Select from one two speed ranges

text:
# gearchange(9)

## NAME
gearchange - Select from one two speed ranges

## SYNOPSIS
The output will be a value scaled for the selected gear, and clamped to the min/max values for that gear. The scale of gear 1 is assumed to be 1, so the output device scale should be chosen accordingly. The scale of gear 2 is relative to gear 1, so if gear 2 runs the spindle 2.5 times as fast as gear 1, scale2 should be set to 2.5.

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

## PINS
gearchange.N.sel bit in

Gear selection input

gearchange.N.speed-in float in

Speed command input

gearchange.N.speed-out float out

Speed command to DAC/PWM

gearchange.N.dir-in bit in

Direction command input

gearchange.N.dir-out bit out

Direction output - possibly inverted for second gear

## PARAMETERS
gearchange.N.min1 float rw (default: 0)

Minimum allowed speed in gear range 1

gearchange.N.max1 float rw (default: 100000)

Maximum allowed speed in gear range 1

gearchange.N.min2 float rw (default: 0)

Minimum allowed speed in gear range 2

gearchange.N.max2 float rw (default: 100000)

Maximum allowed speed in gear range 2

gearchange.N.scale2 float rw (default: 1.0)

Relative scale of gear 2 vs. gear 1. Since it is assumed that gear 2 is "high gear", scale2 must be greater than 1, and will be reset to 1 if set lower.

gearchange.N.reverse bit rw (default: 0)

Set to 1 to reverse the spindle in second gear.

## AUTHOR
Stephen Wille Padnos

## LICENSE
GPL


genhexkins

title: genhexkins(9)

text:
# genhexkins(9)

See the file man9/kins.9.


genserkins

title: genserkins(9)

text:
# genserkins(9)

See the file man9/kins.9.


gentrivkins

title: gentrivkins(9)

text:
# gentrivkins(9)

## NAME
gentrivkins - Superseded by the general purpose trivkins kinematics module.

## SEE ALSO
trivkins(9)


gladevcp

title: gladevcp(9)

text:
# gladevcp(9)

## NAME
gladevcp - displays Virtual control Panels built with GTK / GLADE

## SYNOPSIS
loadusr gladevcp [-c componentname0xN] [-g WxH+Xoffset+Yoffset0xN] [-H halcmdfile] [-x windowid] gladefile.glade

## DESCRIPTION
GladeVCP parses a glade file and displays the widgets in a window. Then calls gladevcp_makepins which again parses the gladefile looking for specific HAL widgets then makes HAL pins and sets up updating for them. The HAL component name defaults to the basename of the glade file. The -x option directs GladeVCP to reparent itself under this X window id instead of creating its own toplevel window. The -H option passes an input file for halcmd to be run after the GladeVCP component is initialized. This is used in Axis when running GladeVCP under a tab with the EMBED_TAB_NAME/EMBED_TAB_COMMAND INI file feature.

GladeVCP supports GtkBuilder or libglade files though some widgets are not fully supported in GtkBuilder yet.

## ISSUES
For now, system links need to be added in the glade library folders to point to our new widgets and catalog files. Look in lib/python/gladevcp/READ_ME for details.


title: gray2bin(9)

summary: convert a gray-code input to binary

text:
# gray2bin(9)

## NAME
gray2bin - convert a gray-code input to binary

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

## DESCRIPTION
Converts a gray-coded number into the corresponding binary value

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

## PINS
gray2bin.N.in u32 in

gray code in

gray2bin.N.out u32 out

binary code out

## AUTHOR
Andy Pugh

## LICENSE
GPL


title: hal_bb_gpio(9)

summary: Driver for beaglebone GPIO pins

text:
# hal_bb_gpio(9)

## NAME
hal_bb_gpio - Driver for beaglebone GPIO pins

## SYNOPSIS
loadrt hal_bb_gpio user_leds=#,... input_pins=#,... output_pins=#,...

## USER LEDS
The user_leds loadrt parameter controls which LEDs are available to HAL. Valid range: 0..3. These LEDs are next to the ethernet jack and the LinuxCNC numbers match the silkscreen on beaglbone black. Empirically, these seem to be OR'd with whatever function is assigned to the LED in Linux.

### PINS
bb_gpio.userledN bit in

bb_gpio.userledN-invert bit in

The associated LED is lit if userledN xor userledN-invert is TRUE.

## INPUT PINS
The input_pins loadrt parameter controls which physical I/O pins are available to HAL as input pins. The numbering is "800+N" for pin N on connector P8, and "900+N" for pin N on connector P9. For example, "803" means connector P8 pin 3, which is also described in BeagleBone documentation as "gpmc_ad6".

Specifying pins that are otherwise in use by the system may have undesirable side effects, such as crashing rtapi_app or the whole system.

### PINS
bb_gpio.pN.in-NN bit out

bb_gpio.pN.in-NN-invert bit in

in-NN is a snapshot of the value of the corresponding physical pin XOR the value of the corresponding in-NN-invert pin.

## OUTPUT PINS
The input_pins loadrt parameter controls which physical I/O pins are available to HAL as input pins. The numbering is "800+N" for pin N on connector P8, and "900+N" for pin N on connector P9.

Specifying pins that are otherwise in use by the system may have undesirable side effects, such as crashing rtapi_app or the whole system.

### PINS
bb_gpio.pN.out-NN bit out

bb_gpio.pN.out-NN-invert bit in

The corresponding physical pin is driven with the result of in-NN xor in-NN-invert.

## PARAMETERS
None

## FUNCTIONS
bb_gpio.read

Update HAL pins from physical pins.

bb_gpio.write

Update physical pins from HAL pins.

## LICENSE
GPL


title: hal_parport(9)

text:
# hal_parport(9)

## NAME
hal_parport - Realtime HAL component to communicate with one or more pc parallel ports.

## SYNOPSIS
loadrt hal_parport cfg="port_addr [type] [[port_addr [type] ...]"

## DESCRIPTION
The hal_parport component is a realtime component that provides connections from HAL via halpins to the physical pins of one or more parallel ports. It provides a read and write function to send and receive data to the attached parallel port(s).

The hal_parport component supports up to 8 physical parallel ports.

## OPTIONS
cfg="port_addr [type] [[port_addr [type] ...]"

The cfg string tells hal_parport the address(es) of the parallel port(s) and whether the port(s) is/are used as an input or output port(s). Up to eight parallel ports are supported by the component.

The port_addr parameter of the configuration string may be either the physical base address of a parallel port or specified as the detected parallel port via Linux parport_pc driver. In which case, a port_addr of 0 is the first parallel port detected on the system, 1 is the next, and so on.

The type parameter of the configuration string determines how the I/O bits of the port are used. There are four possible options and if none is specified will default to out.

in - Sets the 8 bits of the data port to input. In this mode the parallel port has a total of 13 input pins and 4 output pins.

out - Sets the 8 bits of the data port to output. In this mode the parallel port has a total of 5 input pins and 12 output pins.

epp - This option is the same as setting to out, but can cause the computer to change the electrical characteristics of the port, see USAGE below.

x - The option allows ports with open collectorts on the control group pins to be configured as inputs resulting in 8 output pins and 9 input pins, see USAGE below.

## PINS
The pins created by the hal_parport component depends on how it is configured in the cfg="" string passed to it, see OPTIONS.

parport.<p>.pin-<n>-out (bit) Drives a physical output pin.

parport.<p>.pin-<n>-in (bit) Tracks a physical input pin.

parport.<p>.pin-<n>-in-not (bit) Tracks a physical input pin, but inverted.

For each pin created, <p> is the port number, and <n> is the physical pin number in the 25 pin D-shell connector.

For each physical output pin, the driver creates a single HAL pin, for example: parport.0.pin-14-out.

For each physical input pin, the driver creates two HAL pins, for example: parport.0.pin-12-in and parport.0.pin-12-in-not.

The -in HAL pin is TRUE if the physical pin is high, and FALSE if the physical pin is low. The -in-not HAL pin is inverted and is FALSE if the physical pin is high.

The following lists the input and output pins by the type setting used in the cfg="" string.

in: Pins 2,3,4,5,6,7,8,9,10,11,12,13,15 are input pins and pins 1,14,16 and 17 are output pins.

out/epp: Pins 10,11,12,13 and 15 are input pins and pins 1,2,3,4,5,6,7,8,9,14,16 and 17 are output pins.

x: Pins 1,10,11,12,13,14,15,16 and 17 are input pins and pins 2,3,4,5,6,7,8,9 are output pins. (See USAGE section.)

## PARAMETERS
parport.<p>.pin-<n>-out-invert (bit)

Inverts an output pin.

parport.<p>.pin-<n>-out-reset (bit)

(only for out pins) TRUE if this pin should be reset when the .reset function is executed.

parport.<p>.reset-time' (U32)

The time (in nanoseconds) between a pin is set by write and reset by the reset function if it is enabled.

## FUNCTIONS
parport.<p>.read(funct)

Reads physical input pins of port <portnum> and updates HAL -in and -in-not pins.

parport.read-all (funct)

Reads physical input pins of all ports and updates HAL -in and -in-not pins.

parport.<p>.write (funct)

Reads HAL -out pins of port <p> and updates that port's physical output pins.

parport.write-all (funct)

Reads HAL -out pins of all ports and updates all physical output pins.

parport.<p>.reset (funct)

Waits until reset-time has elapsed since the associated write, then resets pins to values indicated by -out-reset and -out-invert settings. Reset must be later in the same thread as write. 'If '-out-reset is TRUE, then the reset function will set the pin to the value of -out-invert. This can be used in conjunction with stepgen's doublefreq to produce one step per period. The stepgen stepspace for that pin must be set to 0 to enable doublefreq.

## USAGE
The hal_parport component is a driver for the traditional PC parallel port. The port has a total of 25 physical pins of which 17 are used for signals. The original parallel port divided those pins into three groups: data, control, and status. The data group consists of 8 output pins, the control group consists of 4 output pins, and the status group consists of 5 input pins.

In the early 1990's, the bidirectional parallel port was introduced, which allows the data group to be used for output or input. The HAL driver supports the bidirectional port, and allows the user to set the data group as either input or output. If configured as out, a port provides a total of 12 outputs and 5 inputs. If configured as in, it provides 4 outputs and 13 inputs.

In some parallel ports, the control group pins are open collectors, which may also be driven low by an external gate. On a board with open collector control pins, if configured as x, it provides 8 outputs, and 9 inputs.

In some parallel ports, the control group has push-pull drivers and cannot be used as an input.

Note: HAL and Open Collectors

HAL cannot automatically determine if the x mode bidirectional pins are actually open collectors (OC). If they are not, they cannot be used as inputs, and attempting to drive them LOW from an external source can damage the hardware. To determine whether your port has open collector pins, load hal_parport in x mode. With no device attached, HAL should read the pin as TRUE. Next, insert a 470 ohm resistor from one of the control pins to GND. If the resulting voltage on the control pin is close to 0V, and HAL now reads the pin as FALSE, then you have an OC port. If the resulting voltage is far from 0V, or HAL does not read the pin as FALSE, then your port cannot be used in x mode.

The external hardware that drives the control pins should also use open collector gates (e.g., 74LS05).

On some computers, BIOS settings may affect whether x mode can be used. SPP mode is most likely to work.

No other combinations are supported, and a port cannot be changed from input to output once the driver is installed.

The parport driver can control up to 8 ports (defined by MAX_PORTS in hal_parport.c). The ports are numbered starting at zero.

Loading the hal_parport component

The hal_parport driver is a real time component so it must be loaded into the real time thread with loadrt. The configuration string describes the parallel ports to be used, and (optionally) their types. If the configuration string does not describe at least one port, it is an error.

loadrt hal_parport cfg="port [type] [port [type] ...]"

Specifying the Port

Numbers below 16 refer to parallel ports detected by the system. This is the simplest way to configure the hal_parport driver, and cooperates with the Linux parport_pc driver if it is loaded. A port of 0 is the first parallel port detected on the system, 1 is the next, and so on.

Basic configuration

This will use the first parallel port Linux detects:

loadrt hal_parport cfg="0"

Using the Port Address

Instead, the port address may be specified using the hex notation 0x then the address.

loadrt hal_parport cfg="0x378"

Specifying a port Type

For each parallel port handled by the hal_parport driver, a type can optionally be specified. The type is one of in, out, epp, or x.

If the type is not specified, the default is out.

A type of epp is the same as out, but the hal_parport driver requests that the port switch into EPP mode. The hal_parport driver does not use the EPP bus protocol, but on some systems EPP mode changes the electrical characteristics of the port in a way that may make some marginal hardware work better. The Gecko G540's charge pump is known to require this on some parallel ports.

See the Note above about mode x.

Example with two parallel ports

This will enable two system-detected parallel ports, the first in output mode and the second in input mode:

loadrt hal_parport cfg="0 out 1 in"

Functions single port

You must also direct LinuxCNC to run the read and write functions.

addf parport.read-all base-thread

addf parport.write-all base-thread

Functions multiple ports

You can direct LinuxCNC to run the read and write functions for all the attached ports.

addf parport.0.read base-thread

addf parport.0.write base-thread

The individual functions are provided for situations where one port needs to be updated in a very fast thread, but other ports can be updated in a slower thread to save CPU time. It is probably not a good idea to use both an -all function and an individual function at the same time.

## SEE ALSO
Parallel Port Driver (Hardware Drivers Section of LinuxCNC Docs), PCIParallelPortExample(HardwareExamplesSectionofLinuxCNCDocs)

## AUTHOR
This man page written by Joe Hildreth as part of the LinuxCNC project. Most of this information was taken from the parallel-port docs located in the Hardware Drivers section of the documentation. To the best of my knowledge that documentation was written by Sebastian Kuzminsky and Chris Radek.