⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 以前做的一个仿PLC程序
💻 C
字号:
;/****************************************Copyright (C)**************************************************
;**                               	Email:luheding@126.com
;**                                 QQ:614090042                                            
;**                          如有意见或不明可联系,但要注明来意.否则不回
;**--------------文件信息--------------------------------------------------------------------------------
;**文   件   名: Drive.c
;**创   建   人: LuHeDing
;**最后修改日期: 2010年05月08日
;**描        述: 硬件驱动程式集合
;**--------------当前版本修订------------------------------------------------------------------------------
;** 修改人: 
;** 日 期:
;** 描 述:
;**
;**------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
#include "..\Drive\PLC_PUBLIC.H"

void diy(unsigned int diy_t)
{PLC_Init();
}

uint8  ddddd=0;
uint8  M8037_BIT;
int main (void)
{BOT_BIT=0;
 PLC_Init();
 SystemInit();
 LPC_GPIO0->FIODIR |= RUN_LED|ERR_LED;
 LPC_GPIO0->FIOSET=RUN_LED|ERR_LED;
 diy(0xFFFF);
 PLC_AllInit();
 ddddd=50;
 while (1) 
  {MyD_IO_Refresh();//IO刷新
   PLC_PROG_RUN(); //PLC程序执行
   if(PLC_1MS_BIT)
    {PLC_1MS_BIT=0;
	 UARTSend2();
	 PLC_X_Filter();
	 ddddd--;
	 if(ddddd==0)
	 	 {ddddd=50;	PLC_UART_CMD();//串口数据处理
	      if(D8065){LPC_GPIO0->FIOCLR=ERR_LED;}
		  else{LPC_GPIO0->FIOSET=ERR_LED;}
		  if((LPC_GPIO1->FIOPIN&RUN_KEY)!=RUN_KEY&&PLC_BIT_TEST(M8037)==0)
	 	    {if((LPC_GPIO0->FIOPIN&RUN_LED)) 
		 	   {if(D8065==0)LPC_GPIO0->FIOCLR =RUN_LED;
			    if(PLC_RUN_BIT==0){PLC_RUN_BIT=1;}	//开始运行测试
			   }
	         else {LPC_GPIO0->FIOSET =RUN_LED;}
			}	 
	     else {LPC_GPIO0->FIOSET =RUN_LED;
	 	       PLC_IO_BREAK();
		       if(PLC_RUN_BIT!=0)
		         {PLC_BIT_OFF(M8000);PLC_RUN_BIT=0;M8037_BIT=0;
			      if(PLC_BIT_TEST(M8037)){M8037_BIT=0xaa;}
			      PLC_RESET_RAM();
			      if(M8037_BIT==0xaa){PLC_BIT_ON(M8037);M8037_BIT=0;}}
		      }
	     }
}//END if(PLC_1MS_BIT)	 */
}//END while 
}//END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -