Here's some code I recently wrote for a tiny13. It uses the internal 1.1v reference, so you'll need to use a different value for ADMUX I think.:
; use the internal 1.1v reference. select ADC2 (charger2 input)
ldi Temp,(1< out ADMUX,Temp
ldi Temp,(1< out ADMUX,Temp
; Start a read on ADC1
ldi Temp,(1< out ADCSRA,Temp
WAITFORCHANNEL2:
in Temp,ADCSRA
andi Temp,(1<<ADSC) ; mask out ADSC
cpi Temp,0 ; is ADSC clear?
;brne WAITFORCHANNEL2 ; if not, loop and try again.
Hope that helps,
Kevin
On 12/9/05, nzrh2003 <roy.h@ihug.co.nz> wrote:
Newbe to Atmega.
Can anyone help with an example of seting up an A/D conversion in
assembler using the 5v supply as the reference.
I want to do a simple conversion fo 5v signals to digital.
Thanks in advance.
SPONSORED LINKSAvr microcontroller Microcontrollers Pic microcontrollers 8051 microprocessor
YAHOO! GROUPS LINKS
- Visit your group "AVR-Chat" on the web.
- To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.