欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

專注電子技術學習與研究
當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

遠程同步燈燈光效果子程序

作者:佚名   來源:本站原創   點擊數:  更新時間:2011年02月22日   【字體:

前面一篇文章里我們介紹了單片機遠程同步燈的電路和主程序,地址:http://www.raoushi.com/mcu/1171.html ,根據大家都要求我把燈光效果子程序也在此公開,大家在制作的過程中遇到什么問題可在本文評論中提出,我會盡量為大家解決。
 

void zhuizhu(void)
{
    uchar i;
    for(i=0;i<8;i++)
    {P0=zhui;delay();}
    for(i=0;i<8;i++)
    {   
        if(i+8<12)
        P0=zhui;

        P1=zhui;
        delay();
    }

    for(i=0;i<13;i++)
    {   
        if(i+8<12)
        P1=zhui;

        P2=zhui;
        delay();
    }
    P2=0x00;

}
void liushui(void)
{
    uchar i,j,k; 

        P0=0x00;
        P1=0x00;
        P2=0x00;
        delay();
        for(i=0;i<8;i++)
        {   P0|=SET(i);  delay();}
        for(j=0;j<8;j++)
        {   P1|=SET(j);  delay();}
        for(k=0;k<8;k++)
        {   P2|=SET(k);  delay();}

        for(k=0;k<8;k++)
        {   P2&=CLR_TO_R(k);  delay();}

        for(j=0;j<8;j++)
        {   P1&=CLR_TO_R(j);  delay();}
        for(i=0;i<8;i++)
        {   P0&=CLR_TO_R(i);  delay();}

}

void RGBjianbian(void)
{
uchar x;
uchar i,j;
//=================紅燈漸亮又漸暗 
for(x=0;x<LOG;x++)
    { for(i=0;i<LOG;i++)
        {
            P0=0x49;
            P1=0x92;
            P2=0x24;
        }

      for(j=0;j<LOG-x;j++)
        {   
            P0=0x00;
            P1=0x00;
            P2=0x00;
        }
    }               //燈從不亮到最亮   
P36=1;
for(x=0;x<LOG;x++)
    { for(i=0;i<LOG;i++)
        {   
            P0=0x00;
            P1=0x00;
            P2=0x00;
        }
      for(j=0;j<LOG-x;j++)
        {
            P0=0x49;
            P1=0x92;
            P2=0x24;
        }
    }                  //從最亮又到暗  

P0=0x00;
P1=0x00;
P2=0x00; 

//================================
//================綠燈漸亮又漸暗 


for(x=0;x<LOG;x++)
    { for(i=0;i<LOG;i++)
        {
            P0=0x92;
            P1=0x24;
            P2=0x49;
        }
      for(j=0;j<LOG-x;j++)
        {   
            P0=0x00;
            P1=0x00;
            P2=0x00;
        }
    }               //燈從不亮到最亮   
for(x=0;x<LOG;x++)
    { for(i=0;i<LOG;i++)
        {   
            P0=0x00;
            P1=0x00;
            P2=0x00;
        }
      for(j=0;j<LOG-x;j++)
        {
            P0=0x92;
            P1=0x24;
            P2=0x49;
        }
    }

//==============藍燈變化 

P0=0x00;
P1=0x00;
P2=0x00; 

for(x=0;x<LOG;x++)
    { for(i=0;i<LOG;i++)
        {
            P0=0x24;
            P1=0x49;
            P2=0x92;
        }
      for(j=0;j<LOG-x;j++)
        {   
            P0=0x00;
            P1=0x00;
            P2=0x00;
        }
    }               //燈從不亮到最亮   
for(x=0;x<LOG;x++)
    { for(i=0;i<LOG;i++)
        {   
            P0=0x00;
            P1=0x00;
            P2=0x00;
        }
      for(j=0;j<LOG-x;j++)
        {
            P0=0x24;
            P1=0x49;
            P2=0x92;
        }
    }

P0=0x00;
P1=0x00;
P2=0x00; 
}


void  shanshuo(void) 
{
    P0=0x0f;
    P1=0x0f;
    P2=0x0f;
    delay2();

    P0=0x00;
    P1=0x00;
    P2=0x00;
    delay2();

    P0=0xf0;
    P1=0xf0;
    P2=0xf0;
    delay2();

    P0=0x00;
    P1=0x00;
    P2=0x00;
    delay2();
}

void delay2(void)
{
    uchar i,j,k;
    for(i=0;i<50;i++)
        for(j=0;j<80;j++)
            for(k=0;k<100;k++)
                ;
}

void kaolong(void)
{
    P0=0x00;
    P1=0x00;
    P2=0x00;

    P0=0x11;
    P1=0x81;
    P2=0x88;
    delay2();

    P0=0x22;
    P1=0x42;
    P2=0x44;
    delay2();

    P0=0x44;
    P1=0x24;
    P2=0x22;
    delay2();

    P0=0x88;
    P1=0x18;
    P2=0x11;
    delay2();
}

void liushui2(void)
{
    P0=0x00;
    P1=0x00;
    P2=0x00;

    P0=0x01;
    delay();
    P0=0x08;
    delay();
    P0=0x40;
    delay();
    P0=0x00;

    P1=0x02;
    delay();
    P1=0x10;
    delay();
    P1=0x80;
    delay();
    P1=0x00;

    P2=0x04;
    delay();
    P2=0x20;
    delay();
    P2=0x00;  //===================red 

    P0=0x02;
    delay();
    P0=0x010;
    delay();
    P0=0x80;
    delay();
    P0=0x00;

    P1=0x04;
    delay();
    P1=0x20;
    delay();
    P1=0x00;

    P2=0x01;
    delay();
    P2=0x08;
    delay();
    P2=0x40;
    delay();
    P2=0x00;   //===================green

    P0=0x04;
    delay();
    P0=0x20;
    delay();
    P0=0x00;

    P1=0x01;
    delay();
    P1=0x08;
    delay();
    P1=0x40;
    delay();
    P1=0x00;

    P2=0x02;
    delay();
    P2=0x10;
    delay();
    P2=0x80;
    delay();
    P2=0x00;  //======================blue 
} 
關閉窗口

相關文章