Main Content

F2807x/F2837xD/F2837xS/F28004x/F2838x/F28002x CMPSS

Compare two input voltages on comparator pins

  • Library:
  • Embedded Coder Support Package for Texas Instruments C2000 Processors / F2807x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F2837xD

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F2837xS

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F28004x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F28002x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F2838x/ C28x

  • F2807x/F2837xD/F2837xS/F28004x/F2838x/F28002x CMPSS block

Description

The Comparator Subsystem consists of two modules, Comparator High (COMPH) and Comparator Low (COMPH). Each module generates a high digital output when the voltage on the first input pin (positive input) is greater than the voltage on the second input pin (negative input). And each module generates a low digital output when the voltage on the first input pin (positive input) is less than the voltage on the second input pin (negative input).

The second input pin can either be the external pin or the DAC module.

Ports

Input

expand all

12-bit DAC reference value is used for the second input pin of the comparator.

The DAC range is between 0 to 4095. Any value outside the range is saturated.

Dependencies

The DAC port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to DAC module

  • Specify DAC/RAMP parameter(s) Via is set to Input port

Ramp reference value used by the ramp generator to create a ramp reference voltage for the second input pin of the comparator.

The REF value should be in the range 0 to 65535. Any value outside the range is saturated.

Dependencies

The REF port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to RAMP module

  • Specify DAC/RAMP parameter(s) Via is set to Input port

  • This port is available only for the COMPH module.

Ramp decrement value used by the ramp generator to create a ramp reference voltage for the second input pin of the comparator.

DEC range is between 0 to 65535. Any value outside the range is saturated.

Dependencies

The DEC port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to RAMP module

  • Specify DAC/RAMP parameter(s) Via is set to Input port

  • This port is available only for the COMPH module.

Ramp delay value used by the ramp generator to create a ramp reference voltage for the second input pin of the comparator.

DLY range is between 0 to 8192. Any value outside the range is saturated.

Dependencies

The DLY port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to RAMP module

  • Specify DAC/RAMP parameter(s) Via is set to Input port

  • This port is available only for the COMPH module.

Signal to clear the comparator latched output. Any value greater than 0 will clear the latch output.

Dependencies

The latch clear port appears only when Enable latch clear parameter is selected.

Output

expand all

The comparator module outputs 1, if the voltage on the first input pin is greater than the second input pin. Otherwise, it outputs 0.

The comparator latch output is the tripped state of the CMPSS comparator after it is digitized and qualified by a digital filter.

The latched value can either be cleared by the software or PWMSYNC.

Dependencies

To enable this port, select the Enable latch output parameter.

Parameters

expand all

Select which comparator module should be configured to output the comparison result.

Note

Number of modules available will vary for different processors.

The voltage source of second input pin (negative input pin), specified as either External pin or Internal DAC.

Select source of the internal DAC to generate voltage for the negative input pin, specified as either DAC module or RAMP module.

Dependencies

This parameter is available only for the COMPH module.

Select if the DAC or RAMP values are to be specified via the input port or from the dialog.

When you select input port, the block generates input ports for the comparator module.

When you set DAC source select parameter to DAC module, the block generates DAC port and when DAC source select is set to RAMP module it generates REF, DEC, and DLY port.

Parameter dependency

This parameter is available only for the COMPH module.

Specify the DAC value for internal DAC to generate the voltage on the negative input.

Dependencies

The DAC port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to DAC module

  • Specify DAC/RAMP parameter(s) Via is set to Input port

The RAMP reference value is in the range 0 to 65535. Any value outside the range is saturated.

The RAMP generator starts to decrement from the reference value.

Dependencies

The REF port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to RAMP module

  • Specify DAC/RAMP parameter(s) Via is set to Input port

  • This port is available only for the COMPH module.

The RAMP decrement value is in range 0 to 65535. Any value outside the range is saturated.

The RAMP generator decrements the RAMP reference value in steps of decrement value.

Dependencies

The DEC port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to RAMP module

  • Specify DAC/RAMP parameter(s) Via is set to Input port

  • This port is available only for the COMPH module.

The RAMP delay value is in range 0 to 8192. Any value outside the range is saturated.

The RAMP generator waits for the delay value before it starts to decrement the RAMP reference value in steps of RAMP decrement value.

Dependencies

The DLY port appears only when parameter:

  • Second input is set to Internal DAC

  • DAC source select is set to RAMP module

  • Specify DAC/RAMP parameter(s) via is set to Input port

  • This port is available only for the COMPH module.

The latched value of the digital filter output of the comparator.

Select this parameter to enable the LTH port.

Latch clear signals to clear the comparator latch status signal. Any value greater than 0 will clear the latch signal.

Select this parameter to enable the LCLR port.

Use this parameter to specify the time interval between samples. To inherit sample time from an upstream block, set this parameter to -1.

Introduced in R2020a