Link Search Menu Expand Document

MCHP

AFEC Polling

This example uses AFEC peripheral library to sample an analog input in polled mode and send the converted data to console.

Description

In this example, the DAC output is fed to the ADC input. The DAC output is changed by 0.1 V when switch is pressed. The ADC conversion is triggered by software and converted result is displayed on the console.

Downloading and building the application

To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file. This content can also be downloaded using content manager by following these instructions.

Path of the application within the repository is apps/afec/afec_polled_mode/firmware .

To build the application, refer to the following table and open the project in their respective IDEs.

Project Name Description
sam_e70_xult.X MPLABX Project for SAM E70 Xplained Ultra board
sam_v71_xult.X MPLABX Project for SAM V71 Xplained Ultra board
   

Setting up the hardware

The following table shows the target hardware for the application projects.

Project Name Board
sam_e70_xult.X SAM E70 Xplained Ultra board
sam_v71_xult.X SAM V71 Xplained Ultra board
   

Setting up SAM E70 Xplained Ultra board

  • An analog input (AD0) is fed from the DAC output. DAC output is incremented by 0.1 V on Switch (SW0) press
  • An analog input “AD0” is mapped to Port Pin “PB1” that is routed to “Pin 14 of the EXT1 header”
  • The DAC output “DAC0” is mapped to Port Pin “PB13” that is routed to “Pin 5 of the J502 header”
  • Use a jumper wire to connect “Pin 14 of the EXT1” to “Pin 5 of the J502”
  • Connect the Debug USB port on the board to the computer using a micro USB cable

Setting up SAM V71 Xplained Ultra board

  • An analog input (AD0) is fed from the DAC output. The DAC output is incremented by 0.1 V on Switch (SW0) press
  • An analog input “AD0” is mapped to Port Pin “PB1” that is routed to “Pin 14 of the EXT1 header”
  • The DAC output “DAC0” is mapped to Port Pin “PB13” that is routed to “Pin 5 of the J504 header”
  • Use a jumper wire to connect “Pin 14 of the EXT1” to “Pin 5 of the J504”
  • Connect the Debug USB port on the board to the computer using a micro USB cable

Running the Application

  1. Open the Terminal application (Ex.:Tera term) on the computer
  2. Connect to the EDBG Virtual COM port and configure the serial settings as follows:
    • Baud : 115200
    • Data : 8 Bits
    • Parity : None
    • Stop : 1 Bit
    • Flow Control : None
  3. Build and Program the application using its respective IDE
  4. The console displays the ADC Count and the ADC Input Voltage
  5. Press the switch to change the DAC output by 0.1 V from 0 V to 3.3 V
  6. Observe the ADC input value and the respective ADC count value

output



Copyright © 2020 Microchip Technology.