Hi Ron,
I did what as what said, and it actually transmit data from HMI to PLC, but the problem is very slow response!
I did bit manipulation and update Data (which connect to PLC) every 500ms.
Here is my code:
Code:
public partial class Transceiver
{
private static Timer timer = null;
static Transceiver()
{
timer = new Timer();
timer.Tick += new EventHandler(TimeOut);
timer.Interval = 500;
}
public static void Stop()
{
try
{
timer.Enabled = false;
}
catch(Exception) {}
}
public static void Start()
{
try
{
timer.Enabled = true;
}
catch(Exception) {}
}
private static void TimeOut(Object myObject, EventArgs myEventArgs)
{
//DATA tag is connect to PLC
Globals.Tags.DATA.Value = Globals.Tags.temp.Value;
// this is just for timer inspection
Globals.Tags.timer.Value++;
}
}