抖动
led_array_num = 0;
music_array_num = 0;
TH1 = 0x3c;
TL1 = 0xb0;
P0 = led_array_p0[0][0];//彩灯
P2 = led_array_p2[0][0];
t_count_led = 0;
TH0 = music_array_h[0][0];//音乐
TL0 = music_array_l[0][0];
t_yinfu = music_array_t[0][0];
t_count_music = 0;
while(P1_0 == 0)
{
while(P1_0 == 0)
t_count_music = 0;
delay();
}
TR0 = 1;
TR1 = 1;
}
}
if(P1_1 == 0)
{
delay();
if(P1_1 == 0)
{
TR0 = 0;
TR1 = 0;
i = 1;
led_array_num = 0;
music_array_num = 0;
TH1 = 0x3c;
TL1 = 0xb0;
P0 = led_array_p0[1][0];//彩灯
P2 = led_array_p2[1][0];
t_count_led = 0;
TH0 = music_array_h[1][0];//音乐
TL0 = music_array_l[1][0];
t_yinfu = music_array_t[1][0];
t_count_music = 0;
while(P1_1 == 0)
{
while(P1_1 == 0)
t_count_music = 0;
delay();
}
TR0 = 1;
TR1 = 1;
}
}
if(P1_2 == 0)
{
delay();
if(P1_2 == 0)
{
TR0 = 0;
TR1 = 0;
i = 2;
led_array_num = 0;
music_array_num = 0;
TH1 = 0x3c;
TL1 = 0xb0;
P0 = led_array_p0[2][0];//彩灯
P2 = led_array_p2[2][0];
t_count_led = 0;
TH0 = music_array_h[2][0];//音乐
TL0 = music_array_l[2][0];
t_yinfu = music_array_t[2][0];
t_count_music = 0;
while(P1_2 == 0)
{
while(P1_2 == 0)
t_count_music = 0;
delay();
}
TR0 = 1;
TR1 = 1;
}
}
if(P1_3 == 0)
{
delay();
if(P1_3 == 0)
{
TR0 = 0;
TR1 = 0;
i = 3;
led_array_num = 0;
music_array_num = 0;
TH1 = 0x3c;
TL1 = 0xb0;
P0 = led_array_p0[3][0];//彩灯
P2 = led_array_p2[3][0];
t_count_led = 0;
TH0 = music_array_h[3][0];//音乐
TL0 = music_array_l[3][0];
t_yinfu = music_array_t[3][0];
t_count_music = 0;
while(P1_3 == 0)
{
while(P1_3 == 0)
t_count_music = 0;
delay();
}
TR0 = 1;
TR1 = 1;
}
}
}
}
void Timer0IntRoute(void) interrupt 1
{
t_count_music++;
P1_4 = ~P1_4;
TH0 = music_array_h[i][music_array_num];//音乐
TL0 = music_array_l[i][music_array_num];
if(t_count_music >= t_yinfu)
{
t_yinfu = music_array_t[i][++music_array_num];
if(t_yinfu == 0)
{
music_array_num = 0;
t_yinfu = music_array_t[i][music_array_num];
}
TH0 = music_array_h[i][music_array_num];//音乐
TL0 = music_array_l[i][music_array_num];
t_count_music = 0;
}
}
void Timer1IntRoute(void) interrupt 3
{
t_count_led++;
TH1 = 0x3c;
TL1 = 0xb0;
if(t_count_led >= TLEDS)
{
t_count_led = 0;
led_array_num++;
if(led_array_num>=NUM_OF_LED_S)
led_array_num = 0;
P0 = led_array_p0[i][led_array_num];
P2 = led_array_p2[i][led_array_num];
}
}