XHC-HB04

NAME
DESCRIPTION
UDEV
STANDALONE USAGE
OPTIONS
BUTTON-CFG-FILE FORMAT
HAL USAGE
INPUT PINS (CONTROL)
INPUT PINS (TO THE PENDANT LCD DISPLAY)
OUTPUT PINS (STATUS)
OUTPUT PINS (FOR JOGGING USING AXIS.N.JOG-COUNTS)
EXPERIMENTAL: PINS FOR HALUI PLUS/MINUS JOGGING.
BUTTON OUTPUT PINS (FOR THE 18 BUTTON, LAYOUT2 PENDANT)
SYNTHESIZED BUTTON PINS
DEBUGGING
SIM CONFIGS
AUTHOR

NAME

xhc-hb04 - HAL non-realtime component for the xhc-hb04 pendant.

DESCRIPTION

The xhc-hb04 component supports a common USB pendant that provides a number of pushbuttons, a manual pulse generator (mpg or jog wheel), and a selector switch for the wheel.

There are at least two hardware versions — one with 16 buttons and a more common one with 18 buttons. The information herein is based on the 18 button device with a USB Vendor:Product code of 10CE:EB70.

In addition to buttons, the pendant provides an LCD display for the current stepsize multiplier (from a set of available integer values), position (absolute and relative, labeled MC and WC respectively), feedrate (override percent and value in units per minute), and spindle speed (override percent and value in revolutions per minute (RPM)). The display is managed by a rotary switch that selects one of four axes for wheel positioning, feed override, spindle override, or OFF.

The pendant display, its rotary selector switch, and the component pin names use designators x,y,z,a. While this arrangement presumes a machine configured as XYZA, the pins can be assigned independently as required in a HAL configuration.

UDEV

The xhc-hb04 executable needs permission for reading the pendant’s USB device. Debian package installs (debs) handle this automatically but Run-In-Place (RIP) builds may need a udev rules file. This file should be created (using sudo and a text editor) as:

/etc/udev/rules.d/99-xhc-hb04.rules with the single line:

ATTR{idProduct}=="eb70", ATTR{idVendor}=="10ce", MODE="0666", OWNER="root", GROUP="plugdev"

STANDALONE USAGE

The xhc-hb04 program can be run from the command line without LinuxCNC to test a pendant in a simulation mode. This standalone mode is used to identify the button codes produced for each button press and to verify proper counting of the jog wheel. The identified button codes can be used to create a button-cfg-file. When a button-cfg-file exists, pendant operation can be verified using the -I option to specify the file.

Usage:

$ xhc-hb04 [options]

OPTIONS

-h

list command line options and exit

-I button-cfg-file

see below for file format

-H

run in real-time HAL mode (simulation mode is default)

-x

wait for pendant detection before creating HAL pins.

-s n

n is one of the following stepsize sequences

1: 1,10,100,1000 (default) 2: 1,5,10,20 3: 1,10,100 4: 1,5,10,20,50,100 5: 1,10,50,100,1000

The stepsize selected is always multiplied by 0.001.

BUTTON-CFG-FILE FORMAT

Standard configuration files are provided in the distribution for known button configurations:

/usr/share/linuxcnc/hallib/xhc-hb04-layout1.cfg
/usr/share/linuxcnc/hallib/xhc-hb04-layout2.cfg
or for a RIP build:
rip_base_dir/lib/hallib/xhc-hb04-layout1.cfg
rip_base_dir/lib/hallib/xhc-hb04-layout2.cfg

layout1 describes the 16 button pendant, layout2 describes the more common 18 button pendant.

The button configuration file follows the same format as INI files but should use a file suffix of .cfg.

File format:
[XHC-HB04]
BUTTON=X1:button-thename1
BUTTON=X2:button-thename2
BUTTON=X3:button-thename3
etc.

XN is the code reported for a button press and button-thenameN is the name to be assigned to the pin created for the button.

HAL USAGE

Use the -H option to specify HAL mode and other options as required:

loadusr -W xhc-hb04 -H [options]

