XMega ADC to DAC Transfer Quick Query

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

Hey Everyone, 

 

So I am trying to get a basic set up working with Xmega256a3bu where I feed a voltage to ADC and pass the results to DAC. Having a bit of trouble getting the interrupts working, but there's another thread for that. I was going through the datasheet when I read that the DAC takes a 12 bit input, I know it sounds silly but doesnt ADC return a 16-bit int? how do you feed a 16 bit datatype to 12 bit input without losing information? Any answers are appreciated! :) 

 

Thanks again for your time!

This topic has a solution.

Soul

Last Edited: Sat. Feb 11, 2017 - 03:17 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am new to these devices but from what I can see in the datasheets is that both the DAC and ADC are 12 bit resolution.  The ADCs result register is a 16 bit register but the data that is relevant is the first 12 bits, obviously if you are running in signed mode and you have a negative number the upper nibble will be set to '1111' but they are not part of the converted data.

 

Page 345 of the AU manual shows the ADC results register values for the different modes that can be used.

 

You may need to do some conversion of values when sending the ADC to DAC depending on what mode you are running in.  if you have the ADC in signed mode (-2048 to 2047) and your Aref = 1V, if the ADC pin is at 1V the counts will be 2047. If that value is written directly to the DAC data register the DAC will output approximately 0.5V as it is only half the DAC range (0 to 4095).