سلام به همه دوستان و اساتید
من نمی دونم چرا مقادیری که توسط adc می خونم مدام در حال تغییر هست؟
تغییر اون هم طوری نیست که گردن نویز بندازم یعنی با توجه به تعیین #device adc=8 و خواندن adc ، مقادیر نمایش داده شده از 255 تا 0 تغییر می کنند به صورت مداوم.
من برنامم رو این زیر گذاشتم ، اگه کسی بلده کمک کنه لطفا.
من نمی دونم چرا مقادیری که توسط adc می خونم مدام در حال تغییر هست؟
تغییر اون هم طوری نیست که گردن نویز بندازم یعنی با توجه به تعیین #device adc=8 و خواندن adc ، مقادیر نمایش داده شده از 255 تا 0 تغییر می کنند به صورت مداوم.
من برنامم رو این زیر گذاشتم ، اگه کسی بلده کمک کنه لطفا.
کد:
for(;;) { unsigned int8 value; char str[20]; setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF); setup_adc(ADC_CLOCK_INTERNAL); setup_adc_ports(AN0_AN1_VSS_VREF); //reading x position //first giving voltage to the cross axis output_high(y1); output_low(y2); //then giving zero to one lid of current axis output_low(x2); //then reading voltage of other lid of current axis set_adc_channel(0); delay_ms(3);//delay_us(10); //while(!ADC_done()); value=read_adc(); sprintf(str,"X is:%5u",value); show_mytext(10,10,str); delay_ms(300); //reading y position //first giving voltage to the cross axis output_high(x1); output_low(x2); //then giving zero to one lid of current axis output_low(y2); //then reading voltage of other lid of current axis set_adc_channel(1); delay_ms(3);//delay_us(10); //while(!ADC_done()); value=read_adc(); sprintf(str,"Y is:%5u",value); show_mytext(11,10,str); delay_ms(300); }
دیدگاه