Pic programlama ccs c ADC bit örnek uygulama yapma
#include<16f877a.h>
#device adc=8
#fuses hs,nowdt,noprotect,nolvp
#use delay(clock=4m)
void main()
{
int16 adc;
setup_adc(adc_clock_internal);
setup_adc_ports(all_analog);
while(true)
{
set_adc_channel(0);
delay_us(10);
adc=read_adc();
output_bit(pin_b0,(adc>0));
output_bit(pin_b1,(adc>32));
output_bit(pin_b2,(adc>64));
output_bit(pin_b3,(adc>96));
output_bit(pin_b4,(adc>128));
output_bit(pin_b5,(adc>160));
output_bit(pin_b6,(adc>192));
output_bit(pin_b7,(adc>224));
}
}
Hiç yorum yok:
Yorum Gönder
Her yorum bilgidir. Araştırmaya devam...