anh_gioi
27-09-2008, 12:38 AM
bài toán đơn giản là: khi cấp mức cao vào capture (pin_RC2) 1 khoang thời gian nào đấy thì số giây đó được hiển thị trên LCD.em dùng timer1 để đếm khoảng thời gian đó:
#include "F:\NCKH 2009\PIC 16\count_timer2\count_timer2.h"
#include <lcd_lib_4bit.c>
#include <F:\NCKH 2009\PIC 16\count_timer2\def_877a.h>
float value;
void main()
{
trisd = 0x00;
trisc = 0x04;
LCD_init();
Printf(LCD_putchar,"gioi");
setup_timer_1(T1_INTERNAL | T1_DIV_BY_4);
while(!input(pin_c2)) {} // Wait for senser output to go high;
set_timer1(0);
while(input(pin_c2)) {}
value = get_timer1();
LCD_putcmd(0xC0);
LCD_putchar(value);
LCD_putcmd(0xCb);
printf(LCD_putchar," giay");
}
khi mô phỏng thì không hiển thị giá trị "value" cần tìm?
không biết em sai ở chỗ nào? mong các anh chỉ giúp !!!
#include "F:\NCKH 2009\PIC 16\count_timer2\count_timer2.h"
#include <lcd_lib_4bit.c>
#include <F:\NCKH 2009\PIC 16\count_timer2\def_877a.h>
float value;
void main()
{
trisd = 0x00;
trisc = 0x04;
LCD_init();
Printf(LCD_putchar,"gioi");
setup_timer_1(T1_INTERNAL | T1_DIV_BY_4);
while(!input(pin_c2)) {} // Wait for senser output to go high;
set_timer1(0);
while(input(pin_c2)) {}
value = get_timer1();
LCD_putcmd(0xC0);
LCD_putchar(value);
LCD_putcmd(0xCb);
printf(LCD_putchar," giay");
}
khi mô phỏng thì không hiển thị giá trị "value" cần tìm?
không biết em sai ở chỗ nào? mong các anh chỉ giúp !!!