Using GPI/O devices in Helm

Helm supports various GPI/O devices, allowing panels to control external legacy equipment, and to receive status and tallies from external equipment.

Output Controls

Control of GPI/O Outputs is straightfoward. Each GPI device provides commands to turn outputs on and off, and to pulse outputs.

From Lua:

H.Device:SwitchOn(1) -- Switch output 1 on
H.Device:SwitchOff() - Switch output 2 off
H.Device:PulseOn(3, 100) - Pulse output 3 on  for 100ms, then off
H.Device:PulseOff(3, 100) - Pulse output 3 off  for 100ms, then back off

You can read the current state of the outputs using the OutputState property. This is a string of 1’s and 0’s – Note this is least-significant bit first, to allow for large GPI devices and easy indexing.

An OnOutputStateChange event occurs whenever the state changes. This will also occur when the panel starts up.

Input Events

Each input line has an associated OnInputXOn and OnInputXOff event, allowing scripts for a particular line to be easily isolated.

As above, there is also an InputState property, and an OnInputStateChange event .

To access individual ‘bits’ from the InputState or OutputState, the following Lua function may be used.

function bit(s,v)
  return s:sub(v,v) == '1'

-- Example use, to check input 4.

if bit(H.BFE.InputState, 4) then H.LABEL.Text = "Pressed!"