Filewordvdk 1
Filewordvdk 1
} } } P2_0 = P2_7 = 0;
delay(20000); P2_0
#define sang = 0 } }
=P2_7 = 1;
#define tat = 1 void void blink( char
}
phaisangtrai(char lanlap)
void lanlap) }
traisangphai( char {
lanlap) { void main()
char i;
{ char i; {
for(i=0;i<lanlap;i++)
char i; for(i=0;i<lanlap;i++) while(1)
{
for(i=0;i<lanlap;i++) { {
P2 = 0;
{ P2_7 = 0; if(P3_0==1){}
delay(10000);
delay(20000); P2_7
P2_0 = 0; if(P3_0==0)
= 1; P2 = 0xff;
delay(20000); P2_0 {traisangphai(1);}
= 1; P2_6 = 0; delay(10000);
if(P3_1==1){}
delay(20000); P2_6
P2_1 = 0; = 1; }
if(P3_1==0)
delay(20000); P2_1
} {phaisangtrai(1);}
= 1; P2_5 = 0;
delay(20000); P2_5 void if(P3_2==1){}
P2_2 = 0; = 1; giuasanghaiben( ch
delay(20000); P2_2 if(P3_2==0)
P2_4 = 0; ar lanlap)
= 1; {blink(1);}
delay(20000); P2_4 {
P2_3 = 0; = 1; if(P3_3==1){}
delay(20000); P2_3 char i;
P2_3 = 0; if(P3_3==0)
= 1;
delay(20000); P2_3 for(i=0;i<lanlap;i++) {giuasanghaiben(1);
P2_4 = 0; = 1; }
delay(20000); P2_4 {
P2_2 = 0; }
= 1; P2_3 = P2_4 = 0;
delay(20000); P2_2 delay(20000); P2_3 }
P2_5 = 0; = 1;
delay(20000); P2_5 =P2_4 = 1;
= 1;
Bài3
Bài9
delayhn(100); RW = 0;
} delay(1);
void delay(uint c) { E = 1;
uchar a, b; delay(5);
while (c--) { E = 0;
} E = 1;
} delay(5);
} E = 0;
E = 0; void khoitaolcd() {
RS = 0; LcdWriteCom(0x32);
RW = 0; LcdWriteCom(0x28);
delay(1); LcdWriteCom(0x06);
E = 1; LcdWriteCom(0x01);
delay(5); LcdWriteCom(0x80);
E = 0; }
delay(1); uchar i;
E = 1; while (x--) {
E = 0; }
} }
E = 0; IT0 = 1;
EX0 = 1; while ((IRIN == 1) && (err--)) {
EA = 1; delayhn(1);
IRIN = 1; Time++;
uchar j, k; return;
uint err; }
Time = 0; }
if (IRIN == 1) { }
err = 60; }
err = 500; }
Bài6
#include <REGX52.H> {
sbit ds = P3^4; }
sbit sh = P3^6; {
{0x5E, 0x5A, 0x8A, 0x8A, 0xDA, 0x72, 0x00, cotled((0x01 << i));
0x00}, // 5 delay(80);
st = 1;
} if (!(P1 & (1 << cot)))
} {
void chay1chu(unsigned int tocdo, unsigned while (!(P1 & (1 << cot)));
char* chaychu)
return 15 - (hang * 4 + cot);
{
}
int w;
}
for (w = 0; w < tocdo; w++)
}
{
}
hienchu(chaychu);
return 0xFF;
}
}
}
void main()
unsigned char quetnut()
{
{
unsigned char nh;
unsigned char hang, cot;
while (1)
for (hang = 0; hang < 4; hang++)
{
{
nh = quetnut();
P1 = 0xFF;
if (nh < 16)
P1 &= ~(0x10 << hang);
{
delay(2);
chay1chu(100, chu[nh]);
if ((P1 & 0x0F) != 0x0F)
}
{
}
for (cot = 0; cot < 4; cot++)
}
{
Bài7
{ E = 0; sbit DQ = P3^7;
Bài5