zoukankan      html  css  js  c++  java
  • 新型流水灯原码

    #include<reg52.h>

    //声明

    sbit ADDR0 = P1^0;

    sbit ADDR1 = P1^1;

    sbit ADDR2 = P1^2;

    sbit ADDR3 = P1^3;

    sbit ENLED = P1^4;

    void main(){

             //声明相关变量(“unsigned”—无符号)

            unsigned int i=0,j=0;

             unsigned char cot=0;

             ADDR0=0;

             ADDR1=1;

            ADDR2=1;

            ADDR3=1;

            ENLED=0;

                       while(1){           

                                 P0 =~(0x01<<cot);//”P0”即P0^0;P0^1;P0^2;....的总和

                                //for循环延时一段时间熄灭

                                for(i=0;i<30000;i++);

                                         cot++;

                                         //if判断位移的大小,大于8位就置零(回归首地址)

                                         if(cot >= 8){

                                                 cot=0;

                                         }

                       }

    }

    //51开发板为宏晶科技的“KST-51开发板

  • 相关阅读:
    ambari
    linux常用命令
    scala新版本学习(3)
    Spring中的AOP
    Spring中的Bean
    Spring的基本应用(1):依赖以及控制反转
    Scala新版本学习(2):
    python之time模块
    python之编码与解码
    爬虫之re数据提取的使用
  • 原文地址:https://www.cnblogs.com/robotes/p/7471042.html
Copyright © 2011-2022 走看看