چجوری میشه ADC رو با مد free running راه اندازی کرد؟
اطلاعیه
Collapse
No announcement yet.
free running
Collapse
X
-
پاسخ : free running
اشکالی بود بفرمایید. :smile:
کد:#include <mega16.h> #define ADC_VREF_TYPE 0x00 // ADC interrupt service routine interrupt [ADC_INT] void adc_isr(void) { unsigned int adc_data; // Read the AD conversion result adc_data=ADCW; // Place your code here } // Declare your global variables here void main(void) { // ADC initialization // ADC Clock frequency: 125.000 kHz // ADC Voltage Reference: AREF pin // ADC Auto Trigger Source: Free Running ADMUX=ADC_VREF_TYPE; ADCSRA=0xAD; SFIOR&=0x1F; // Global enable interrupts #asm("sei") while (1) { // Place your code here }; }
There is nothing so practical as a good theory. — Kurt Lewin, 1951
دیدگاه
دیدگاه