Example: loadusr -W xhc-hb04-H -I path_to_cfg_file -s 2

INPUT PINS (CONTROL)

_xhc-hb04.stepsize-up (bit in)

A 1 pulse on this pin changes the stepsize to the next higher stepsize in the stepsize sequence specified in the xhc-hb04 (loadusr) command.

xhc-hb04.stepsize-down (bit in)

A 1 pulse on this pin changes the stepsize to the next lower stepsize in the stepsize sequence specified in the xhc-hb04 (loadusr) command.

INPUT PINS (TO THE PENDANT LCD DISPLAY)

xhc-hb04.[xyza].pos-absolute (float in)

Absolute position display. The LCD display for pos-absolute is fixed format with a sign, 4 number digits and 3 fraction digits (+XXXX.XXX), require: -9999.999 â value â 9999.999 (typically connect to: halui.axis.N.pos-feedback).

xhc-hb04.[xyza].pos-relative (float in)

Relative position display (typically connect to: halui.axis.N.pos-relative). The LCD display for pos-relative is fixed format with a sign, 4 number digits and 3 fraction digits (+XXXX.XXX), require: -9999.999 â value â 9999.999.

xhc-hb04.feed-override (float in)

Feed-override value. The float value is converted to a 16 bit integer and multiplied by 100 in order to display as percent, require: 0 â pinvalue â 655 (typically connect to: halui.feed-override.value).

xhc-hb04.feed-value (float in)

Current Feed-value (units/sec). The float value is converted to a 16 bit integer and multiplied by 60 in order to display as units-per-minute, require: 0 â pinvalue â 1092 (65520 units-per-minute) (typically connect to: motion.current-vel).

xhc-hb04.spindle-override (float in)

Spindle-override value. The float value is converted to a 16 bit integer and multiplied by 100 in order to display as percent, require: 0 â pinvalue â 655) (typically connect to: halui.spindle-override.value).

xhc-hb04.spindle-rps (float in)

Spindle speed in RPS (revolutions per second). The float value is converted to a 16 bit integer and multiplied by 60 in order to display as RPMs, require: 0 â pinvalue â 1092 (65520 RPM) (typically connect to: spindle.N.speed-out-rps-abs).

xhc-hb04.inch-icon (bit in)

Use inch icon (default is mm):

OUTPUT PINS (STATUS)

xhc-hb04.sleeping (bit out)

True when the driver receives a pendant inactive (sleeping) message.

xhc-hb04.jog.enable-off (bit out)

True when the pendant rotary selector switch is in the OFF position or when the pendant is sleeping.

xhc-hb04.enable-[xyza] (bit out)

True when the pendant rotary selector switch is in the [xyza] position and not sleeping.

xhc-hb04.enable-spindle-override (bit out)

True when the pendant rotary selector switch is in the Spindle position and not sleeping (typically connect to: halui.spindle-override-count-enable).

xhc-hb04.enable-feed-override (bit out)

True when the pendant rotary selector switch is in the feed position and not sleeping (typically connect to: halui.feed-override-count-enable).

xhc-hb04.connected (bit out)

True when connection to the pendant is established over the USB interface.

xhc-hb04.require_pendant (bit out)

True if driver started with the -x option.

xhc-hb04.stepsize (s32 out)

Current stepsize in the stepsize sequence as controlled by the stepsize-up and/or stepsize-down pins.

OUTPUT PINS (FOR JOGGING USING AXIS.N.JOG-COUNTS)

xhc-hb04.jog.counts (s32 out)

Number of counts of the wheel since start-up (50 counts per wheel revolution) (typically connect to axis.N.jog-counts (lowpass filtering may be helpful)).

xhc-hb04.jog.counts-neg (s32 out)

The value of the xhc-hb04.jog.counts multiplied by -1.

xhc-hb04.jog.scale (float out)

Value is the current stepsize multiplied by 0.001 (typically connect to axis.N.jog-scale).

EXPERIMENTAL: PINS FOR HALUI PLUS/MINUS JOGGING.

These pins provide some support for non-trivkins, world mode jogging.

