View Single Post
Old 19-05-2013, 07:12 PM   #2
quanghuy_125
Đệ tử 2 túi
 
Tham gia ngày: Apr 2009
Bài gửi: 44
:
Pic16f886

Trích:
Nguyên văn bởi minh_thanh87 View Post
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 đỡ
Bạn kiểm tra lại mạch xem nhé. Mình nạp vẫn chạy mà .
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);
__________________
ĐT : 0167 6455 880 Mail: quanghuy1205@gmail.com
https://www.facebook.com/ThietKeDienTu
quanghuy_125 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn