原创 点阵圆柱的移动proteus程序

2009-5-14 09:33 2746 5 5 分类: MCU/ 嵌入式

https://static.assets-stash.eet-china.com/album/old-resources/2009/5/14/9746a327-10f3-432f-b5e3-36447863aea9.rar#include <reg51.h>


unsigned char code taba[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code tabb[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};


void delay(void)
{
  unsigned char i,j;


  for(i=10;i>0;i--)
  for(j=248;j>0;j--);
}


void delay1(void)
{
  unsigned char i,j,k;


  for(k=10;k>0;k--)
  for(i=20;i>0;i--)
  for(j=248;j>0;j--);


}
void zuoyou ()
{
  unsigned char i,j;
 for (j=0;j<3;j++)              
       
     for (i=0;i<8;i++)
          {
              P1=tabb;
              P0=0x00;
              delay1();
          }
       
}
void youzuo ()
{
   unsigned char i,j;
 for (j=0;j<3;j++)               
     { 
       for(i=0;i<8;i++)
            {
              P1=tabb[7-i];
              P0=0x00;
              delay1();
            }
        }
}
void sxia ()
{
       unsigned char i,j;
 for (j=0;j<3;j++)               
        {
          for(i=0;i<8;i++)
            {
              P1=0xff;
              P0=taba[7-i];
              delay1();
            }
        }
}
void xshang ()
{
  unsigned char i,j;
  for (j=0;j<3;j++)              
        {
          for(i=0;i<8;i++)
            {
              P1=0xff;
              P0=taba;
              delay1();
            }
        }


    }


void main( )
{
  while( 1)
    {
      zuoyou ();
 youzuo ();
 sxia ();
 xshang ();
    
     }


}

文章评论0条评论)

登录后参与讨论
我要评论
0
5
关闭 站长推荐上一条 /2 下一条