# ADC DC Measurement

Measure DC performance metrics of ADC output

**Libraries:**

Mixed-Signal Blockset /
ADC /
Measurements & Testbenches

## Description

The ADC DC Measurement block measures ADC DC performance metrics such as offset error, gain error, integral nonlinearity (INL), and differential nonlinearity (DNL). You can use ADC DC Measurement block to validate the ADC architectural models provided in Mixed-Signal Blockset™, or you can use an ADC of your own implementation.

## Ports

### Input

**analog** — Analog input signal to ADC

scalar

Analog input signal to ADC block, specified as a scalar.

**Data Types: **`double`

**start** — External conversion start clock

scalar

External conversion start clock, specified as a scalar. The analog to digital
conversion process starts at the rising edge of the signal at the
**start** port.

**Data Types: **`double`

**digital** — Converted digital signal from ADC

scalar

Converted digital signal from an ADC, specified as a scalar.

**Data Types: **`fixed point`

| `single`

| `double`

| `int8`

| `int16`

| `int32`

| `uint8`

| `uint16`

| `uint32`

**ready** — Indicates whether analog to digital conversion is complete

scalar

Indicates whether the analog to digital conversion is complete, specified as a scalar.

**Data Types: **`double`

## Parameters

**Input range (V)** — Dynamic range of ADC

`[-1 1]`

(default) | 2-element vector

Dynamic range of the ADC, specified as a 2-element vector in V. The two vector elements represent the minimum and maximum values of the dynamic range, from left to right.

#### Programmatic Use

Use

`get_param(gcb,'InputRange')`

to view the current value of**Input range**.Use

`set_param(gcb,'InputRange',value)`

to set**Input range**to a specific value.

**Hold off time (s)** — Delays measurement analysis to avoid corruption by transients

`0`

(default) | nonnegative real scalar

Delays measurement analysis to avoid corruption by transients, specified as a nonnegative real scalar in seconds.

#### Programmatic Use

Use

`get_param(gcb,'HoldOffTime')`

to view the current value of**Hold off time**.Use

`set_param(gcb,'HoldOffTime',value)`

to set**Hold off time**to a specific value.

**Number of bits** — Number of physical bits in ADC

`5`

(default) | positive real integer

Number of physical bits in ADC, specified as a unitless positive real integer.
**Number of bits** must match the resolution specified in the
ADC block.

#### Programmatic Use

Use

`get_param(gcb,'NBits')`

to view the current**Number of bits**.Use

`set_param(gcb,'NBits',value)`

to set**Number of bits**to a specific value.

**Start conversion frequency (Hz)** — Frequency of the start conversion clock of ADC

`10e6`

(default) | positive real scalar

Frequency of the start conversion clock of the ADC, specified as a positive real
scalar in hertz. **Start conversion frequency** must match the
frequency of the start conversion clock of the ADC block. This parameter
is used to calculate **Recommended simulation stop time**.

#### Programmatic Use

Use

`get_param(gcb,'Frequency')`

to view the current value of**Start conversion frequency**.Use

`set_param(gcb,'Frequency',value)`

to set**Start conversion frequency**to a specific value.

**Recommended min. simulation stop time (s)** — Minimum time simulation must run for meaningful result

`3.2e-5`

(default) | positive real scalar

Minimum time the simulation must run to obtain meaningful results, specified as a positive real scalar in seconds.

For DC measurement, the simulation must run so that ADC can sample each digital code
10 times with the default error tolerance of `0.1`

, assuming a ramp
input that traverses the full scale range of the ADC over the period of simulation.
Based on this assumption, the analog input frequency
(*f*_{analog}), generated by the ADC Testbench
block for the sawtooth waveform is set as:

$${f}_{\text{analog}}=\frac{StartFreq\xb7ErrorTolerance}{{2}^{(Nbits+1)}}$$

where *StartFreq* is the frequency of the conversion start clock
and *Nbits* is the resolution of the ADC.

So, the **Recommended min. simulation stop time (s)**
(*T*) is calculated by using the formula: $$T=\frac{1}{{f}_{\text{analog}}}+HoldOffTime$$.

**Data Types: **`double`

**Set as model stop time** — Automatically set recommended min. simulation stop time as model stop time

button

Click to automatically set the **Recommended min. simulation stop time
(s)** as the stop time of the Simulink^{®} model.

**Endpoint** — Measure DNL, INL using endpoint method

on (default) | off

Measure the differential nonlinearity (DNL) error and integral nonlinearity (INL) error using the endpoint method. This method uses the end points of the actual transfer function to measure the DNL and INL error.

**Best fit** — Measure DNL, INL using best fit method

on (default) | off

Measure the differential nonlinearity (DNL) error and integral nonlinearity (INL) error using the best fit method. This method uses a standard curve fitting technique to find the best fit to measure the DNL and INL error.

**Output result to base workspace** — Store detailed test results to base workspace

off (default) | on

Store detailed test results to a `struct`

in the base workspace for
further processing. By default, this option is not selected.

**Workspace variable name** — Name of the variable that stores detailed test results

`adc_dc_out`

(default) | character string

Name of the variable that stores detailed test results, specified as a character string.

#### Dependencies

This parameter is only available when **Output result to base
workspace** is selected

#### Programmatic Use

Use

`get_param(gcb,'VariableName')`

to view the current value of**Workspace variable name**.Use

`set_param(gcb,'VariableName',value)`

to set**Workspace variable name**to a specific value.

**Plot** — Plot measurement results

button

Click to plot measurement result for further analysis.

## More About

### Offset Error

Offset error represents the offset of the ADC transfer function curve from it ideal value at a single point.

### Gain Error

Gain error represents the deviation of the slope of the ADC transfer function curve from its ideal value.

### INL Error

Integral nonlinearity (INL) error, also termed as relative accuracy, is the maximum deviation of the measured transfer function from a straight line. The straight line is can be a best fit using standard curve fitting technique, or drawn between the end points of the actual transfer function after gain adjustment.

The best fit method gives a better prediction of distortion in AC applications, and a lower value of linearity error. The endpoint method is mostly used in measurement application of data converters, since the error budget depends on the actual deviation from ideal transfer function.

### DNL Error

Differential nonlinearity (DNL) is the deviation from the ideal difference (1 LSB) between analog input levels that trigger any two successive digital output levels. The DNL error is the maximum value of DNL found at any transition.

## Version History

**Introduced in R2019a**

## See Also

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)