HAL Pins

Note

Dynamic Property names are case sensitive and must be all lower case. Hal types and directions are case sensitive and must be all caps. The function value must be lower case.

Note

Hal pin names can containe a-z, A-Z, 0-9, underscore _, or dash -.

Button

Any QPushButton, QCheckBox or QRadioButton can be assigned to a HAL bit pin by adding four string type Dynamic Properties. The pin_name used will create a HAL pin prefixed with flexhal. A pin_name of my-button would be in HAL flexhal.my-button.

HAL Push Button

Property Name

Pin Value

function

hal_pin

pin_name

any unique name

hal_type

HAL_BIT

hal_dir

HAL_OUT

Spinbox

Any QSpinBox or QDoubleSpinBox can be a HAL number pin by adding four string type Dynamic Properties. The pin_name used will create a HAL pin prefixed with flexhal. A pin_name of my-spinbox would be in HAL flexhal.my-spinbox.

HAL Spin Box

Property Name

Pin Value

function

hal_pin

pin_name

any unique name

hal_type

HAL_FLOAT or HAL_S32 or HAL_U32

hal_dir

HAL_OUT

Note

A QSpinBox can only be HAL_S32 or HAL_U32 data type. A QDoubleSpinBox can only be HAL_FLOAT data type.

Slider

A QSlider can be a HAL pin by adding these four string type Dynamic Properties. The pin_name used will create a HAL pin prefixed with flexhal. A pin_name of my-slider would be in HAL flexhal.my-slider.

HAL Slider

Property Name

Pin Value

function

hal_pin

pin_name

any unique name

hal_type

HAL_S32 or HAL_U32

hal_dir

HAL_OUT

Label

A QLabel can be used to monitor HAL pins. HAL connections must be made in the post gui HAL file. The pin_name used will create a HAL pin prefixed with flexhal. A pin_name of my-reader would be in HAL flexhal.my-reader.

HAL Label

Property Name

Pin Value

function

hal_pin

pin_name

any unique name

hal_type

HAL_BIT or HAL_FLOAT or HAL_S32 or HAL_U32

hal_dir

HAL_IN

..note:: A HAL_FLOAT QLabel can have a string Dynamic Property called

precision with a value of the number of decimal digits.

LCD

A QLCDNumber can be used to monitor HAL pins. HAL connections must be made in the post gui HAL file. The pin_name used will create a HAL pin prefixed with flexhal. A pin_name of my-reader would be in HAL flexhal.my-reader.

HAL LCD

Property Name

Pin Value

function

hal_pin

pin_name

any unique name

hal_type

HAL_FLOAT or HAL_S32 or HAL_U32

hal_dir

HAL_IN

Note

A HAL_FLOAT QLCDNumber can have a string Dynamic Property called precision with a value of the number of decimal digits.

Pin Types:

HAL_BIT
HAL_FLOAT
HAL_S32
HAL_U32

Pin Directions:

HAL_IN
HAL_OUT
HAL_IO

Currently only HAL_BIT with HAL_OUT have been tested.

Warning

By default, no QRadioButtons are checked unless you set one checked in the Designer. Starting up with none checked could be a problem if you expect one to be selected at startup.

Step by Step

Note

This example is for a QPushButton

You can use a QPushButton as a momentary output, or with checkable selected for a toggle type output, or QCheckBox or QRadioButton for a HAL output control.

Drag the widget into the GUI and the widget can have any name you like; names are not used by HAL controls in Flex GUI - it is the following that matters.

Click on the widget to select it then click on the green plus sign in the Property Editor for that widget to add a Dynamic Property and select String

_images/hal-01.png

Set the Property Name to function and click Ok

_images/hal-02.png

Set the Value to hal_pin; this tells Flex GUI that this widget is going to be for a HAL pin

_images/hal-03.png

Add another string Dynamic Property named pin_name and set the value to any unique name

_images/hal-04.png

Add another Dynamic Property named hal_type and set the value to HAL_BIT

_images/hal-05.png

Add another Dynamic Property named hal_dir and set the value to HAL_OUT

_images/hal-06.png

If you added Show HAL to your menu, you can open up the Halshow program and view the pin names

_images/hal-07.png

The pin names will all start with flexhal plus the unique name you gave them

_images/hal-08.png

Now you can connect the Flex HAL pin in the postgui.hal file like normal

net some-signal-name flexhal.hal-test-01 => some-other-pin-in

After installing Flex GUI, from the CNC menu, you can copy the Flex GUI examples and look at the hal-btn example.

Homed Required

If the HAL button requires all joints to be homed before being enabled, you can specifiy that by adding a Dynamic Property named required and set the value to homed.

_images/hal-09.png