Đây là chưong trinh :
Code:
#include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#device 16F877*=16 ADC=8
#use delay(clock=10000000)
#use fast_io(b)
int8 adc;
main()
{set_tris_b(0);
setup_adc(adc_clock_internal);
setup_adc_ports(AN0);
set_adc_channel(0);
delay_ms(10);
while(true)
{
adc=read_adc();
output_B(adc);
}
}
Còn đây là mạch :
sau khi chạy thì tất cả các led đều sáng.Em không hiểu tại sao. Do sai ở mạch hay do chương trình.
Có bác nào giúp em với