There are a LOT of features packed into the Xmega microcontrollers. This instructable is meant to demonstrate some of the really powerful ones like a 12bit DAC, 12bit ADC, DMA controller and open source compiler (avr-gcc).
Remove these ads by
Signing UpStep 1What you need
Boston Android Xmega EVAL-01 Development Board ($20) or build your own
Murata PV36W103C01B00 Trimpot 10Kohm, 25turn (or equiv from Mouser)
PC with AVR Studio 4 (free)
AVRISP mkII programmer ($30)
| « Previous Step | Download PDFView All Steps | Next Step » |












































Is it possible to realize the two fixed frequenz without potimeter?
For example:
int data[] = {0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1};
for (int i = 0; i< sizeof(data); i++){
if(data[i]==1) "frequency should be 22khz" ;
else " it should be 20 khz;
}
It is possible to add this to the source code and is it possible to adjust the repetitions (loops)?
great instructable!
ADCA.CTRLB = 0x0; // set 12 bit conversion right adjusted
Then you need to read two separate bytes and put the 12bit value back together.
tmp = ADCA.CH0RESL;
tmp += ADCA.CH0RESH<<8;
sum += tmp;
It's possible the avr-gcc compiler is smart enough to allow you to read the whole 12bit value in one shot like this:
sum = ADCA.CH0RES;
I tried this and it compiles but I don't have a board handy to confirm it works.
basically turn it into an efficient inverter.