GPI - General purpose inputs

The GPI block reads the value of the General Purpose Inputs (GPI). To set the value, use the GPO block.

Signal specification

The output signal returns the value of one GPI pin.

Parameters

  • Device ID selects which B-Box/B-Board to address when used in a multi-device configuration.
  • GPI pin(s) (vectorizable) a selection of GPI pin(s) to read. It can be a single value or a vector.
  • Show simulation input port defines if the simulation input is displayed or not.
GPI Simulink dialog

PLECS block

Signal specification

The output signal returns the value of one GPI pin.

General purpose inputs PLECS block

Parameters

  • Device ID selects which B-Box/B-Board to address when used in a multi-device configuration.
  • GPI pin(s) (vectorizable) a selection of GPI pin(s) to read. It can be a single value or a vector.
  • Simulation input port defines if the target inport is displayed or not. This parameter is only used in simulation.
General purpose inputs PLECS dialog parameters

C++ functions

int Gpi_GetBit(unsigned int bit, unsigned int device=0);Code language: C++ (cpp)

Returns the GPI pin value (0 or 1).

It has to be called in the control interrupt routine.

Parameters

  • bit: the GPI pin number
  • device: the id of the addressed device (optional, used in multi-device configuration only)

Return value

  • The GPI pin value (0 or 1)
int Gpi_Get(unsigned int device=0);Code language: C++ (cpp)

Return the whole 16 GPI inputs values in the form of a 16-bit value.

It has to be called in the interrupt.

Parameters

  • device: the id of the addressed device (optional, used in multi-device configuration only)

Return value

  • The whole 16 inputs GPI value in the form of a 16-bit value