本文作者:qiaoqingyi

水线编程(plc流水线编程)

qiaoqingyi 01-20 120

  /*********************** 数组控制流水灯--配套51单片机开发板********************/

  #include AT89X51.H

  unsigned char code table[]={0xfe,0xfd,0xfb,0xf7,

  0xef,0xdf,0xbf,0x7f,

  0xfe,0xfd,0xfb,0xf7,

  0xef,0xdf,0xbf,0x7f,

  0x7f,0xbf,0xdf,0xef,

  0xf7,0xfb,0xfd,0xfe,

  0x7f,0xbf,0xdf,0xef,

  0xf7,0xfb,0xfd,0xfe,

  0x00,0xff,0x00,0xff,

  0x01};

  unsigned char i;

  void delay(void)

  {

  unsigned char m,n,s;

  for(m=20;m0;m--)

  for(n=20;n0;n--)

  for(s=248;s0;s--);

  }

  void main(void)

  {

  while(1)

  {

  if(table[i]!=0x01)

  {

  P0=table[i];

  i++;

  delay();

  }

  else

  {

  i=0;

  }

  }

  }

水线编程(plc流水线编程)

  原文链接:https://www.eeworld.com.cn/mcu/article_2016102730923.html

阅读
分享