|
|
@ -22,6 +22,7 @@ using System.IO.Ports; |
|
|
|
using OpenTK.Graphics.ES11; |
|
|
|
using DyeingComputer.Properties; |
|
|
|
using Microsoft.Win32; |
|
|
|
using static DyeingComputer.Windows.ViewStep; |
|
|
|
|
|
|
|
|
|
|
|
namespace DyeingComputer.ViewModel |
|
|
@ -109,7 +110,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
|
|
|
|
DispatcherTimer timer5s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
|
|
|
{ |
|
|
|
Interval = TimeSpan.FromSeconds(3)//秒
|
|
|
|
Interval = TimeSpan.FromSeconds(5)//秒
|
|
|
|
}; |
|
|
|
timer5s.Tick += Tick_Event_5S; |
|
|
|
timer5s.Start(); |
|
|
@ -125,7 +126,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
|
|
|
|
public static object Name_err; |
|
|
|
public static object WorkNumder; |
|
|
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件
|
|
|
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
|
|
|
{ |
|
|
|
Sys_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); |
|
|
|
Work_Temp = Selet_dtm("1010") + " ℃"; |
|
|
@ -135,16 +136,49 @@ namespace DyeingComputer.ViewModel |
|
|
|
if (LINK_OK) Modbus_link(); |
|
|
|
IO_data(); |
|
|
|
} |
|
|
|
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件
|
|
|
|
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
|
|
|
{ |
|
|
|
if (!LINK_OK) Modbus_link(); |
|
|
|
if (Name_err != null) Status_Str = Name_err.ToString(); |
|
|
|
STEP_RUN(); |
|
|
|
} |
|
|
|
void DisTimer_100MS(object sender, EventArgs e)//Tick_Event周期执行事件
|
|
|
|
void DisTimer_100MS(object sender, EventArgs e)//Tick_Event周期执行事件100MS
|
|
|
|
{ |
|
|
|
// if (LINK_OK) Modbus_link();
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string STEP_ID = "0"; |
|
|
|
double STEP_P1 = 0; |
|
|
|
double STEP_P2 = 0; |
|
|
|
double STEP_P3 = 0; |
|
|
|
double STEP_P4 = 0; |
|
|
|
double STEP_P5 = 0; |
|
|
|
|
|
|
|
void STEP_START(object sender, AddressUpdateEventArgs e) |
|
|
|
{ |
|
|
|
|
|
|
|
if (e.StepID == "001") |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void STEP_RUN() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static SerialPort port = new SerialPort();//创建串口
|
|
|
|
static ModbusFactory factory = new ModbusFactory(); |
|
|
|
// Create Modbus Master
|
|
|
|