« Close

Datasheets and User Guides

App Notes

Software & Driver

 

14.1.7 Average Min Max [T-Series Datasheet]

Overview

AIN#_EF_INDEX: 3

This Average Mix Max Extended Feature will sample an analog input a specified number of times at a specified rate, then calculate the average, min, and max voltage.

If you are using this feature to reduce noise by oversampling-and-averaging, consider maximizing resolution first, since that is the best and fastest way to reduce noise.

Configuration

To configure, write to the following registers.

AIN#_EF_CONFIG_A - Number of Samples: The number of samples to be acquired.

  • Default: 200
  • Max: 16384

AIN#_EF_CONFIG_D - Scan Rate: The frequency at which samples will be collected.

  • Default: 6000

Sample Time

The maximum possible sample time is 180 ms.

Sample time is the number of samples divided by the sample frequency. For example, the period is 16.7 ms when using a scan rate of 6000 Hz and 100 samples:

100 samples / 6000 samples per second = 16.7 ms

If the signal has a known periodic component, then setting the sample time to an even multiple of the period will generally improve results.

Stream Configuration

This extended feature internally uses Stream-Burst to acquire the data set, so stream AIN configurations apply.

Results

For results, read the following registers.

AIN#_EF_READ_A: Average volts
AIN#_EF_READ_B: Max volts
AIN#_EF_READ_C: Min volts

Only reading AIN#_EF_READ_A triggers a new measurement. Because multiple measurements are taken, a read of AIN#_EF_READ_A blocks for the length of the sample time.

Example

To measure a 10 Hz sine wave with amplitude 0.1 V and DC offset of 1.2 V, set the number of samples to 100 and the scan rate to 1000. The total acquisition time is 100 ms, which is an even multiple of the signal's period.

AIN0_EF_INDEX = 3
AIN0_EF_CONFIG_A = 100   -- Number of samples
AIN0_EF_CONFIG_D = 1000  -- Scan rate

Results, with noise levels less than 600 µV:

AIN0_EF_READ_A = 1.201 V -- Average volts
AIN0_EF_READ_B = 1.301 V -- Max volts
AIN0_EF_READ_C = 1.101 V -- Min volts

We can change the sample time to emphasize the benefit of matching to the period. If we change AIN0_EF_CONFIG_A to 70 (an odd multiple of the signal's period), then the results are still centered on 1.2, 1.3, and 1.1 V—but noise levels are ±5 mV.