You are here

GPIO_GET_CMP_CFG (0x10)

The GPIO_GET_CMP_CFG command retrieves the configuration settings of the GPIO-24 adaptor comparator module.

GPIO_GET_CMP_CFG Command

Go to Response

Byte 0 GPIO_GET_CMP_CFG Command ID (0x10).
Byte 1 ECHO Echo to associate a command with the response.
Bytes 2..7 Reserved Reserved (must be 0).

Command is an 8-byte array of the following format:

Byte 0: GPIO_SET_OUT_VAL (0x10)

This byte contains command ID (command type). It should be set to 0x10.

Byte 1: ECHO

This byte is used to associate a response received from GPIO-24 adapter with a specific command. Response will contain exactly the same value in its echo byte.

Bytes 2..7: Reserved

These bytes are reserved for future usage and must be set to 0.

For convenience GPIO_GET_CMP_CFG_CMD structure is declared in reports.h file.

GPIO-24 adapter sends GPIO_GET_CMP_CFG response after command execution. Comparator module configuration settings are specified inside the response.

GPIO_GET_CMP_CFG Response

Go to Command

The GPIO_GET_CMP_CFG response doesn't contain ST (execution status) byte due to limited response size (8 bytes). The GPIO_GET_CMP_CFG response will always contain GPIO_ST_SUCCESS (0x0).

Byte 0 GPIO_GET_CMP_CFG Response ID (0x0F).
Byte 1 ECHO Echo to associate a command with the response.
Byte 2 CMP_CFG Bit 7 Reserved Reserved
Bit 6 CIS Comparator Input Switch bit.
Bit 5 CMP0_INV CMP0 comparator output inversion bit.
Bit 4 CMP1_INV CMP1 comparator output inversion bit.
Bit 3..0 MODE Operation mode for the USB-I/O adapter comparators.
Byte 3 VREF Bit 7 Reserved Reserved
Bit 6 OUTPUT CVREF output.
Bit 5 EXT_SOURCE Voltage source (internal or external).
Bit 4 RANGE Range of output values (CVREF).
Bits 3..0 MULTIPLIER  
Byte 4 REPEAT0_LSB Least significant bits of repeat interval value for CMP0 comparator.
Byte 5 REPEAT0_MSB / COND0 Bits 7..4 REPEAT0_MSB Most significant bits of repeat interval value for CMP0 comparator.
Bits 3..0 COND0 Low nibble of byte 5 defines when USB-I/O adapter sends events for CMP0 comparator.
Byte 6 REPEAT1_LSB Least significant bits of repeat interval value for CMP1 comparator.
Byte 7 REPEAT1_MSB / COND1 Bit 7..4 REPEAT1_MSB Most significant bits of repeat interval value for CMP1 comparator.
Bit 3..0 COND1 Low nibble of byte 5 defines when USB-I/O adapter sends events for CMP1 comparator.

Response is an 8-byte array of the following format:

Byte 0: GPIO_GET_CMP_CFG (0x0F)

This byte contains response ID (response type). This byte will contain 0x0F.

Byte 1: ECHO

This byte is used to associate a response received from GPIO-24 adapter with a specific command. Response will contain exactly the same value in its echo byte.

Byte 2: CMP_CFG
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3..0
Reserved CIS CMP0_INV CMP1_INV MODE
Bit 7: Reserved

This bit is reserved for future usage.

Bit 6: CIS

Comparator Input Switch bit. The comparator input switch bit is used only in Four Inputs Multiplexed to Two Comparators mode (MODE = 6).

If CIS = 0:

  • C.1 pin is connected to CMP0 VIN-;

  • C.2 pin is connected to CMP1 VIN-.

If CIS = 1:

  • C.6 pin is connected to CMP0 VIN-;

  • C.5 pin is connected to CMP1 VIN-.

Bit 5: CMP0_INV

CMP0 comparator output inversion bit.

If CMP0_INV = 1, CMP0 comparator output is inverted:

  • 1, if VIN+ < VIN-;

  • 0, if VIN+ > VIN-.

If CMP0_INV = 0, CMP0 comparator output is not inverted:

  • 1, if VIN+ > VIN-;

  • 0, if VIN+ < VIN-.

When C.4 I/O pin is used to output comparator results, its output is also inverted (MODE = 1, 3 or 5).

Bit 4: CMP1_INV

CMP1 comparator output inversion bit.

If CMP1_INV = 1, CMP1 comparator output is inverted:

  • 1, if VIN+ < VIN-;

  • 0, if VIN+ > VIN-.

If CMP1_INV = 0, CMP1 comparator output is not inverted:

  • 1, if VIN+ > VIN-;

  • 0, if VIN+ < VIN-.

When B.3 I/O pin is used to output comparator results, its output is also inverted (MODE = 3 or 5).

Bits 3-0: MODE

The operation mode USB-I/O adapter comparator module. There are eight operation modes, they are described in Section 8.1, “Modes of operation for comparator module”.

Byte 3: VREF

This byte is used to retrieve comparator voltage reference module configuration. For more detailed information see Section 8.2, “Comparator voltage reference module”.

The comparator voltage reference module is only available in Four Inputs Multiplexed to Two Comparators mode (MODE = 6). In other modes this byte is reserved and must be ignored.

Voltage reference module configuration (VREF) is a bit field of the following format:

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3..0
Reserved OUTPUT EXT_SOURCE RANGE MULTIPLIER
Bit 7: Reserved

This bit is reserved for future usage.

Bit 6: OUTPUT

Voltage reference module may also output the voltage reference (CVREF) onto C.5 I/O pin:

  • If OUTPUT = 1, CVREF is output on C.5 I/O pin;

  • If OUTPUT = 0, CVREF is disconnected from C.5 I/O pin.

You can use the C.5 pin to check the reference voltage with oscilloscope. Due to the limited current drive capability, a buffer must be used on the voltage reference output for external connections to CVREF.

Bit 5: EXT_SOURCE

The comparator reference voltage module’s power supply may be provided either from the GPIO-24 adapter VDD/VSS or from an external source.

  • If EXT_SOURCE = 1, the voltage reference module uses C.5 (VREF+) and C.6 (VREF-) pins as voltage source:

    CVRSRC = VREF+- VREF-

  • If EXT_SOURCE = 0, the voltage reference module uses USB-I/O adapter positive (VDD) and negative (VSS) supply as voltage source:

    CVRSRC = VDD – VSS

Bit 4: RANGE

The comparator voltage reference module provides two ranges of output voltage (CVREF), each with 16 distinct levels. Use Bit 4: RANGE to determine which range has been selected. The primary difference between the ranges is the size of the steps selected with Bits 3-0: MULTIPLIER. That is why one range offers finer resolution but shorter interval of possible values (RANGE = 0).

Bits 3-0: MULTIPLIER

With Bits 3-0: MULTIPLIER you can determine the output voltage (CVREF) of voltage reference module.

Use the following equations to calculate the CVREF:

If RANGE = 1:

CVREF = (CVRSRC /24) x MULTIPLIER;

MULTIPLIER = 24* (CVREF/ CVRSRC).

If RANGE = 0:

CVREF = (CVRSRC /4) + ((CVRSRC /32) x MULTIPLIER);

MULTIPLIER = 32*( CVREF / CVRSRC) – 8.

Use Bit 5: EXT_SOURCE to determine CVRSRC.

Byte 4: REPEAT0_LSB

Byte 4: REPEAT0_LSB contains 8 least significant bits of repeat interval value for CMP0 comparator. For more detailed information see Section 8.3, “Comparator module event”.

Byte 5: REPEAT0_MSB / COND0
Bits 7..4 Bits 3..0
REPEAT0_MSB COND0
Bits 7..4 REPEAT0_MSB

Bits 7..4 REPEAT0_MSB are 4 most significant bits of repeat interval value for CMP0 comparator. For more detailed information see Section 8.3, “Comparator module event”.

Bits 3..0 COND0

The low nibble of Byte 5 defines when USB-I/O adapter sends events (GPIO_EV_CMP) for CMP0 comparator:

GPIO_CMP_EV_NONE (0x00)

The comparator does not send events.

GPIO_CMP_EV_CHANGE (0x01)

The event is sent when the comparison result changes.

GPIO_CMP_EV_ALWAYS (0x02)

The event is sent periodically with the predefined repeat interval. This interval value is specified in Byte 4: REPEAT0_LSB (8 least significant bits) and Bits 7..4 REPEAT0_MSB in Byte 5 (4 most significant bits).

Byte 6: REPEAT1_LSB

The bits of Byte 6: REPEAT1_LSB are 8 least significant bits of repeat interval value for CMP1 comparator. For more detailed information see Section 8.3, “Comparator module event”.

Byte 7: REPEAT1_MSB / COND1
Bits 7..4 Bits 3..0
REPEAT1_MSB COND1
Bits 7..4 REPEAT1_MSB

Bits 7..4 REPEAT1_MSB are 4 most significant bits of repeat interval value for CMP1 comparator. For more detailed information see Section 8.3, “Comparator module event”.

Bits 3..0 COND1

The low nibble of byte 7 defines when USB-I/O adapter sends events (GPIO_EV_CMP) for CMP1 comparator:

GPIO_CMP_EV_NONE (0x00)

The comparator does not send events.

GPIO_CMP_EV_CHANGE (0x01)

The event is sent when the comparison result changes.

GPIO_CMP_EV_ALWAYS (0x02)

The event is sent periodically with the predefined repeat interval. This interval value is specified in Byte 6: REPEAT1_LSB (8 least significant bits) and Bits 7..4 REPEAT1_MSB in Byte 7 (4 most significant bits).

For convenience GPIO_GET_CMP_CFG_RSP structure is declared in reports.h file.