Chạy được rồi này, vấn đề đúng là nằm ở gạch đầu dòng thứ 2 và thứ 3 của bác Nam
Code:
#include <16F877A.h>
#include <def_877a.h>
#device *=16 adc=10
#FUSES NOWDT, XT, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=4000000)
#use fast_io (b)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)
#define OK PIN_B6
#define Cancel PIN_B7
#define OK_PRESSED !input(OK)
#include <lcd_lib_4bit.c>
int8 count;
char phim;
int8 isr_count,press;
#int_TIMER0
void interrupt_timer0()
{
if(OK_PRESSED)
{
isr_count++;
if(isr_count==81)
{
isr_count=0;
press=1;
disable_interrupts(GLOBAL);
disable_interrupts(INT_TIMER0);
}
}
else
{
press=0;
disable_interrupts(GLOBAL);
disable_interrupts(INT_TIMER0);
}
}
//-----------------------------------------------------------------
void main(void)
{
press=0;
output_b(0xC0);
set_tris_a(0xC0);
set_tris_b(0xC1);
port_b_pullups (TRUE);
LCD_init();
delay_ms(500);
LCD_putcmd(0x80);
Printf(LCD_putchar,"Hi ev'body"); //Hien thi man hinh 1
LCD_putcmd(0xC0);
Printf(LCD_putchar,"Khoi tao...");
while (!OK_PRESSED) { }
//enable timer0
set_timer0(6);
setup_timer_0(RTCC_INTERNAL);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);
while(press!=1) {}
LCD_putcmd(0x01); //xoa man hinh
LCD_putcmd(0x80);
Printf(LCD_putchar,"Enter Pressed"); //Hien thi man hinh 2
}