Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
9ddcbb99fa
5 files changed
+101
-26
No files matched your search
@@ -233,8 +233,7 @@ namespace DyeingComputer.ViewModel
|
||||
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
|
||||
}
|
||||
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
||||
{
|
||||
Name_err = "";
|
||||
{
|
||||
if (!LINK_OK) Modbus_link();
|
||||
|
||||
if (string.IsNullOrEmpty(Name_err.ToString()) && ((Selet_dtm("1010") < 10) || (Selet_dtm("1010") > 160)))
|
||||
@@ -988,6 +987,7 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
LogGing.LogGingDATA("800_SerialPort_Not");
|
||||
LogGing.LogGingDATA(e.Message);
|
||||
Name_err = "800_SerialPort_Not";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,24 +1007,29 @@ namespace DyeingComputer.ViewModel
|
||||
readonly byte slaveId = 1;
|
||||
private async void Modbus_link()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
if (Name_err.ToString() != "800_SerialPort_Not")
|
||||
{
|
||||
LINK_RUN++;
|
||||
try
|
||||
await Task.Run(() =>
|
||||
{
|
||||
master.WriteMultipleCoils(slaveId, 00000, DQ); //写入线圈
|
||||
master.WriteMultipleRegisters(slaveId, 07000, DW); //写入寄存器
|
||||
DO = master.ReadCoils(slaveId, 01000, DO_L); //读取线圈
|
||||
RW = master.ReadHoldingRegisters(slaveId, 06000, RW_L); //读取寄存器
|
||||
LINK_OK = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LINK_OK = false;
|
||||
LINK_ERR++;
|
||||
Name_err = "PLC" + Properties.Resources.Connectionlost + "(" + ex.Message + ")";
|
||||
}
|
||||
});
|
||||
LINK_RUN++;
|
||||
try
|
||||
{
|
||||
master.WriteMultipleCoils(slaveId, 00000, DQ); //写入线圈
|
||||
master.WriteMultipleRegisters(slaveId, 07000, DW); //写入寄存器
|
||||
DO = master.ReadCoils(slaveId, 01000, DO_L); //读取线圈
|
||||
RW = master.ReadHoldingRegisters(slaveId, 06000, RW_L); //读取寄存器
|
||||
LINK_OK = true;
|
||||
Name_err = "";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LINK_OK = false;
|
||||
LINK_ERR++;
|
||||
Name_err = "PLC" + Properties.Resources.Connectionlost + "(" + ex.Message + ")";
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
void LOG_view()//细节页面
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user