![]() |
vấn đề chân A5 pic6f886 chế độ ADC
không thể điều khiển mức logic của chân a5 xuống thấp code như sau:
#include <16F886.h> #device *=16 adc=10 #FUSES NOWDT //no Watch Dog Timer #FUSES HS //Crystal high #FUSES NOPUT //No Power Up Timer #FUSES PROTECT //protected from reading #FUSES BROWNOUT //Reset when brownout detected #use delay(clock=20000000) #use fast_io(B) #use fast_io(A) #use fast_io(C) void main() { setup_adc_ports(sAN0|VSS_VDD); setup_adc(ADC_CLOCK_INTERNAL); setup_spi(FALSE); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_oscillator(False); set_tris_A(0xCF); // 1100 1111// set_tris_B(0x00); set_tris_C(0x03); while(1) { output_low(pin_a5); delay_ms(500); output_high(pin_a5); delay_ms(500); } } Mình đã nạp chạy thử thì lúc nào chân a5 cũng ở mức cao. mong các bạn giúp đỡ |
Pic16f886
Trích:
Hay là bạn có thể khai báo void main() { setup_oscillator(OSC_8MHZ); setup_adc_ports(sAN0|VSS_VDD); setup_adc(ADC_CLOCK_INTERNAL); setup_spi(FALSE); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_oscillator(False); set_tris_A(0xCF); // 1100 1111// set_tris_B(0x00); set_tris_C(0x03); |
Múi giờ GMT. Hiện tại là 04:27 PM. |
Tên diễn đàn: vBulletin Version 3.8.11
Được sáng lập bởi Đoàn Hiệp.
Copyright © PIC Vietnam