> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atopile.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Comparator

## Parameters

<ParamField path="common_mode_rejection_ratio" type="decibel" />

<ParamField path="input_bias_current" type="ampere" />

<ParamField path="input_hysteresis_voltage" type="volt" />

<ParamField path="input_offset_voltage" type="volt" />

<ParamField path="output_type" type="dimensionless" />

<ParamField path="propagation_delay" type="second" />

## Interfaces

<ParamField path="inverting_input" type="Electrical" />

<ParamField path="non_inverting_input" type="Electrical" />

<ParamField path="output" type="Electrical" />

<ParamField path="power" type="ElectricPower" />

## Global Attributes

These attributes are available to all modules and interfaces in a design.

<ParamField path="lcsc_id" type="str">
  Assign the LCSC ID of the module.

  If set, this will tell the picker to select that part from LCSC for this block.
</ParamField>

<ParamField path="manufacturer" type="str">
  This module's manufacturer name, as a string.

  Only exact matches on the manufacturer's name will be found by the picker.
  It's recommended to fill this information based on what `ato create component`
  provides.
</ParamField>

<ParamField path="mpn" type="str">
  This module's manufacturer part number, as a string.

  For the picker to select the correct part from the manufacturer,
  this must be set.
</ParamField>

<ParamField path="package" type="str">
  The package of the module.

  This drives which components can be selected, and what footprint is used.

  Must exactly match a known package name.
</ParamField>

<ParamField path="exclude_from_bom" type="bool" />

<ParamField path="override_net_name" type="str">
  When set on an interface, this will override the net name of the interface.

  This is useful for renaming nets which are automatically generated.
</ParamField>

<ParamField path="required" type="bool">
  Only for ModuleInterfaces.
  If set to `True`, require that interface is connected to something outside
  of the module it's defined in.
</ParamField>

<RequestExample>
  ```ato Basic Usage theme={null}
  import Comparator, Resistor, ElectricPower, Electrical

  comparator = new Comparator
  comparator.common_mode_rejection_ratio = 80dB +/- 10%
  comparator.input_bias_current = 1nA +/- 50%
  comparator.input_hysteresis_voltage = 5mV +/- 20%
  comparator.input_offset_voltage = 1mV +/- 30%
  comparator.propagation_delay = 100ns +/- 20%
  comparator.output_type = Comparator.OutputType.PushPull
  comparator.package = "SOIC-8"

  # Power supply connections (dual supply)
  power_pos = new ElectricPower
  power_neg = new ElectricPower
  assert power_pos.voltage within 5V +/- 5%
  assert power_neg.voltage within -5V +/- 5%
  comparator.power.hv ~ power_pos.hv
  comparator.power.lv ~ power_neg.lv

  # Create voltage reference with resistor divider
  ref_resistor_high = new Resistor
  ref_resistor_low = new Resistor
  ref_resistor_high.resistance = 10kohm +/- 1%
  ref_resistor_low.resistance = 10kohm +/- 1%

  # Reference voltage = Vcc/2
  power_pos.hv ~> ref_resistor_high ~> comparator.non_inverting_input
  comparator.non_inverting_input ~> ref_resistor_low ~> power_neg.lv

  # Connect input signal to inverting input
  input_signal ~ comparator.inverting_input
  output_signal ~ comparator.output

  # Output will be HIGH when input_signal > reference_voltage
  ```
</RequestExample>
