Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Analog I/O Test

Self-diagnostic test for the ADC, DAC and analog multiplexer.

A plausibility check is done to make sure that ADC, DAC and analog multiplexer work correctly. The test is implemented in classb_analog_io_test() and consists of the following steps:

  1. the DAC is configured to output one of five known values.
  2. the ADC is set up to measure the DAC with all of its channels and the results compared with the expected value.
  3. repeat for the remaining DAC values.

If the measured values deviate from the expected values more than the threshold configured with CLASSB_ADC_DEV, the test calls the error handler CLASSB_ERROR_HANDLER_ANALOG().

The test checks one ADC module and one DAC module at a time, i.e., it has to be repeated until all modules are tested. Further, the ADC module to test must be able to read from the DAC module it is tested together with.

Note
  • Interrupts should be disabled during this test.

Functions

void classb_analog_io_test (DAC_t *dacptr, ADC_t *adcptr)
 Functional test for the ADC, DAC and analog MUX. More...
 

Internal settings

#define CLASSB_ADC_DEV   0x40
 Maximum allowed absolute deviation for test measurements. More...
 

#define CLASSB_ADC_DEV   0x40

Maximum allowed absolute deviation for test measurements.

Error offset for the ADC is +-2mV, which corresponds to +-0x40 when the reference is 1V and TOP is 2047.

Referenced by classb_dac_adc_test().

void classb_analog_io_test ( DAC_t *  dacptr,
ADC_t *  adcptr 
)

Functional test for the ADC, DAC and analog MUX.

This function configures the DAC to output five different voltages, which are each measured with the ADC using 12-bit resolution, signed conversion and 1V voltage reference.

Range checking of the conversion results is done to verify that ADC and DAC are working correctly.

Parameters
dacptrBase address for registers of DAC module to test.
adcptrBase address for registers of ADC module to test.

References classb_dac_adc_test().

Referenced by oven_classb_run_tests().