CALCulate:COMPare:DATA[:<width>]

34980A

CALCulate:COMPare:DATA[:<width>]

Syntax

CALCulate:COMPare:DATA[:<width>] <data>, (@<ch_list>)

CALCulate:COMPare:DATA? (@<ch_list>)

Description

This command sets the digital data for pattern comparisons on the specified digital input channels. You can use the pattern comparison feature to generate an alarm or hardware interrupt condition (34950A only) when a specific digital pattern is detected. Pattern comparisons always start on the lowest-numbered channel in the bank and extend to all channels involved in the channel width (see CONFigure:DIGital:WIDTh command).

Used With:

  • 34950A Digital I/O Module (digital input channels only)

  • 34952A Multifunction Module (digital input channels only)

Parameters

Name

Type

Range of Values

Default Value

<width>

Discrete

{BYTE|1|WORD|2|LWORd|4}

BYTE (or "1" byte):  8 bits
WORD (or "2" bytes):  16 bits
LWORd (or "4" bytes):  32 bits

BYTE (8 bits)

<data>

Numeric

Specify the bit pattern as a decimal, binary, or hexadecimal value.

For binary, "#B" must be added as a prefix (e.g., #B11001100).
For hex, "#H" must be added as a prefix (e.g., #HCC).

This is a required parameter

<ch_list>

Numeric

One or more digital input channels in the form (@sccc).

34950A: s101 through s104, s201 through s204
34952A: s001 through s004

This is a required parameter

Remarks

  • Depending on the width specified, the channel numbering is modified as shown below. For example, if you specify the width as a 16-bit WORD on the 34950A, channels 101 and 102 are combined and addressed collectively as channel 101.  

    34950A

    Bank 2

    Bank 1

    BYTE (8 Bits):

    Ch 204

    Ch 203

    Ch 202

    Ch 201

    Ch 104

    Ch 103

    Ch 102

    Ch 101

    WORD (16 Bits):

    Ch 203

    Ch 201

    Ch 103

    Ch 101

    LWORd (32 Bits):

    Ch 201

    Ch 101

     

     

     

    34952A

    Bank 1

     

    BYTE (8 Bits):

    Ch 4

    Ch 3

    Ch 2

    Ch1

     

    WORD (16 Bits):

    Ch 3

    Ch 1

     

    LWORd (32 Bits):

    Ch 1

     

  • The channel width takes precedence over the specified digital pattern. If the specified pattern is greater than the channel width, additional bits will be ignored. For example, if you set the channel width to "BYTE" and then specify a pattern of "256" (1 0000 0000), the pattern will be truncated to "0000 0000" (the leading "1" will be ignored).

  • Pattern comparisons are performed on a per-bank basis (i.e., the entire bank is reserved for the pattern comparison). For example, if you are using channels 101 and 102 for pattern comparison (assumes 34950A) and then perform a static read of channel 103, the module will perform a pattern comparison on channels 101 and 102.

  • After specifying the desired digital pattern, use the CALCulate:COMPare:STATe command to enable pattern comparisons on the specified channels. If you want to monitor the state of specific bits, use the CALCulate:COMPare:DATA command in conjunction with the CALCulate:COMPare:MASK command to specify a mask pattern.

  • Use the CALCulate:COMPare:TYPE command to specify whether an alarm or hardware interrupt condition is generated when a specific bit pattern or bit pattern change is detected.

  • For the 34950A only, pattern comparisons can be performed with or without handshaking (see CONFigure:DIGital:HANDshake command). If you are using handshaking, the specified digital pattern is evaluated with each handshaking operation. If you are not using handshaking, the specified digital pattern is evaluated continuously as soon as you enable the pattern comparison mode.

  • For the 34950A only, hardware interrupts are reported on the INTR line (one line is available per bank). See the [SENSe:]DIGital:INTerrupt[:ENABle] command to enable interrupts to be reported.

  • You can use a pattern comparison to start or stop a buffered (memory) transfer. See the [SENSe:]DIGital:MEMory:COMPare:ACTion command for additional information.

  • A Factory Reset (*RST command) clears the digital pattern and turns off the pattern comparison mode. An Instrument Preset (SYSTem:PRESet command) or Card Reset (SYSTem:CPON command) does not clear the data and does not turn off the pattern comparison mode.

Return Format

The query command returns the comparison pattern as a decimal value (binary and hexadecimal values are converted to their decimal equivalents). Multiple responses are separated by commas.

Examples

The following program segment sets the digital pattern for the 34950A in slot 3 and then enables the pattern comparison mode. When the data read from the bank is equal to the comparison pattern, a hardware interrupt will be generated on the INTR line. In this example, handshaking is not used.

CALC:COMP:DATA:BYTE 140,(@3101)  !Set comparison pattern (1000 1100)
DIG:INT:MODE COMPARE,(@3101)  !Interrupt on pattern match
DIG:INT:ENAB ON,(@3101)  !Enables interrupts on channel 101
CALC:COMP:STAT ON,(@3101)  !Enable pattern comparison mode

The following query returns the comparison pattern selected for the 34950A in slot 3.

CALC:COMP:DATA? (@3101)  !Always returns decimal equivalent

Typical Response:  140

The following program segment sets the digital pattern for the 34952A in slot 5 and then enables the pattern comparison mode. When the data read from the bank is equal to the comparison pattern, an alarm will be generated on Alarm 2.

CALC:COMP:DATA:WORD #HF6,(@5001)  !Set comparison pattern (1111 0110)
CALC:COMP:TYPE EQUAL,(@5001)  !Generate alarm on pattern match
OUTP:ALARM2:SOUR (@5001)  !Enable alarms
CALC:COMP:STAT ON,(@5001)  !Enable pattern comparison mode

The following query returns the comparison pattern selected for the 34952A in slot 5.

CALC:COMP:DATA? (@5001)  !Always returns decimal equivalent

Typical Response:  246

See Also

CALCulate:COMPare:MASK

CALCulate:COMPare:STATe

CALCulate:COMPare:TYPE

CONFigure:DIGital:HANDshake

OUTPut:ALARm<n>:SOURce

[SENSe:]DIGital:INTerrupt[:ENABle]

[SENSe:]DIGital:MEMory:COMPare:ACTion

STATus:MODule:SLOT[n]:ENABle