高手解释一下这个程序吧
#include <STC12C5AXX.H>#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit RED1 = P1^0; //红色IO口定义
sbit GREEN1 = P1^1; //绿色IO口定义
sbit BLUE1 = P1^2; //蓝色IO口定义
sbit RED11 = P1^5;
uchar num1=0,PTR1=0,DPTR=0,DPTR1=0;
long int PWM_HL1,PWM_H1,PWM_L1,time_num=0,j1,a=0;
uchar LED_REG;
bit Jump_flg=1;
void chioc_RGB1(uchar LED_REG)
{
uchar LEDDATA; LEDDATA=LED_REG;
switch(LEDDATA)
{case 0: RED1=1;GREEN1=0;BLUE1=0;break;
case 1: RED1=1;GREEN1=1;BLUE1=0;break;
case 2: RED1=1;GREEN1=1;BLUE1=0;break;
case 3: RED1=0;GREEN1=1;BLUE1=0;break;
case 4: RED1=0;GREEN1=1;BLUE1=0;break;
case 5: RED1=0;GREEN1=1;BLUE1=1;break;
case 6: RED1=0;GREEN1=1;BLUE1=1;break;
case 7: RED1=0;GREEN1=0;BLUE1=1;break;
case 8: RED1=0;GREEN1=0;BLUE1=1;break;
case 9: RED1=1;GREEN1=0;BLUE1=1;break;
case 10: RED1=1;GREEN1=0;BLUE1=1;break;
case 11: RED1=1;GREEN1=0;BLUE1=0;break;
default: break;}}
void chioc_RGB(uchar LED_REG)
{
uchar LEDDATA;
LEDDATA=LED_REG;
switch(LEDDATA)
{case 0: RED1=0;GREEN1=1;BLUE1=1;break;
case 1: RED1=1;GREEN1=0;BLUE1=1;break;
case 2: RED1=1;GREEN1=1;BLUE1=0;break;
case 3: RED1=1;GREEN1=0;BLUE1=0;break;
case 4: RED1=0;GREEN1=0;BLUE1=1;break;
case 5: RED1=0;GREEN1=1;BLUE1=0;break;
case 6: RED1=0;GREEN1=0;BLUE1=0;break;
default: break;}}
void Jump_RGB()
{
chioc_RGB(DPTR);
// Jump_flg=0;
// TR0 = 1;
}
void Gradual_RGB()
{
PWM_H1=j1;
PWM_L1=PWM_HL1-j1+1;
chioc_RGB1(DPTR1);
for(;PWM_H1>0;PWM_H1--)
_nop_;
chioc_RGB1(DPTR1+1);
for(;PWM_L1>0;PWM_L1--)
_nop_;
}
void InitTimer0(void)
{ Jump_flg=1;
RED1=1;
GREEN1=1;
BLUE1=1;
j1=500;
PWM_HL1=500;
TMOD = 0x01;
TH0 = 0xF0;
TL0 = 0x60;
EA = 1;
ET0 = 1;
TR0 = 1;
}
void main()
{
InitTimer0();
for(;;)
{
//RED1=0;
//GREEN1=1;
//BLUE1=0;
Gradual_RGB();
/* if(Jump_flg==1){Jump_RGB();}
else{Gradual_RGB();} */
}
}
void Timer0Interrupt(void) interrupt 1
{
TH0 = 0xF0;
TL0 = 0x60;
if(Jump_flg)
{
time_num++;
if(time_num>=18000)
{time_num=0;DPTR++;
if(DPTR>=7)
{ DPTR=0;
Jump_flg=0;}
}
}
else
{
a++;
if(a>=20)
{a=0;
j1--;
if(j1<=0)
{j1=500;DPTR1=DPTR1+2;
if(DPTR1>11)
{
DPTR1=0;
Jump_flg=1;
}
} }
}
}