const int BaffleManualMoveStatus_Down = 6;//D-1 public static bool Baffle_Lift_IsMinDown() { bool result = false; string send = RegDR + PLC_Tcp_CP.GetAdrD_1000(BaffleManualMoveStatus_Down) + "0001"; string response; if (SendPLC(send, "出药挡板状态", out response)) { int i = response.IndexOf(":"); if (i >= 0) { if (PLC_Tcp_CP.Get16Int(response.Substring(i + 7, 4)) == 1) { result = true; } } } if (!result) { send = RegDR + PLC_Tcp_CP.GetAdrD_1000(BaffleAutoMoveStatus_Down) + "0001"; if (SendPLC(send, "出药挡板状态", out response)) { int i = response.IndexOf(":"); if (i >= 0) { if (PLC_Tcp_CP.Get16Int(response.Substring(i + 7, 4)) == 2) { result = true; } } } } return(result); }
const int Speed_Manual_Baffle_Lift = 504; //D-2 public static void SetSpeeds() { string speed = ""; string send = ""; string response; //速度 speed = PLC_Tcp_CP.Get16String(int.Parse(Config.Mac_C.Speed_Auto_Baffle_Belt), 8); send = RegDMW + PLC_Tcp_CP.GetAdrD_1000(Speed_Auto_Baffle_Belt) + "0002" + "04" + speed.Substring(4, 4) + speed.Substring(0, 4); if (!SendPLC(send, "传送带挡板自动速度", out response)) { return; } speed = PLC_Tcp_CP.Get16String(int.Parse(Config.Mac_C.Speed_Manual_Baffle_Belt), 8); send = RegDMW + PLC_Tcp_CP.GetAdrD_1000(Speed_Manual_Baffle_Belt) + "0002" + "04" + speed.Substring(4, 4) + speed.Substring(0, 4); if (!SendPLC(send, "传送带挡板手动速度", out response)) { return; } speed = PLC_Tcp_CP.Get16String(int.Parse(Config.Mac_C.Speed_Auto_Baffle_Lift), 8); send = RegDMW + PLC_Tcp_CP.GetAdrD_1000(Speed_Auto_Baffle_Lift) + "0002" + "04" + speed.Substring(4, 4) + speed.Substring(0, 4); if (!SendPLC(send, "出药斗挡板自动速度", out response)) { return; } speed = PLC_Tcp_CP.Get16String(int.Parse(Config.Mac_C.Speed_Manual_Baffle_Lift), 8); send = RegDMW + PLC_Tcp_CP.GetAdrD_1000(Speed_Manual_Baffle_Lift) + "0002" + "04" + speed.Substring(4, 4) + speed.Substring(0, 4); if (!SendPLC(send, "出药斗挡板手动速度", out response)) { return; } }
const int BaffleAutoMovePulse_Down_Lift_On = 13; //M-1 public static void BaffleAutoMoveByPulse_Down_Lift(int pulse) { string s = PLC_Tcp_CP.Get16String(pulse, 8); string send = RegDMW + PLC_Tcp_CP.GetAdrD_1000(BaffleAutoMovePulse_Down_Lift) + "0002" + "04" + s.Substring(4, 4) + s.Substring(0, 4); string response; if (SendPLC(send, "挡板自动运行脉冲", out response)) { send = RegMSW + PLC_Tcp_CP.GetAdrM(BaffleAutoMovePulse_Down_Lift_On) + "FF00"; SendPLC(send, "挡板自动运行使能", out response); } }
const int BafflePulse_Lift = 1336;//D-2 //读取脉冲 public static int ReadBafflePulse_Lift() { int result = 0; string send = RegDR + PLC_Tcp_CP.GetAdrD_1000(BafflePulse_Lift) + "0002"; string response; if (SendPLC(send, "挡板脉冲", out response)) { int i = response.IndexOf(":"); if (i >= 0) { string s = response.Substring(i + 7, 8); result = PLC_Tcp_CP.Get16Int(s.Substring(4, 4) + s.Substring(0, 4)); } } return(result); }
const int BaffleOrigin_State = 2;//D-1 //挡板原点复位是否完成 public static bool BaffleOriginResetIsOK() { bool result = false; string send = RegDR + PLC_Tcp_CP.GetAdrD_1000(BaffleOrigin_State) + "0001"; string response; if (SendPLC(send, "挡板原点复位完成状态", out response)) { int i = response.IndexOf(":"); if (i >= 0) { if (PLC_Tcp_CP.Get16Int(response.Substring(i + 7, 4)) == 1) { result = true; } } } return(result); }
const int BaffleAutoMoveStatus_Up = 9;//D-1 public static bool BaffleAutoMoveIsOK_Up() { bool result = false; string send = RegDR + PLC_Tcp_CP.GetAdrD_1000(BaffleAutoMoveStatus_Up) + "0001"; string response; if (SendPLC(send, "挡板自动运行状态", out response)) { int i = response.IndexOf(":"); if (i >= 0) { if (PLC_Tcp_CP.Get16Int(response.Substring(i + 7, 4)) == 1) { result = true; } } } return(result); }