View Single Post
Old 02-09-2013, 10:11 AM   #1
thuanbk1989
Nhập môn đệ tử
 
Tham gia ngày: Mar 2012
Bài gửi: 8
:
cần Giúp hàm Delay_ms...

hi!
Chào mọi người. mọi người giúp e với nhé.
E dùng lệnh delay_ms(10000); nói chung là lệnh delay thì nó chạy k có đúng lệnh delay_ms(10000) mà nó chạy 13,5s lận. e phải làm sao giờ tại e cần độ chính xác xíu.
Nọi thứ đều hoạt động tốt chỉ sai chỗ này thui .e có dùng lênh #use delay( clock = 20000000)
CODE:
#int_EXT
#use delay( clock = 20000000)
void EXT_isr(void)
{
//delay_ms(1000);
Output_high(pin_a1);
//delay_ms(2000);
}
void main()
{

setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
ext_int_edge (0 ,L_TO_H) ; //chon kieu ngat tu muc thap len cao
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab

// TODO: USER CODE!!
set_tris_a(0b00000101);
//set_tris_c(0b00000000);

while(1) {
Output_high(pin_a1);
delay_ms(5000);
Output_low(pin_a1);
delay_ms(5000);

}
cảm ơn moi người trước nhé
thuanbk1989 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn