The GPIO_GET_CMP_CFG command retrieves the configuration settings of the GPIO-24 adaptor comparator module.
| 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:
This byte contains command ID (command type). It should be set to 0x10.
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.
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.
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:
This byte contains response ID (response type). This byte will contain 0x0F.
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.
This bit is reserved for future usage.
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-.
C.6 pin is connected to CMP0 VIN-;
C.5 pin is connected to CMP1 VIN-.
CMP0 comparator output inversion bit.
If CMP0_INV = 1, CMP0 comparator output is inverted:
1, if VIN+ < VIN-;
0, if VIN+ > VIN-.
1, if VIN+ > VIN-;
0, if VIN+ < VIN-.
I/O pin is
used to output comparator results, its output is also
inverted (MODE =
1, 3 or 5).CMP1 comparator output inversion bit.
If CMP1_INV = 1, CMP1 comparator output is inverted:
1, if VIN+ < VIN-;
0, if VIN+ > VIN-.
1, if VIN+ > VIN-;
0, if VIN+ < VIN-.
I/O pin is
used to output comparator results, its output is also
inverted (MODE =
3 or 5).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”.
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 |
This bit is reserved for future usage.
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.
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
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).
With Bits 3-0: MULTIPLIER you can determine the output voltage (CVREF) of voltage reference module.
Use the following equations to calculate the CVREF:
CVREF = (CVRSRC /24) x MULTIPLIER;
MULTIPLIER = 24* (CVREF/ CVRSRC).
CVREF = (CVRSRC /4) + ((CVRSRC /32) x MULTIPLIER);
MULTIPLIER = 32*( CVREF / CVRSRC) – 8.
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”.
| Bits 7..4 | Bits 3..0 |
|---|---|
| REPEAT0_MSB | COND0 |
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”.
The low nibble of Byte 5 defines when USB-I/O adapter sends events (GPIO_EV_CMP) for CMP0
comparator:
The comparator does not send events.
The event is sent when the comparison result changes.
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).
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”.
| Bits 7..4 | Bits 3..0 |
|---|---|
| REPEAT1_MSB | COND1 |
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”.
The low nibble of byte 7 defines when USB-I/O adapter sends events (GPIO_EV_CMP) for CMP1
comparator:
The comparator does not send events.
The event is sent when the comparison result changes.
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.