xhc-hb04.jog.max-velocity (float in)

Connect to halui.max-velocity.value.

xhc-hb04.jog.velocity (float out)

Connect to halui.jog-speed.

xhc-hb04.jog.plus-[xyza] (bit out)

Connect to halui.jog.N.plus.

xhc-hb04.jog.minus-[xyza] (bit out)

Connect to halui.jog.N.minus.

xhc-hb04.jog.increment (float out)

Debug pin — abs(delta_pos).

BUTTON OUTPUT PINS (FOR THE 18 BUTTON, LAYOUT2 PENDANT)

The output bit type pins are TRUE when the button is pressed.

ROW 1
(bit out) xhc-hb04.button-reset
(bit out) xhc-hb04.button-stop

ROW 2
(bit out) xhc-hb04.button-goto-zero
(bit out) xhc-hb04.button-rewind
(bit out) xhc-hb04.button-start-pause
(bit out) xhc-hb04.button-probe-z

ROW 3
(bit out) xhc-hb04.button-spindle
(bit out) xhc-hb04.button-half
(bit out) xhc-hb04.button-zero
(bit out) xhc-hb04.button-safe-z

ROW 4
(bit out) xhc-hb04.button-home
(bit out) xhc-hb04.button-macro-1
(bit out) xhc-hb04.button-macro-2
(bit out) xhc-hb04.button-macro-3

ROW 5
(bit out) xhc-hb04.button-step
(bit out) xhc-hb04.button-mode
(bit out) xhc-hb04.button-macro-6
(bit out) xhc-hb04.button-macro-7

SYNTHESIZED BUTTON PINS

Additional buttons are synthesized for buttons named zero, goto-zero, and half. These synthesized buttons are active when the button is pressed AND the selector-switch is set to the corresponding axis [xyza].

(bit out) xhc-hb04.button-zero-[xyza]
(bit out) xhc-hb04.button-goto-zero-[xyza]
(bit out) xhc-hb04.button-half-[xyza]

DEBUGGING

For debugging USB activity, use environmental variable LIBUSB_DEBUG:

export LIBUSB_DEBUG=[2 | 3 | 4]; xhc-hb04 [options]

2:warning, 3:info, 4:debug

SIM CONFIGS

The distribution includes several simulation configurations in the directory:

/usr/share/doc/linuxcnc/examples/sample-configs/sim/axis/xhc-hb04/
or for a RIP build:
rip_base_dir/configs/sim/axis/xhc-hb04/

These configurations use a distribution-provided script (xhc-hb04.tcl) to configure the pendant and make necessary HAL connections according to a number of INI file settings. The script uses an additional HAL component (xhc_hb04_util) to provide common functionality and includes support for a standard method for the start-pause button.

The settings available include: 1) specify button-cfg-file for standard layout1 or layout2 2) select axes (up to 4 axes from set of x y z a b c u v w) 3) implement per-axis filtering coefficients 4) implement per-axis acceleration for mpg jogging 5) implement per-axis scale settings 6) select normal or velocity based jog modes 7) select stepsize sequence 8) option to initialize pin for inch or mm display icon 9) option to require pendant on startup

The sim configs illustrate button connections that: 1) connect pendant stepsize-up button to the step input pin. 2) connect buttons to halui.* pins 3) connect buttons to motion.* pins

Another script is included to monitor the pendant and report loss of USB connectivity. See the README and .txt files in the above directory for usage.

The sim configs use the AXIS GUI but the scripts are available with any HAL configuration or GUI. The same scripts can be used to adapt the xhc-hb04 to existing configurations provided that the halui, motion, and axis.N pins needed are not otherwise claimed. Instructions are included in README file in the directory named above.

Use halcmd to display the pins and signals used by the xhc-hb04.tcl script:

halcmd show pin xhc-hb04 (show all xhc-hb04 pins)
halcmd show pin pendant_util (show all pendant_util pins)
halcmd show sig pendant: (show all pendant signals)

AUTHOR

Frederick Rible (frible@teaser.fr)