The xMega ADC

More
12 years 3 months ago - 12 years 3 months ago #665 by Torby
Replied by Torby on topic The xMega ADC
 
xMaster Gabriel, [img] outsidetrains.com/smile/bowing.gif " />
In an ATTiny, it took less than an hour to made the ADC read a voltage, including discovering I was reading the wrong pin. On xMega, it's been 4 days so far. "Doesn't anybody know how to make this work?" I was poking around with my dear Gabotron, when I realized, "Here's an xMega using it's ADC! xMaster Gabriel must know how to make them work!"
 
So, how do you make these blame things work? If I try it single ended, it always tells me 0xfff (full scale). if I try it double ended, it always tells me -2048 (negative full scale).
It's an xMega192D3
Pin B4 is 0.72v
The AVCC is 3.3v with a .1 uF cap to ground just like all the other vcc pins. 
I've programmed Port B like this:
Last edit: 12 years 3 months ago by ganzziani.

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago - 12 years 3 months ago #668 by ganzziani
Replied by ganzziani on topic Re:The xMega ADC
Hi Torby!
I took a look at the register setup but I can't see what's wrong, Try this:
Change:
//PORTB.PIN4CTRL = (3<<3);/\r\n/to:/\r\n/PORTB.PIN4CTRL = 0x07; // Digital Input Disable on pin PB4
Last edit: 12 years 3 months ago by ganzziani.

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #671 by Torby
Re:The xMega ADC was created by Torby
Well, yours is the first suggestion that makes sense, and I've tried many. The ADCA.CH0RES still says -2048.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #681 by Torby
Replied by Torby on topic Re:The xMega ADC
I got it working, but it would go haywire when I changed the mux to sample something else. The guy at Atmel suggested sampling twice when I switched mux.
 
Last edit: 12 years 2 months ago by Torby. Reason: Code totallly illegible

Please Log in or Create an account to join the conversation.

More
12 years 1 week ago #728 by Torby
Replied by Torby on topic Re:The xMega ADC
Oh yes. In case anybody is reading and trying to make the adc work, I posted my results at www.barefootelectronics.com/xMegaADC.aspx

Please Log in or Create an account to join the conversation.

Time to create page: 0.219 seconds
Powered by Kunena Forum