General description

The GPI block reads the value of the general-purpose input (GPI) pins.

The GPI pin locations, numbering, and voltage levels are available in the B-Box RCP datasheet and in the B-Board PRO datasheet.

Simulink 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 bit selects one pin to read.

  • Show simulation input port defines if the simulation input is displayed or not.

PLECS block

Signal specification

The output signal returns a vector containing the values of the GPI pins. The vector size is defined by the number of GPI pin(s) read which is specified by the parameter GPI(s) bit.

Parameters

  • Device ID select which B-Box/B-Board to address when used in a multi-device configuration.

  • GPI pin(s)(vectorizable) selection the 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.

C++ functions

int Gpi_GetBit(unsigned int bit, unsigned int device=0);

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);

Return the whole 16 GPI inputs value 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
  • No labels