با سلام چطور میشه نحوه خواندن مقدار وتبدیل به adc از کد زیر که wizard تولید می کند استفاده نکرد ؟
// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input|ADC_VREF_TYPE;
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCH;
}
یعنی برای هر برنامه adc باید کد بالا را نوشت ؟ چه کد یا کدهایی را می توان جایگزین نمود ؟
// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input|ADC_VREF_TYPE;
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCH;
}
یعنی برای هر برنامه adc باید کد بالا را نوشت ؟ چه کد یا کدهایی را می توان جایگزین نمود ؟
دیدگاه