光立方吧 关注:6,699贴子:24,763
  • 5回复贴,共1

4*4*4光立方,出问题了 请大神看看

取消只看楼主收藏回复

首先,我的光立方是层共阴,束共阳的结构
如图是一个侧面的结构


1楼2014-08-17 21:37回复
    上程序测试的时候, 我一层一层的接线看灯,下面三层都正常亮着,接上第四层,这时,第一个侧面最后一束(一楼图中的D13、D14、D15、D16)灭了。。。


    2楼2014-08-17 21:41
    回复
      四层全连上,程序给全亮,给0xff,只能显示成0xef


      3楼2014-08-17 21:42
      回复
        大神快来啊


        4楼2014-08-17 22:06
        回复
          自顶


          来自手机贴吧5楼2014-08-18 08:18
          回复

            /*******每层共阴*****/
            #include<reg52.h>
            # include <intrins.h>
            #define ss unsigned char
            #define mm unsigned int
            sbit gong_yin1=P2^0 ; //最顶层
            sbit gong_yin2=P2^2 ; //第三层
            sbit gong_yin3=P2^1 ; //第二层
            sbit gong_yin4=P2^4 ; //最底层2.3口蜂鸣器
            ss di00[]={1,0,1,0,1,0,1,0,1};
            ss di01[]={0,1,1,1,0,1,1,1};
            ss di10[]={0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1};
            ss gong_yang10[]={0x0f,0x8e,0x8c,0x88,0x80,0x00,0x00,0x00,0x10,0x11,0x60,0x40,0x00,0x20};
            ss gong_yang30[]={0x00,0x00,0x08,0x88,0xc8,0xe8,0xf0,0x71,0x31,0x11,0x00,0x04,0x06,0x02};
            ss gong_yang11[]={0x01,0x33,0x77,0xff,0xe0,0x00,0x00, 0x08,0xcc,0xee,0xff,0x70,0x00,0x00};
            ss gong_yang31[]={0x00,0x00,0x07,0xff,0xee,0xcc,0x80, 0x00,0x00,0x0e,0xff,0x77,0x33,0x10};
            ss gong_yang12[]={0x48,0x44,0x22,0x21,0x30,0xc0};
            ss gong_yang32[]={0x12,0x22,0x44,0x84,0x0c,0x03};
            ss gong_yang13[]={0x0f,0xf0,0x00,0x00};
            ss gong_yang33[]={0x00,0x00,0x0f,0xf0};
            /*********延时*********/
            void delay(mm time)
            {mm i,j;
            for(i=0;i<time;i++)
            for(j=0;j<250;j++);
            }
            /*********第一种:全亮并带有闪烁*********/
            void display1()
            { ss a,i;
            i=10;
            while(i--)
            for(a=0;a<2;a++)
            {
            gong_yin1=di00[a];
            gong_yin2=di00[a+2];
            gong_yin3=di00[a+4];
            gong_yin4=di00[a+6];
            P1=0xff;
            P3=0xff;
            delay(350);
            }
            }
            main()
            {
            while(1)
            {
            display1();
            }
            }


            9楼2014-08-22 10:15
            回复