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;
    unsigned char LedChar[]={
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0x99,0x00,0x00,0x00,0x81,0xC3,0xE7,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
    };

    void main()
    {
        EA=1;
      ADDR3=0;
      ENLED=0;
      TMOD=0x01;
      TH0=0xFc;
      TL0=0x67;
      ET0=1;
      TR0=1;

      while(1);

    }
    void InterruptTime() interrupt 1
    {
      static unsigned char i=0;
     static unsigned int cnt=0;
     static unsigned int index=0;
     static unsigned int tm=0;
         TH0=0xFc;
      TL0=0x67;
     
      P0=0xFF;

      switch(i)
      {
         case 0:ADDR2=0;ADDR1=0;ADDR0=0;i++;P0=LedChar[0];break;
        case 1:ADDR2=0;ADDR1=0;ADDR0=1;i++;P0=LedChar[1+index];break;
        case 2:ADDR2=0;ADDR1=1;ADDR0=0;i++;P0=LedChar[2+index];break;
        case 3:ADDR2=0;ADDR1=1;ADDR0=1;i++;P0=LedChar[3+index];break;
        case 4:ADDR2=1;ADDR1=0;ADDR0=0;i++;P0=LedChar[4+index];break;
        case 5:ADDR2=1;ADDR1=0;ADDR0=1;i++;P0=LedChar[5+index];break;
        case 6:ADDR2=1;ADDR1=1;ADDR0=0;i++;P0=LedChar[6+index];break;
        case 7:ADDR2=1;ADDR1=1;ADDR0=1;i=0;P0=LedChar[7+index];break;
      }
      cnt++;

      if(cnt>=250)
      {
         cnt=0;
      index++;
      if(index>=16)
      {
         index=0;

      }
      }
    }

  • 相关阅读:
    web监听器
    闭包
    函数表达式
    android 反向暴力取私有参数 (转载)
    html/weui slider
    自定义取值范围的EditText(记录)
    Android 基于OpenGL ES2.0 的CircleProgressBar
    Android 二维码扫描
    android 反编译网址记录
    Android Opengl ES & Jni 使用
  • 原文地址:https://www.cnblogs.com/wangjinshan/p/7455120.html
Copyright © 2011-2022 走看看