counter cho pic 16f877a
em đang gặp vấn đề về counter mây anh có thể giúp em đc ko ! chi cho em biết cái sai với mây huynh ! em dung nut bấm để tạo xung đếm cho counter mà sao nó ko chạy ! help !
#include <16f877a.h>
#fuses hs,nowdt,noput
#use delay(clock=20000000)
#define LCD_ENABLE_PIN PIN_D2
#define LCD_RS_PIN PIN_D0
#define LCD_RW_PIN PIN_D1
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
#include <lcd.c>
int i;
#int_ccp1
void ngat()
{
i=ccp_1;
}
void main()
{
lcd_init();
setup_ccp1(CCP_CAPTURE_rE);
setup_timer_1(T1_INTERNAL);
enable_interrupts(GLOBAL);
enable_interrupts(int_ccp1);
while (1)
{
lcd_gotoxy(1,2);
printf(lcd_putc,"TOC DO=%d",i);
}
}
|