The following configurations must be made for Hardware Configuration A: |Pin | Configuration | | :----------: | :----------------: | |PD3 (AIN3) | Analog Input | |PC6 (LED0) | Digital Output | - **The Hardware Configuration B** uses two POT clicks, inserted in mikroBUS slot 1 and slot 2. Slot 1 connects AN1 to the PD3 (AIN3) and slot 2 connects AN2 to PD4 (AIN4) pin of the AVR® DA microcontroller.
The following configurations must be made for Hardware Configuration B: |Pin | Configuration | | :----------: | :----------------: | |PD3 (AIN3) | Analog Input | |PD4 (AIN4) | Analog Input | |PC6 (LED0) | Digital Output | ## Operation ### ADC Differential Conversion This example will initialize the ADC, configure two pins for reading the differential voltage, start the conversion and read the ADC result in an infinite loop. **The Hardware Configuration B will be used for this example** 1. Connect the board to the PC. 2. Open the *AVRDA_ADC_Examples.atsln* solution in Atmel Studio 3. Set *ADC_Differential_Conversion* project as StartUp project:
4. Build the *ADC_Differential_Conversion* project: right click on *ADC_Differential_Conversion* and select Build
5. Select the AVR128DA48 Curiosity Nano on-board debugger in the *Tool* section of the *AVR-Dx_Bootloader* project settings:
- Right click on the project and click *Properties*;
- Click *Tool* tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
6. Select Debug → Start Debugging and Break (Alt+F5)
- Add a brake point on `adcVal` in the main function
7. Result: Rotating the Potentiometers on the POT click boards (while pressing F5 key), the adcVal result will vary from a positive to a negative value:
### ADC Event Triggered
This example will initialize the ADC and Real-Time Counter (RTC), configure the Event System (EVSYS) to trigger an
ADC conversion on the RTC overflow; an LED is toggled on after each ADC conversion.
**The Hardware Configuration A will be used for this example**
1. Connect the board to the PC.
2. Open the *AVRDA_ADC_Examples.atsln* solution in Atmel Studio
3. Set *ADC_Event_Triggered* project as StartUp project
4. Right click on *ADC_Event_Triggered* and select Build
5. Select the AVR128DA48 Curiosity Nano on-board debugger in the *Tool* section of the *AVR-Dx_Bootloader* project settings:
- Right click on the project and click *Properties*;
- Click *Tool* tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
6. Result: The LED0 will toggle with a frequency of `RTC_PERIOD`, that can be modified
### ADC Sample Accumulator
This example will Initialize the ADC, enable accumulation of 64 samples, start the conversion and read the ADC result in a loop.
**The Hardware Configuration A will be used for this example**
1. Connect the board to the PC.
2. Open the *AVRDA_ADC_Examples.atsln* solution in Atmel Studio
3. Set *ADC_Sample_Accumulator* project as StartUp project
4. Right click on *ADC_Sample_Accumulator* and select Build
5. Select the AVR128DA48 Curiosity Nano on-board debugger in the *Tool* section of the *AVR-Dx_Bootloader* project settings:
- Right click on the project and click *Properties*;
- Click *Tool* tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
6. Select Debug → Start Debugging and Break (Alt+F5)
- Add a brake point on `adcVal` in the main function
7. Result: Rotating the Potentiometer on the POT click board (while pressing F5 key), the adcVal result will vary:
### ADC Single Conversion
This example will initialize the ADC, start the conversion and wait until it is completed, and read ADC result in a loop.
**The Hardware Configuration A will be used for this example**
1. Connect the board to the PC.
2. Open the *AVRDA_ADC_Examples.atsln* solution in Atmel Studio
3. Set *ADC_Single_Conversion* project as StartUp project
4. Right click on *ADC_Single_Conversion* and select Build
5. Select the AVR128DA48 Curiosity Nano on-board debugger in the *Tool* section of the *AVR-Dx_Bootloader* project settings:
- Right click on the project and click *Properties*;
- Click *Tool* tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
6. Select Debug → Start Debugging and Break (Alt+F5)
- Add a brake point on `adcVal` in the main function
7. Result: Rotating the Potentiometer on the POT click board (while pressing F5 key), the adcVal result will vary:
### ADC Temperature Measurement
This example will initialize the ADC, select the temperature sensor as input and acquire the data by running a 12-bit, right adjusted, single-ended conversion.
**The Hardware Configuration A will be used for this example**
1. Connect the board to the PC.
2. Open the *AVRDA_ADC_Examples.atsln* solution in Atmel Studio
3. Set *ADC_Temperature_Measurement* project as StartUp project
4. Right click on *ADC_Temperature_Measurement* and select Build
5. Select the AVR128DA48 Curiosity Nano on-board debugger in the *Tool* section of the *AVR-Dx_Bootloader* project settings:
- Right click on the project and click *Properties*;
- Click *Tool* tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
6. Select Debug → Start Debugging and Break (Alt+F5)
- Add a brake point on `temp_C` in the main function
7. Result: Pressing the F5 key, the `temp_C` Value will show the ambient temperature in Celsius (25°C):
### ADC Window Comparator
This example will set the conversion window comparator low threshold, enable the conversion Window mode,
enable the Free Running mode, start the conversion and wait until it is completed, read the ADC result in an
infinite loop, an LED is toggled on if the ADC result is below the set threshold.
**The Hardware Configuration A will be used for this example**
1. Connect the board to the PC.
2. Open the *AVRDA_ADC_Examples.atsln* solution in Atmel Studio
3. Set *ADC_Window_Comparator* project as StartUp project
4. Right click on *ADC_Window_Comparator* and select Build
5. Select the AVR128DA48 Curiosity Nano on-board debugger in the *Tool* section of the *AVR-Dx_Bootloader* project settings:
- Right click on the project and click *Properties*;
- Click *Tool* tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
6. Result: Rotating the Potentiometer on the POT click board will modify the adcVal untill LED0 will turn off:
