久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 10113|回復(fù): 45
打印 上一主題 下一主題
收起左側(cè)

誰(shuí)能給我給個(gè)流水燈程序

  [復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:150178 發(fā)表于 2016-11-25 17:58 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
誰(shuí)有啊給我發(fā)個(gè)唄
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:150194 發(fā)表于 2016-11-25 19:00 來(lái)自手機(jī) | 只看該作者
#include <reg52.h>
回復(fù)

使用道具 舉報(bào)

板凳
ID:150194 發(fā)表于 2016-11-25 19:11 來(lái)自手機(jī) | 只看該作者
#include <reg52.h>   #include<intrins.h> #define uchar unsigned char #define uint unsigned int uchar b=0x01; void delay(uchar  x) {     uchar a;     while(x--)      {              for(a=0;a<120;a++);       } }  void main() {   while(1)    {         P0=b;      delay(50);       b=_crol_(b,1);      } }
回復(fù)

使用道具 舉報(bào)

地板
ID:57657 發(fā)表于 2016-11-26 18:49 | 只看該作者
控制IO口數(shù)據(jù)左移右移,賦值數(shù)據(jù),以及加上延遲函數(shù)就行。
回復(fù)

使用道具 舉報(bào)

5#
ID:152365 發(fā)表于 2016-12-9 20:28 | 只看該作者
#include<reg52.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar temp;
void delay(uint);
void main()
{
          temp=0xfe;
          P2=temp;
          while(1)
        {
                temp=_crol_(temp,1);
                delay(600);
                P2=temp;
        }
}
void delay(int z)
{
        uint x,y;
        for(x=100;x>0;x--)
          for(y=z;y>0;y--);
}
回復(fù)

使用道具 舉報(bào)

6#
ID:148885 發(fā)表于 2016-12-9 21:59 | 只看該作者
#include<reg52.h> #include<intrins.h> #define uint unsigned int #define uchar unsigned char uchar t1,t2,s; void delayms(uint); void main() {        EA=1;         ET0=1;         ET1=1;         TR0=1;         TR1=1;         while(1)         {            P1=s;                         P1=0xff;          } } void t0()interrupt 0 {         TH0=(65536-45872)/258;         TL0=(65536-45872)%256;         t1++;         if(t1==10)         {                 t1==0;                 P1=~P1;         } } void Y1()interrupt 3 {         TH1=(65536-45872)/256;         TL1=(65536-45872)%256;         t2++;         if(t2==10)         {                   t2==0;                   P1=_cror_(s,1);         } }
回復(fù)

使用道具 舉報(bào)

7#
ID:150555 發(fā)表于 2016-12-9 22:11 | 只看該作者
#include<reg52.h>
int a[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//上至下
int b[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//下至上
int c[]={0x7e,0xbd,0xdb,0xe7};//邊至中
int d[]={0xe7,0xdb,0xbd,0x7e};//中至邊
void delay(int);
void main()
{
        int i,j;
        while(1){
        for(i=1;i<4;i++)
        {
                P1=0xaa;
                delay(400);
                P1=0x55;
                delay(400);
        }
        for(j=0;j<3;j++)
         {
                        for(i=0;i<8;i++)
                        {
                                P1=a[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
                        for(i=0;i<8;i++)
                        {
                                P1=b[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=c[j];
                         delay(100);
                        // P1=0xff;
                        // delay(100);
     }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=d[j];
                         delay(100);
                         //P1=0xff;
                         //delay(100);
     }
   }
         for(i=1;i<4;i++)
         {
                 P1=0x00;
                 delay(100);
                 P1=0xff;
                 delay(100);
   }
}
}
void delay(int z)
{
        int i,j;
        for(i=100;i>0;i--)
                for(j=z;j>0;j--);
}
回復(fù)

使用道具 舉報(bào)

8#
ID:153393 發(fā)表于 2016-12-9 22:15 | 只看該作者
#include<reg52.h>#include<intrins.h>#define uchar unsigned char#define uint unsigned intvoid delay(uint z);main(){ uchar aa; while(1){ aa=0xfe;P1=aa;delay(100);while(1){aa=_crol_(aa,1);P1=aa;delay(100);}}}void delay(uint z){uint x,y;for(x=z;x>0;x--)for(y=110;y>0;y--);}
回復(fù)

使用道具 舉報(bào)

9#
ID:153755 發(fā)表于 2016-12-10 23:14 | 只看該作者
論壇太多教程。請(qǐng)多看教程和視頻
回復(fù)

使用道具 舉報(bào)

10#
ID:153755 發(fā)表于 2016-12-10 23:16 | 只看該作者
論壇有的親。多學(xué)習(xí)視頻
回復(fù)

使用道具 舉報(bào)

11#
ID:153790 發(fā)表于 2016-12-11 11:06 | 只看該作者
網(wǎng)上挺多的啊,
回復(fù)

使用道具 舉報(bào)

12#
ID:153881 發(fā)表于 2016-12-11 15:54 | 只看該作者
int i;
for(i=0;i<8;i++)
     PORTA=1<<i;
for(i=7;i>=2;i--)
     PORTA=1<<i;     
回復(fù)

使用道具 舉報(bào)

13#
ID:154526 發(fā)表于 2016-12-13 21:49 | 只看該作者
//主函數(shù),C語(yǔ)言的入口函數(shù):       
void main(void)
{
        P2=0XFE;
        while(1){                                //無(wú)限循環(huán)
                P2=(P2<<1)|(P2>>7);        //P2口值左循環(huán)移1位,也可利用函數(shù)庫(kù)"intrins.h"中的_crol_(),
                delay(50);                        //調(diào)用延時(shí)子函數(shù),改變參數(shù)大小,調(diào)整變化速度
        }
}

//延時(shí)子函數(shù)
void delay(unsigned char tmp)//雙重循環(huán)減,如改用INT型,將會(huì)達(dá)到更長(zhǎng)的延時(shí)時(shí)間
{
        unsigned char j;
        while(tmp--){
                j=255;
                while(j--);
        }
}
回復(fù)

使用道具 舉報(bào)

14#
ID:153846 發(fā)表于 2016-12-14 22:43 | 只看該作者
開發(fā)板上的8只LED為共陽(yáng)極連接,即單片機(jī)輸出端為低電平時(shí)即可點(diǎn)亮LED。  程序A:  ;用最直接的方式實(shí)現(xiàn)流水燈   ORG 0000H   START:MOV P1,#01111111B      最下面的LED點(diǎn)亮   LCALL DELAY;延時(shí)1秒   MOV P1,#10111111B            最下面第二個(gè)的LED點(diǎn)亮   LCALL DELAY;延時(shí)1秒   MOV P1,#11011111B            最下面第三個(gè)的LED點(diǎn)亮 (以下省略)  LCALL DELAY  MOV P1,#11101111B   LCALL DELAY  MOV P1,#11110111B   LCALL DELAY  MOV P1,#11111011B   LCALL DELAY  MOV P1,#11111101B   LCALL DELAY  MOV P1,#11111110B   LCALL DELAY   MOV P1,#11111111B              完成第一次循環(huán)點(diǎn)亮,延時(shí)約0.25秒   AJMP START                    反復(fù)循環(huán) ;延時(shí)子程序,12M晶振延時(shí)約250毫秒  DELAY: MOV R4,#2 L3: MOV R2 ,#250 L1: MOV R3 ,#250 L2: DJNZ R3 ,L2  DJNZ R2 ,L1 DJNZ R4 ,L3   RET  END 程序B:  ;用移位方式實(shí)現(xiàn)流水燈    org 00h    程序上電從00h開始              require.async(['wkcommon:widget/ui/lib/sio/sio.js'], function(sio) { var url = 'https://cpro.baidustatic.com/cpro/ui/c.js'; sio.callByBrowser( url, function () { BAIDU_CLB_fillSlotAsync('u2398768','cpro_u2398768'); } ); });             void function(e,t){for(var n=t.getElementsByTagName("img"),a=+new Date,i=[],o=function(){this.removeEventListener&&this.removeEventListener("load",o,!1),i.push({img:this,time:+new Date})},s=0;s< n.length;s++)!function(){var e=n[s];e.addEventListener?!e.complete&&e.addEventListener("load",o,!1):e.attachEvent&&e.attachEvent("onreadystatechange",function(){"complete"==e.readyState&&o.call(e,o)})}();alog("speed.set",{fsItems:i,fs:a})}(window,document);     ajmp main  跳轉(zhuǎn)到主程序 org 0030h    主程序起始地址  main:  mov a,#0feh  給A賦值成11111110  loop:   mov p1,a  將A送到P1口,發(fā)光二極管低電平點(diǎn)亮  lcall delay  調(diào)用延時(shí)子程序 rl a    累加器A循環(huán)左移一位 ajmp loop 重新送P1顯示  delay:  mov r3,#20  最外層循環(huán)二十次  d1:  mov r4,#80  次外層循環(huán)八十次  d2:  mov r5,#250  最內(nèi)層循環(huán)250次 djnz r5,$  總共延時(shí)2us*250*80*20=0.8S  djnz r4,d2 djnz r3,d1  ret end
回復(fù)

使用道具 舉報(bào)

15#
ID:154486 發(fā)表于 2016-12-15 20:40 | 只看該作者
這么普遍的程序,你沒(méi)有書嗎哼╭(╯^╰)╮
回復(fù)

使用道具 舉報(bào)

16#
ID:155213 發(fā)表于 2016-12-16 11:08 | 只看該作者
網(wǎng)上一搜一大把
回復(fù)

使用道具 舉報(bào)

17#
ID:155215 發(fā)表于 2016-12-16 11:12 | 只看該作者
我可以
回復(fù)

使用道具 舉報(bào)

18#
ID:155240 發(fā)表于 2016-12-16 13:19 | 只看該作者
這個(gè)簡(jiǎn)單
回復(fù)

使用道具 舉報(bào)

19#
ID:140489 發(fā)表于 2017-1-6 14:28 | 只看該作者
多種流水燈
#include<reg52.h>  
#include<intrins.h>  
#define uint unsigned int  
#define uchar unsigned char  
void delays(uint xms)  
{  
    uint i,j;  
    for(i=xms;i>0;i--)  
       for(j=110;j>0;j--);  
}  
void main()  
{  
     uint i,j,n; uchar a,b,c,d;   
     for(i=0;i<1;i++)       //                                                               所有燈閃1下  
     {  
         P0=P1=P2=P3=0x00;delays(1000);  
         P0=P1=P2=P3=0xff;delays(1000);  
     }                        
                       P3=P2=0xff;                                                        //兩邊一起向下流水  
                       for(j=0;j<=8;j++)  
                       {  
                           P1=0xff<<j;P0=0xff<<j;delays(40);  
                       }  
                       for(j=0;j<=8;j++)  
                       {  
                           P3=0xff<<j; P2=0xff>>j;delays(40);  
                       }  
                       P0=P1=P2=P3=0x00;delays(500);  
                       for(j=0;j<8;j++)  
                       {P3=0xff<<(7-j);P2=0xff>>(7-j);delays(40);  
                       }  
                      for(j=0;j<8;j++)  
                       {  
                           P0=0xff<<(7-j);P1=0xff<<(7-j);delays(40);  
                       }                                 
                                    P3=P2=0xff;           //兩邊 雜亂 閃爍  
                                    for(j=0;j<=8;j++)  
                                    {P1=0xff<<j; P0=0xff<<j; delays(40);  
                                    }  
                                    for(j=0;j<=8;j++)  
                                    {P3=0xff>>j;P2=0xff<<j; delays(40);  
                                    }  
                                    P0=P1=P2=P3=0x00;delays(500);  
                                    for(j=0;j<8;j++)  
                                    {P1=0xff>>(7-j);P0=0xff>>(7-j);delays(40);  
                                    }  
                                    for(j=0;j<8;j++)  
                                    {P2=0xff>>(7-j);P3=0xff<<(7-j);delays(40);  
                                    }                                   
        P0=P1=P2=P3=0xff;    //一邊向下流水  
        for(j=0;j<=8;j++)  
        { P1=0xff<<j;delays(30);  
        }        
        for(j=0;j<=8;j++)  
        {  
              P3=0xff<<j;delays(30);  
        }  
        for(j=0;j<=8;j++)  
        {  
              P2=0xff<<j;delays(30);  
        }  
        for(j=0;j<=8;j++)  
        {  
              P0=0xff>>j;delays(30);  
        }   
        P0=P1=P2=P3=0x00;  
        delays(500)  ;  
        for(j=0;j<8;j++)  
        {   
              P0=0xff>>(7-j);delays(30);  
        }  
        for(j=0;j<8;j++)  
        {   
              P2=0xff<<(7-j);delays(30);  
        }  
        for(j=0;j<8;j++)  
        {   
              P3=0xff<<(7-j);delays(30);  
        }  
        for(j=0;j<8;j++)  
        {   
              P1=0xff<<(7-j);delays(30);  
        }  
        P0=P1=P2=P3=0xff;  
        for(j=0;j<=8;j++)  
        {  
              P0=0xff<<j; delays(30);  
        }        
        for(j=0;j<=8;j++)  
        {  
              P2=0xff>>j; delays(30);  
        }  
        for(j=0;j<=8;j++)  
        {  
              P3=0xff>>j;delays(30);  
        }  
        for(j=0;j<=8;j++)  
        {  
              P1=0xff>>j;delays(30);  
        }   
        P0=P1=P2=P3=0x00;  
        delays(500)  ;  
        for(j=0;j<8;j++)  
        {   
              P1=0xff>>(7-j);delays(30);  
        }  
        for(j=0;j<8;j++)  
        {   
              P3=0xff>>(7-j);delays(30);  
        }  
        for(j=0;j<8;j++)  
        {   
              P2=0xff>>(7-j);delays(30);  
        }  
        for(j=0;j<8;j++)  
        {   
              P0=0xff<<(7-j);delays(30);  
        }  //2   
                                     P0=P2=P3=0xff ;  
                       for(i=0;i<=8;i++)  
         {   P1=0xff<<i;delays(50);  
         } delays(800);  
         for(i=0;i<8;i++)  
         {   P1=0xff>>(7-i);delays(50);  
         }  P0=P1=P2=0xff;  
              for(i=0;i<=8;i++)  
              {  P3=0xff<<i;delays(50);  
              }   delays(800);  
              for(i=0;i<8;i++)  
              {   P3=0xff>>(7-i);delays(50);  
              }P0=P1=P3=0xff;   
         for(i=0;i<=8;i++)  
         {  P2=0xff<<i;delays(50);  
                                       }   delays(800);  
         for(i=0;i<8;i++)  
                                       {   P2=0xff>>(7-i);delays(50);  
                                       } P1=P2=P3=0xff;  
              for(i=0;i<=8;i++)  
              {  P0=0xff>>i;delays(50);  
              }      delays(800);  
              for(i=0;i<8;i++)  
              {  P0=0xff<<(7-i);delays(50);  
              }   
        P2=P3=0xff;for(i=0;i<=8;i++)  
                   {  
         P0=0xff<<i;P1=0xff<<i;delays(50);  
    }delays(800);  
    for(i=0;i<8;i++)  
    {  
         P0=0xff>>(7-i);P1=0xff>>(7-i);delays(50);      
    }P0=P1=0xff;  
         for(i=0;i<=8;i++)  
         {  
             P3=0xff<<i;P2=0xff>>i;delays(50);  
         }delays(800);  
         for(i=0;i<8;i++)  
         {  
             P3=0xff>>(7-i);P2=0xff<<(7-i);delays(50);  
         }  
         for(i=0;i<3;i++)  
         {  
             P1=P3=P2=0xcc;P0=0x33;delays(500);P1=P3=P2=0x33;P0=0xcc;delays(500);  
         }  
                          P1=P3=P2=0xcc;   P0=0x33;           //首先逆時(shí)針  
                                                        for(i=0;i<120;i++)  
                                                        {      
                                                               delays(100);P0=_cror_(P0,1);P1=_crol_(P1,1);P3=_crol_(P3,1);P2=_crol_(P2,1);  
                                                        }  
                                                        delays(1500) ;  
                                                        for(i=0;i<120;i++)  
                                                        {      
                                                               delays(100); P0=_crol_(P0,1);P1=_cror_(P1,1);P3=_cror_(P3,1);P2=_cror_(P2,1);  
                                                         } delays(1000);  
    P1=P3=P2=0x0f;   P0=0xf0;           //首先逆時(shí)針  
    for(i=0;i<80;i++)  
     {      
        delays(120);P0=_cror_(P0,1);P1=_crol_(P1,1);P3=_crol_(P3,1);P2=_crol_(P2,1);  
     }  
     delays(1500) ;  
      for(i=0;i<80;i++)  
     {      
        delays(120); P0=_crol_(P0,1);P1=_cror_(P1,1);P3=_cror_(P3,1);P2=_cror_(P2,1);  
     }   
                P1=P3=P0=0x77;P2=0xee;  
                for(i=0;i<50;i++)    //四口來(lái)回轉(zhuǎn)  
                {      
                        delays(100);P0=_crol_(P0,1);P1=_crol_(P1,1);P3=_crol_(P3,1);P2=_cror_(P2,1);  
                }      
  P0=P3=0xff;P1=P2=0xfe;  
                        for(i=0;i<8;i++)  
         {      delays(30);  
                P1=_crol_(P1,1);P2=_crol_(P2,1);   
         }P1=P2=0xff;P3=0xfe;P0=0x7f;  
         for(i=0;i<8;i++)  
         {      delays(30);  
                P3=_crol_(P3,1);P0=_cror_(P0,1);  
         }P0=0xfe;P3=0x7f;a=0x7f;  b=0xfe;  
      for(j=1;j<8;j++)  
      {  c=0xff<<j;d=0xff>>j;  
         P1=P2=0xfe;  
                        for(i=0;i<=7;i++)  
         {      delays(30);  
                P1=_crol_(P1,1);P2=_crol_(P2,1);  
         }P1=P2=0xff;                 
                                                      for(i=0;i<7;i++)  
                                                      {      
                P0=a&c;P3=b&d;delays(30);  
                                                             a=_cror_(a,1);b=_crol_(b,1);                                                                  
                                                      }  
       } P0=P3=0x00;b=0xfe;  
     for(j=1;j<8;j++)  
     {  d=0xff>>j;  
           for(i=0;i<7;i++)  
           {  
              P1=b&d;P2=b&d;delays(30);b=_crol_(b,1);  
           }            
     }  
  n=2;     while(n)  
          {  
             P1=P2=P3=0x7f;P0=0xfe;  
             for(i=0;i<7;i++)  
             {   delays(100);P1=_cror_(P1,1);P2=_cror_(P2,1);P3=_cror_(P3,1);P0=_crol_(P0,1);  
             } delays(100);  
             c=0xfe;d=0x7f;a=0x7f;b=0xfe;   
            for(j=0;j<9;j++)  
            {                 
               for(i=0;i<=8;i++)  
               {   
                  P1=P2=P3=c&a;P0=b&d;delays(100);  
   a=_cror_(a,1);b=_crol_(b,1);                     
               } c=_cror_(c,1);d=_crol_(d,1); a=c;b=d;  
            }n--;  
          }  
                                     P3=P2=0xff;        //兩邊一起向下亮  
                                     for(j=0;j<=8;j++)  
                                     {  
                                           P1=0xff<<j;P0=0xff<<j;delays(40);  
                                     }  
                                     for(j=0;j<=8;j++)  
                                     {  
                                           P3=0xff<<j; P2=0xff>>j;delays(40);  
                                     }  
while(1)                                                       //一心調(diào)頻率接近的跳動(dòng)  
{  
    P0=P1=P2=P3=0x00;delays(800);  
    P0=P1=P2=P3=0xff;delays(800);  
}   
}  
回復(fù)

使用道具 舉報(bào)

20#
ID:160258 發(fā)表于 2017-1-6 14:58 | 只看該作者
仿真程序的實(shí)例中就有 你自己仔細(xì)找找
回復(fù)

使用道具 舉報(bào)

21#
ID:160452 發(fā)表于 2017-1-6 15:59 | 只看該作者
#include <reg51.h> #include<intrins.h> #define uchar unsigned char uchar j,temp; void delay(unsigned int ms) { uchar t; while(ms--) for(t=0;t<123;t++); } void main() { P1=0xff; delay(500); temp=0xfe; //有點(diǎn)怪,led接在P2.3~P2.6 for(j=0;j<4;j++) { P1=temp; delay(500); temp=_crol_(temp,1); } P1=0xff; while(1); }
回復(fù)

使用道具 舉報(bào)

22#
ID:150178 發(fā)表于 2017-2-17 07:49 來(lái)自手機(jī) | 只看該作者
1131014564 發(fā)表于 2016-12-9 20:28
#include
#include
#define uint unsigned int

謝謝啦正在學(xué)51
回復(fù)

使用道具 舉報(bào)

23#
ID:150178 發(fā)表于 2017-2-17 07:49 來(lái)自手機(jī) | 只看該作者
qi_dianzikeji 發(fā)表于 2016-12-9 21:59
#include #include #define uint unsigned int #define uchar unsigned char uchar t1,t2,s; void delayms( ...

謝謝,很有幫助
回復(fù)

使用道具 舉報(bào)

24#
ID:165180 發(fā)表于 2017-2-17 22:00 | 只看該作者
這個(gè)很多啊,網(wǎng)上隨便收收
回復(fù)

使用道具 舉報(bào)

25#
ID:44573 發(fā)表于 2017-2-18 08:19 | 只看該作者
#include<reg52.h>
int a[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//上至下
int b[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//下至上
int c[]={0x7e,0xbd,0xdb,0xe7};//邊至中
int d[]={0xe7,0xdb,0xbd,0x7e};//中至邊
void delay(int);
void main()
{
        int i,j;
        while(1){
        for(i=1;i<4;i++)
        {
                P1=0xaa;
                delay(400);
                P1=0x55;
                delay(400);
        }
        for(j=0;j<3;j++)
         {
                        for(i=0;i<8;i++)
                        {
                                P1=a[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
                        for(i=0;i<8;i++)
                        {
                                P1=b[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=c[j];
                         delay(100);
                        // P1=0xff;
                        // delay(100);
     }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=d[j];
                         delay(100);
                         //P1=0xff;
                         //delay(100);
     }
   }
         for(i=1;i<4;i++)
         {
                 P1=0x00;
                 delay(100);
                 P1=0xff;
                 delay(100);
   }
}
}
void delay(int z)
{
        int i,j;
        for(i=100;i>0;i--)
                for(j=z;j>0;j--);
}
回復(fù)

使用道具 舉報(bào)

26#
ID:165292 發(fā)表于 2017-2-18 20:05 | 只看該作者
百度,就有啊,在這里等回復(fù)太慢了
回復(fù)

使用道具 舉報(bào)

27#
ID:155120 發(fā)表于 2017-2-19 17:00 | 只看該作者
百度一下,一大片。朋友
回復(fù)

使用道具 舉報(bào)

28#
ID:129201 發(fā)表于 2017-2-21 14:44 | 只看該作者
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
void delay1ms(uint);
void main()
{
   while(1)
{
    uchar a;
    a=0xfe;
    P0=a;
    a=_crol_(a,1);
    delay1ms(500);
  }
}
void delay1ms(uint m)
{
  uint i,j;
  for(i=0;i<m;i++)
  foe(j=0;j<110;j++);
}
   
回復(fù)

使用道具 舉報(bào)

29#
ID:165595 發(fā)表于 2017-2-21 18:01 | 只看該作者
這個(gè)網(wǎng)上一大片哦! 一般教程都是從點(diǎn)燈開始的
回復(fù)

使用道具 舉報(bào)

30#
ID:165787 發(fā)表于 2017-2-21 18:16 | 只看該作者
#include<reg52.h>
int a[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//上至下
int b[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//下至上
int c[]={0x7e,0xbd,0xdb,0xe7};//邊至中
int d[]={0xe7,0xdb,0xbd,0x7e};//中至邊
void delay(int);
void main()
{
        int i,j;
        while(1){
        for(i=1;i<4;i++)
        {
                P1=0xaa;
                delay(400);
                P1=0x55;
                delay(400);
        }
        for(j=0;j<3;j++)
         {
                        for(i=0;i<8;i++)
                        {
                                P1=a[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
                        for(i=0;i<8;i++)
                        {
                                P1=b[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=c[j];
                         delay(100);
                        // P1=0xff;
                        // delay(100);
     }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=d[j];
                         delay(100);
                         //P1=0xff;
                         //delay(100);
     }
   }
         for(i=1;i<4;i++)
         {
                 P1=0x00;
                 delay(100);
                 P1=0xff;
                 delay(100);
   }
}
}
void delay(int z)
{
        int i,j;
        for(i=100;i>0;i--)
                for(j=z;j>0;j--);
}
回復(fù)

使用道具 舉報(bào)

31#
ID:165787 發(fā)表于 2017-2-21 18:24 | 只看該作者
#include<reg52.h>
int a[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//上至下
int b[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//下至上
int c[]={0x7e,0xbd,0xdb,0xe7};//邊至中
int d[]={0xe7,0xdb,0xbd,0x7e};//中至邊
void delay(int);
void main()
{
        int i,j;
        while(1){
        for(i=1;i<4;i++)
        {
                P1=0xaa;
                delay(400);
                P1=0x55;
                delay(400);
        }
        for(j=0;j<3;j++)
         {
                        for(i=0;i<8;i++)
                        {
                                P1=a[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
                        for(i=0;i<8;i++)
                        {
                                P1=b[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=c[j];
                         delay(100);
                        // P1=0xff;
                        // delay(100);
     }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=d[j];
                         delay(100);
                         //P1=0xff;
                         //delay(100);
     }
   }
         for(i=1;i<4;i++)
         {
                 P1=0x00;
                 delay(100);
                 P1=0xff;
                 delay(100);
   }
}
}
void delay(int z)
{
        int i,j;
        for(i=100;i>0;i--)
                for(j=z;j>0;j--);
}
回復(fù)

使用道具 舉報(bào)

32#
ID:165787 發(fā)表于 2017-2-21 18:25 | 只看該作者
#include<reg52.h>
int a[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//上至下
int b[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//下至上
int c[]={0x7e,0xbd,0xdb,0xe7};//邊至中
int d[]={0xe7,0xdb,0xbd,0x7e};//中至邊
void delay(int);
void main()
{
        int i,j;
        while(1){
        for(i=1;i<4;i++)
        {
                P1=0xaa;
                delay(400);
                P1=0x55;
                delay(400);
        }
        for(j=0;j<3;j++)
         {
                        for(i=0;i<8;i++)
                        {
                                P1=a[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
                        for(i=0;i<8;i++)
                        {
                                P1=b[i];
                                delay(20);
                                //P1=0xff;
                                //delay(20);
                        }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=c[j];
                         delay(100);
                        // P1=0xff;
                        // delay(100);
     }
   }
         for(i=0;i<3;i++)
         {
                 for(j=0;j<4;j++)
                 {
                         P1=d[j];
                         delay(100);
                         //P1=0xff;
                         //delay(100);
     }
   }
         for(i=1;i<4;i++)
         {
                 P1=0x00;
                 delay(100);
                 P1=0xff;
                 delay(100);
   }
}
}
void delay(int z)
{
        int i,j;
        for(i=100;i>0;i--)
                for(j=z;j>0;j--);
}
回復(fù)

使用道具 舉報(bào)

33#
ID:110456 發(fā)表于 2017-5-5 22:51 | 只看該作者
#include <reg51.h> #include <intrins.h> #define uchar unsigned char #define uint unsigned int  void DelayMS(uint x) {          uchar i;         while(x--)         {                  for(i=120;i>0;i--);         } }  void main() {          P0 = 0xFE;         while(1)         {                  P0 = _crol_(P0,1);    // _crol_,_cror_:將char型變量循環(huán)向左(右)移動(dòng)指定位數(shù)后返回                  DelayMS(150);         } }
回復(fù)

使用道具 舉報(bào)

34#
ID:184914 發(fā)表于 2017-5-5 22:52 | 只看該作者
#include <reg52.h>   #include<intrins.h> #define uchar unsigned char #define uint unsigned int uchar b=0x01; void delay(uchar  x) {     uchar a;     while(x--)      {              for(a=0;a<120;a++);       } }  void main() {   while(1)    {         P0=b;      delay(50);       b=_crol_(b,1);      } }
回復(fù)

使用道具 舉報(bào)

35#
ID:197119 發(fā)表于 2017-5-5 22:54 | 只看該作者
#在這里快速回復(fù)##include <reg52.h>
回復(fù)

使用道具 舉報(bào)

36#
ID:196174 發(fā)表于 2017-5-6 00:01 | 只看該作者
這個(gè)在別的帖子里有文件可以直接下載
回復(fù)

使用道具 舉報(bào)

37#
ID:197179 發(fā)表于 2017-5-6 09:03 | 只看該作者
#include<reg52.h>#include<intrins.h>#define uchar unsigned char#define uint unsigned intvoid delay(uint z);main(){ uchar aa; while(1){ aa=0xfe;P1=aa;delay(100);
回復(fù)

使用道具 舉報(bào)

38#
ID:162242 發(fā)表于 2017-5-6 13:06 | 只看該作者
#include <reg52.h>
回復(fù)

使用道具 舉報(bào)

39#
ID:162242 發(fā)表于 2017-5-6 13:09 | 只看該作者
#include <reg52.h>11
回復(fù)

使用道具 舉報(bào)

40#
ID:153108 發(fā)表于 2017-5-6 13:54 | 只看該作者
網(wǎng)上好多的
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 毛片一级片 | 国产精品永久免费视频 | 欧美日在线 | 天堂资源 | 精品国产1区2区3区 在线国产视频 | 黑人巨大精品欧美一区二区免费 | 国产高清在线精品一区二区三区 | 国产线视频精品免费观看视频 | 国产精品嫩草影院精东 | 亚洲三级国产 | 亚洲综合首页 | 欧美视频一区二区三区 | 亚洲国产精品91 | 久久高清免费视频 | 日本免费一区二区三区四区 | 视频三区 | 午夜伊人 | 久久久www成人免费无遮挡大片 | caoporn国产精品免费公开 | 午夜精品久久久久久久久久久久久 | 精品一区二区在线观看 | 秋霞影院一区二区 | 91视频大全| 99久久久国产精品 | 国产精品精品视频 | 国产成人影院 | 色狠狠一区| 欧美日韩视频在线 | 天堂资源| 精品久草| 欧美电影免费观看 | 久久久久久久亚洲精品 | 亚洲成人精品 | 一级a性色生活片久久毛片波多野 | 欧美极品在线观看 | 日本免费在线看 | 1级毛片 | 日韩免费一区 | 亚洲黄色国产 | 91伊人 | 91精品国产91久久久久久吃药 |