Not signed? Charles? Temperature;
Not signed? Charles? Key;
Not signed? Charles? I,j;
Not signed? Charles? STH0
Not signed? Charles? STL0
Not signed? int? Code? tab[]={6402 1,64 103,64260,64400,
64524,64580,64684,64777,
64820,64898,64968,65030,
65058,65 1 10,65 157,65 178};
Invalid? Major (invalid)
{
TMOD = 0x 0 1;
ET0 = 1;
EA = 1;
while( 1)
{
P3 = 0x ff; ? //Kill P3.
P3 _ 4 = 0; ? //Make P3_4 low, so that it can be judged whether the first vertical line is pressed.
temp = P3;
temp=temp? & amp? 0x0f?
What if? (temp! =0x0f)// A key was pressed.
{
for(I = 50; I>0; I-)
for(j = 200; j & gt0; j-); ? //delay
temp = P3; ?
temp=temp? & amp? 0x0f
What if? (temp! =0x0f)? //Then it is judged whether a key is pressed.
{
temp = P3;
temp=temp? & amp? 0x0f
Switch(temp)// Determines which key was pressed.
{
Case? 0x0e:
key = 0;
Break;
Case? 0x0d:
key = 1;
Break;
Case? 0x0b:
key = 2;
Break;
Case? 0x07:
key = 3;
Break;
}
temp = P3;
p 1 _ 0 = ~ p 1 _ 0;
P0 = table [key];
sth 0 = tab[key]/256; //Find out the time of the frequency corresponding to this key as the initial value of timer interrupt.
STL 0 = tab[key]% 256;
TR0 = 1;
temp=temp? & amp? 0x0f
while(temp! =0x0f)
{
temp = P3;
temp=temp? & amp? 0x0f
}
TR0 = 0;
}
}
P3 = 0x ff;
P3 _ 5 = 0; ? //Similar to the above, now it is the button for judging the second row.
temp = P3;
temp=temp? & amp? 0x0f
What if? (temp! =0x0f)
{
for(I = 50; I>0; I-)
for(j = 200; j & gt0; j-);
temp = P3;
temp=temp? & amp? 0x0f
What if? (temp! =0x0f)
{
temp = P3;
temp=temp? & amp? 0x0f
Switch (temperature)
{
Case? 0x0e:
key = 4;
Break;
Case? 0x0d:
key = 5;
Break;
Case? 0x0b:
key = 6;
Break;
Case? 0x07:
key = 7;
Break;
}
temp = P3;
p 1 _ 0 = ~ p 1 _ 0;
P0 = table [key];
sth 0 = tab[key]/256;
STL 0 = tab[key]% 256;
TR0 = 1;
temp=temp? & amp? 0x0f
while(temp! =0x0f)
{
temp = P3;
temp=temp? & amp? 0x0f
}
TR0 = 0;
}
}
P3 = 0x ff;
P3 _ 6 = 0;
temp = P3;
temp=temp? & amp? 0x0f
What if? (temp! =0x0f)
{
for(I = 50; I>0; I-)
for(j = 200; j & gt0; j-);
temp = P3;
temp=temp? & amp? 0x0f
What if? (temp! =0x0f)
{
temp = P3;
temp=temp? & amp? 0x0f
Switch (temperature)
{
Case? 0x0e:
key = 8;
Break;
Case? 0x0d:
key = 9;
Break;
Case? 0x0b:
key = 10;
Break;
Case? 0x07:
key = 1 1;
Break;
}
temp = P3;
p 1 _ 0 = ~ p 1 _ 0;
P0 = table [key];
sth 0 = tab[key]/256;
STL 0 = tab[key]% 256;
TR0 = 1;
temp=temp? & amp? 0x0f
while(temp! =0x0f)
{
temp = P3;
temp=temp? & amp? 0x0f
}
TR0 = 0;
}
}
P3 = 0x ff;
P3 _ 7 = 0;
temp = P3;
temp=temp? & amp? 0x0f
What if? (temp! =0x0f)
{
for(I = 50; I>0; I-)
for(j = 200; j & gt0; j-);
temp = P3;
temp=temp? & amp? 0x0f
What if? (temp! =0x0f)
{
temp = P3;
temp=temp? & amp? 0x0f
Switch (temperature)
{
Case? 0x0e:
key = 12;
Break;
Case? 0x0d:
key = 13;
Break;
Case? 0x0b:
key = 14;
Break;
Case? 0x07:
key = 15;
Break;
}
temp = P3;
p 1 _ 0 = ~ p 1 _ 0;
P0 = table [key];
sth 0 = tab[key]/256;
STL 0 = tab[key]% 256;
TR0 = 1;
temp=temp? & amp? 0x0f
while(temp! =0x0f)
{
temp = P3;
temp=temp? & amp? 0x0f
}
TR0 = 0;
}
}
}
}
Invalid? t0(void)? Interrupt? 1? Use? 0
{
TH0 = STH0
TL0 = STL0
p 1 _ 0 = ~ p 1 _ 0;
}
I have both the circuit diagram and the principle, which is exactly what I am doing. ? Watch the show by yourself. I don't want to comment. ?
This can make 16 notes. When writing A89S52, it should be AT89S52.