Inputs: Dynamic based on configuration
| Port Name | Data Type | Description | Optional |
|---|---|---|---|
| DACC Input | uint16 / single | DAC value when using DAC as minus input | Yes |
Outputs: Dynamic based on configuration
| Port Name | Data Type | Description | Optional |
|---|---|---|---|
| Comparator Output | boolean | Current comparator output state | Yes |
| Comparator Edge Output | boolean | Edge detection flag (rising/falling/any) | Yes |
| I/O Type | Data Type | Range | Description |
|---|---|---|---|
| DACC Input (16-bit) | uint16 | 0-4095 | Raw DAC value (12-bit resolution) |
| DACC Input (normalized) | single | 0.0-1.0 | Normalized floating point |
| DACC Input (Volts) | single | 0.0-3.3 | Physical voltage scaling |
| Comparator Output | boolean | 0/1 | Current comparison result |
| Edge Output | boolean | 0/1 | Edge event detected |
| Family | Series | ACC Modules | DAC Channels | Notes |
|---|---|---|---|---|
| SAME70 | E70 | ACC | DAC0, DAC1 | Full support |
| SAMS70 | S70 | ACC | DAC0, DAC1 | Full support |
| SAMV71 | V71 | ACC | DAC0, DAC1 | Full support |
Note: This block is specifically for SAMx7 devices with ACC and DACC peripherals. Other SAM families (E5x, C2x, D2x) use different comparator architectures.
| Parameter | Description | Options |
|---|---|---|
| SELPLUS | Positive input selection | AFE0_AD0-AD5, AFE1_AD0-AD1 (with pin mapping) |
| SELMINUS | Negative input selection | Temperature Sensor, VREFP, DAC0, DAC1, AFE0_AD0-AD3 |
The popup options show both the signal name and the corresponding physical pin.
When DAC0 or DAC1 is selected as SELMINUS:
| Parameter | Description | Options |
|---|---|---|
| DACC Initial Output | Initial DAC value at startup | Numeric value or MATLAB variable |
| BlockInput DACC_INPUT | DAC input data type | Not a block input, 16-bit unsigned, Normalized float, Volts |
| DACC SAT | Enable DAC saturation limiting | on/off |
DAC Clock: Automatically configured to ~10 MHz (max 12 MHz) based on MCK.
| Parameter | Options | Description |
|---|---|---|
| EDGETYP | Rising, Falling, Any | Edge type for interrupt/fault generation |
| INV | on/off | Invert comparator output polarity |
| HYST | Disabled, 25 mV, 45 mV | Hysteresis for noise immunity |
| Parameter | Options | Description |
|---|---|---|
| CE | Disabled, Enabled | Comparison interrupt enable |
| FAULT | Disabled, By Edge Type, By Comparator Output | PWM fault generation mode |
Fault Generation: When enabled, the comparator can generate fault signals for the PWM peripheral.
| Parameter | Options | Description |
|---|---|---|
| Comparator Output | is not a block output, is a boolean block output | Enable comparator state output |
| Comparator Edge Output | is not a block output, is a boolean block output | Enable edge detection output |
Positive Input (SELPLUS):
Negative Input (SELMINUS):
Hysteresis prevents output oscillation when input signals are near the threshold:
| Setting | Hysteresis Band | Use Case |
|---|---|---|
| Disabled | 0 mV | High-precision comparison |
| 25 mV | ±12.5 mV | Light noise filtering |
| 45 mV | ±22.5 mV | Heavy noise filtering |
The EDGETYP parameter configures which edges trigger events:
| Setting | Triggers On |
|---|---|
| Rising | Plus > Minus transition |
| Falling | Plus < Minus transition |
| Any | Both transitions |
When DAC0 or DAC1 is selected as SELMINUS, the block automatically:
| Input Type | Formula | Example |
|---|---|---|
| 16-bit unsigned | VOUT = (Input / 4095) × 3.3V | 2048 → 1.65V |
| Normalized [0-1] | VOUT = Input × 3.3V | 0.5 → 1.65V |
| Volts [0-3.3] | VOUT = Input | 1.65V → 1.65V |
| Register | Description |
|---|---|
| ACC_MR | Mode register (SELPLUS, SELMINUS, EDGETYP, INV, HYST) |
| ACC_ACR | Analog control register |
| ACC_IER/IDR | Interrupt enable/disable |
| DACC_MR | DAC mode register |
| DACC_CDR | DAC conversion data register |
The block automatically enables peripheral clocks using PMC_PCER registers based on peripheral IDs for both ACC and DACC modules.
Compare an analog input against a fixed DAC threshold:
Configuration:
- SELPLUS: AFE0_AD0 (external analog signal)
- SELMINUS: DAC0 (threshold)
- DACC Initial Output: 2048 (1.65V threshold)
- BlockInput DACC_INPUT: is not a block input (fixed threshold)
- Comparator Output: is a boolean block output
Result: Output is HIGH when input voltage > 1.65V
Programmable threshold with fault generation for motor control:
Configuration:
- SELPLUS: AFE0_AD2 (current sense)
- SELMINUS: DAC1 (overcurrent threshold)
- BlockInput DACC_INPUT: is a 16 bits unsigned block input
- FAULT: Defined by Comparator Output
- EDGETYP: Rising
Result: PWM fault generated when current exceeds DAC-programmed threshold
Compare external sensor against internal temperature reference:
Configuration:
- SELPLUS: AFE0_AD3 (external thermistor)
- SELMINUS: Temperature Sensor (TS) Output Voltage
- HYST: 25 mV
- Comparator Output: is a boolean block output
Result: Output indicates relative temperature comparison
Problem: Comparator output doesn’t change with input.
Solutions:
Problem: DAC threshold voltage is wrong.
Solutions:
Problem: Comparator output oscillates rapidly.
Solutions:
Problem: FAULT setting enabled but PWM doesn’t respond.
Solutions: