ATXmega E-series ADC settings.

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everyone.

First, I have been using Mega/Tiny devices for many years but now I'd like to start using ATXmega devices E -series. But I don't know how to set the ADC to make it working automatically (triggered by event system chanel 0).

Question are:

 

- what do we use the bit FLUSH for?

- which bits should we set within EVCTRL register to have the ADC triggered by event system - only  EVSEL  or/and EVACT?

 

Thank you in advance. robiw

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Could you check my settings:

 

//ADC config: 12bit single ended, curr limit high, ref = 1V, gain = x1, trigger - event ch0
ADCA.CTRLA = ADC_ENABLE_bm;  //ADC Enabled
ADCA.CTRLB = ADC_CURRLIMIT_HIGH_gc|ADC_RESOLUTION_12BIT_gc;
ADCA.REFCTRL = ADC_REFSEL_INT1V_gc;
ADCA.EVCTRL = ADC_EVSEL_0_gc|ADC_EVACT_CH0_gc;  //First event triggers channel conversion
ADCA.PRESCALER = ADC_PRESCALER_DIV64_gc;  //500kHz @ 32MHz
ADCA.CH0.CTRL = ADC_CH_GAIN_1X_gc|ADC_CH_INPUTMODE_SINGLEENDED_gc;
ADCA.CH0.MUXCTRL = ADC_CH_MUXPOS_PIN0_gc;  //pin PA0

 

robiw

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are six ADC app notes:

 

https://www.avrfreaks.net/commen...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could you check my ADC settings above. robiw