| Xmega IEC60730 Class B Library 1.0 |

All Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
classb_analog.h
Go to the documentation of this file.
1 /* This file has been prepared for Doxygen automatic documentation generation.*/
2 /**
3 * \file
4 *
5 * \brief
6 * This is the header file for the ADC and DAC tests.
7 *
8 * \par Application note:
9 * AVR1610: Guide to IEC60730 Class B compliance with XMEGA
10 *
11 * \par Documentation
12 * For comprehensive code documentation, supported compilers, compiler
13 * settings and supported devices see readme.html
14 *
15 * \author
16 * Atmel Corporation: http://www.atmel.com \n
17 * Support email: avr@atmel.com
18 *
19 * Copyright (C) 2012 Atmel Corporation. All rights reserved.
20 *
21 * \page License
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are met:
25 *
26 * 1. Redistributions of source code must retain the above copyright notice,
27 * this list of conditions and the following disclaimer.
28 *
29 * 2. Redistributions in binary form must reproduce the above copyright notice,
30 * this list of conditions and the following disclaimer in the documentation
31 * and/or other materials provided with the distribution.
32 *
33 * 3. The name of Atmel may not be used to endorse or promote products derived
34 * from this software without specific prior written permission.
35 *
36 * 4. This software may only be redistributed and used in connection with an
37 * Atmel AVR product.
38 *
39 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
40 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
41 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
42 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
43 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
48 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
49 * DAMAGE.
50 */
51
52 #ifndef CLASSB_ADC_DAC_H_
53 #define CLASSB_ADC_DAC_H_
54
55 #include "avr_compiler.h"
56 #include "error_handler.h"
57
58 //! \defgroup adc_dac Analog I/O Test
59 //!
60 //! \brief This self-diagnostic test for the ADC, DAC and analog multiplexer.
61 //!
62 //! A plausibility check is done to make sure that ADC and DAC
63 //! work correctly. The test is implemented in \ref classb_analog_io_test() and consists on
64 //! the following: the DAC generates 5 values (0%, 25%, 50%, 75% and 100% of the scale) and
65 //! the ADC will read them. If the read values should deviate from the expected values more
66 //! than a configurable threshold, the test would call the error handler
67 //! \ref CLASSB_ERROR_HANDLER_ANALOG().
68 //!
69 //! The test checks one ADC module and one DAC module at a time, i.e. it has to be
70 //! repeated until all modules are tested. Further, the ADC module to test should
71 //! be able to read from the DAC module it is tested together with.
72 //!
73 //! \note
74 //! - Interrupts should be disabled during this test.
75 //@{
76
77 //! \internal \name Internal settings
78 //@{
79 //! \internal \brief Maximum allowed absolute deviation for the test measurements.
80 //!
81 //! Error offset for the ADC is +-2mV, which corresponds to +-0x40 when the
82 //! reference is 1V and \c TOP is \c 2047.
83 #define CLASSB_ADC_DEV 0x40
84 //@}
85
86
87 //! \name Class B Test
88 //@{
89 void classb_analog_io_test(DAC_t *dacptr, ADC_t *adcptr);
90 //@}
91
92
93 //@}
94
95
96 #endif /* CLASSB_ADC_DAC_H_ */