程序调整
public void CircleMain(
{
while(true)
{
Thread.sleep(1ea);
#region 超时管理定时器计数
if (delay10@Ms < int.MaxValue)
{
delay100Ms++;
}
#endregion
#region 数据采集及变量映射
var result = Modbusplc.ReadDiscrete("e",7);if ( !result.IsSuccess)
eSystemstatus = E system status.Error;continue;
booll] mappingResult = result .Content;bReset = mappingResult[e];bstop = mappingResult[1];bBeforePrintsensor = mappingResult[2]:bPrintsensor = mappingResult[3];bAfterPrintsensor = mappingResult[4]:bBeforesingal = mappingResult[5]:
bAftersingal = mappingResult[6];
#endregion
#region 急停按钮
if (bstop==false)
eSystemStatus = E system status.Error;
}
bool[] mappingResult = result.Content;bReset = mappingResult[e];bstop = mappingResult[1];bBeforePrintsensor = mappingResult[2];bPrintSensor = mappingResult[3];bAfterPrintSensor = mappingResult[4];bBeforesingal = mappingResult[5];bAftersingal = mappingResult[6];#endregion
#region 急停按钮if (bstop==false
#endregion
#region 急停按钮
if (bstop==false
eSystemstatus = E system status .Error;
#endregion
#region 状态机
switch (esystemStatus)
case E system status.Idle:
//开始前打印位置有产品,需要取出
if (bPrintSensor)
esystemstatus = E system status .Error;
statusMsg ="开始前打印位置有产品,需要取出后才能运行!";
else
ModbusPlc.WriteCoil(FeedProductAddress,true); //前道要板命会esystemstatus = E system status .Feed ;
break;
case E system status .Feed:
(bBeforePrintsensor)
版权所有:江苏和讯自动化设备有限公司所有 备案号:苏ICP备2022010314号-1
技术支持: 易动力网络