2012年1月30日星期一

AVR microcontroller simple problem

AVR microcontroller simple problem
http://www.siliconray.com/development-boards/avr.html
ADMUX
ADCSRA
See attached figure configuration
- - - - - - - - - - - - - - - - - - - - - - - - - -
ADMUX = (0 xc0 | adc_input); / / adc_input: difference channel x08 0 ~ 0 x1D / / 0 xc0: choose within 2.56 V reference voltage
ACSR = 0 x80; / / simulation comparator control and status register ACSR of ACD buy 1, so that the imitating comparator disabled
ADCSRA | = (1 < < ADSC); / / start AD transform
ADCSRA | = (1 < < ADIF); / / write 1 clear sign a

Below is a complete example of GCC
# include < avr/IO. H >
# include < avr/delay. H >
# include < avr/signal. H >
# include < avr/interrupt. H >
/ * macro INTERRUPT SIGNAL of usage with similar, SIGNAL difference lies in the execution of the trigger a global INTERRUPT cleared, other interrupts are banned INTERRUPT the execution of the global INTERRUPT trigger bit is set a, other interrupts can be nested hold another avr-libc offers two API used to buy a and reset global INTERRUPT triggered

没有评论:

发表评论