View Single Post
Old 16-03-2008, 02:14 AM   #1
phamtrieu138
Nhập môn đệ tử
 
phamtrieu138's Avatar
 
Tham gia ngày: Feb 2008
Bài gửi: 5
:
Unhappy timer1-giúp mình gấp với

Code:
#include "C:\Documents and Settings\tungdinh's computer\My Documents\timer0\ff.h"
#use fast_io(c)
#use fast_io(a)
int dem;
#int_TIMER1
TIMER1_isr() 
{
if (pin_A4)
{
dem++;
}
set_timer1(1000);
}



void main()
{
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   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_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_TIMER1);
   enable_interrupts(GLOBAL);
   set_timer1(1000);
   set_tris_c(0);
   set_tris_a(0b111111);
   output_high(pin_c1);output_high(pin_c2);
   dem=0;
   while(dem<5)
   {
   }
   output_low(pin_c1);output_low(pin_c2);
   // TODO: USER CODE!!

}
sao mìnhcho A4 1 lần=1 mà c1=0;c2=0????????

thay đổi nội dung bởi: namqn, 16-03-2008 lúc 03:13 AM.
phamtrieu138 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn