Code chương trình: #include #include #include #include #define RS P3_0 #define RW P3_1 //RW=0 => ghi #define EN P3_2 //RW=1 => doc //RS=0 => code //RS=1 => data #define LCD_PORT P0 sbit cot0=P2^0; sbit cot1=P2^1; sbit cot2=P2^2; sbit cot3=P2^3; sbit hang0=P2^4; sbit hang1=P2^5; sbit hang2=P2^6; sbit hang3=P2^7; int sttphim; unsigned char dau; void wait(void) { long n = 0; EN=1;// Dua chan cho fep len cao RS=0;// Chon ghi lenh RW=1;// Doc tu LCD LCD_PORT=0xFF;// Gia tri 0xFF while(1){n++; if(n>100) break;}// Kiem tra co ban // Neu ban dem n den 100 roi thoat khoi while EN=0;// Dua xung cao xuong thap de chot RW=0;// Doc tu LCD } void delay(long time) /* ham delay */ { long n; for(n=0;n