mình đang làm đồ án điều khiển thiết bị 4 kênh sử dụng vdk pic16f877a có sử dụng pt2262 và pt2272. Hiện thị thông tin bật tắt ra lcd. mình đang gặp lỗi ở code này. ko hiểu lỗi này là như nào. mong a e chỉ giúp và chỉ cách khắc phục ạ.
#include <16F877A.h>
#include <def_877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT,
NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20000000)
#include <lcd_lib_4bit.c>//thu vien lcd 4 bit
#define k1 RD0
#define k2 RD1
#define k3 RD2
#define k4 RD3
#define relay1 RD4
#define relay2 RD5
#define relay3 RD6 #define relay4 RD7
int8 thietbi1,thietbi2,thietbi3,thietbi4;
//----------------------------------------------------------------- void main()
{ trisb = 0x00; trisc = 0x00;
trisd = 0x0f;
LCD_init();
thietbi1 = thietbi2 = thietbi3 = thietbi4 = 0;//tat het thiet bi relay1 = thietbi1; relay2 = thietbi2; relay3 = thietbi3; relay4 = thietbi4; while(TRUE)
{
LCD_putcmd(0x80);//hien thi hang 1 cua lcd printf(LCD_putchar,"RL1 RL2 RL3 RL4 "); LCD_putcmd(0xC0);//hien thi hang 2 cua lcd if(thietbi1==0) printf(LCD_putchar,"TAT "); else printf(LCD_putchar,"BAT "); if(thietbi2==0) printf(LCD_putchar,"TAT "); else printf(LCD_putchar,"BAT "); if(thietbi3==0) printf(LCD_putchar,"TAT ");
else printf(LCD_putchar,"BAT "); if(thietbi4==0) printf(LCD_putchar,"TAT "); else printf(LCD_putchar,"BAT ");
if(k1==0){ while(k1==0){} if(thietbi1==0) thietbi1=1; else thietbi1=0; relay1 = thietbi1; }
if(k2==0){ while(k2==0){} if(thietbi2==0) thietbi2=1; else thietbi2=0; relay2 = thietbi2; }
if(k3==0){ while(k3==0){} if(thietbi3==0) thietbi3=1; else thietbi3=0; relay3 = thietbi3; }
if(k4==0){ while(k4==0){} if(thietbi4==0) thietbi4=1;
else thietbi4=0; relay4 = thietbi4; }
}
}
#include <16F877A.h>
#include <def_877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT,
NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20000000)
#include <lcd_lib_4bit.c>//thu vien lcd 4 bit
#define k1 RD0
#define k2 RD1
#define k3 RD2
#define k4 RD3
#define relay1 RD4
#define relay2 RD5
#define relay3 RD6 #define relay4 RD7
int8 thietbi1,thietbi2,thietbi3,thietbi4;
//----------------------------------------------------------------- void main()
{ trisb = 0x00; trisc = 0x00;
trisd = 0x0f;
LCD_init();
thietbi1 = thietbi2 = thietbi3 = thietbi4 = 0;//tat het thiet bi relay1 = thietbi1; relay2 = thietbi2; relay3 = thietbi3; relay4 = thietbi4; while(TRUE)
{
LCD_putcmd(0x80);//hien thi hang 1 cua lcd printf(LCD_putchar,"RL1 RL2 RL3 RL4 "); LCD_putcmd(0xC0);//hien thi hang 2 cua lcd if(thietbi1==0) printf(LCD_putchar,"TAT "); else printf(LCD_putchar,"BAT "); if(thietbi2==0) printf(LCD_putchar,"TAT "); else printf(LCD_putchar,"BAT "); if(thietbi3==0) printf(LCD_putchar,"TAT ");
else printf(LCD_putchar,"BAT "); if(thietbi4==0) printf(LCD_putchar,"TAT "); else printf(LCD_putchar,"BAT ");
if(k1==0){ while(k1==0){} if(thietbi1==0) thietbi1=1; else thietbi1=0; relay1 = thietbi1; }
if(k2==0){ while(k2==0){} if(thietbi2==0) thietbi2=1; else thietbi2=0; relay2 = thietbi2; }
if(k3==0){ while(k3==0){} if(thietbi3==0) thietbi3=1; else thietbi3=0; relay3 = thietbi3; }
if(k4==0){ while(k4==0){} if(thietbi4==0) thietbi4=1;
else thietbi4=0; relay4 = thietbi4; }
}
}
Comment