void TimerWatchdog_Tick(object sender, EventArgs e) { PLCBool plcBool = new PLCBool(Statics.Watchdog); plcBool.Start(); plcBool.Stop(); }
private void App_OnExit(object sender, ExitEventArgs e) { PLCBool plcVariable1 = new PLCBool(Statics.Machine1Motor); plcVariable1.Stop(); PLCBool plcVariable2 = new PLCBool(Statics.Machine2Motor); plcVariable2.Stop(); }
private static void resetPLCCounter() { PLCBool counterReset = new PLCBool(ResetCounter); counterReset.Value = true; Thread.Sleep(200); counterReset.Value = false; Thread.Sleep(200); PLCInt plcInt1 = new PLCInt(CounterDB); int plcCounter = plcInt1.Value; barcodeCounter = plcCounter; }
private static void runWatchDog() { Thread thread = new Thread(() => { while (true) { PLCBool plcBool = new PLCBool(Statics.Watchdog); plcBool.Start(); Thread.Sleep(10); plcBool.Stop(); Thread.Sleep(500); } }); thread.Priority = ThreadPriority.Highest; thread.Start(); }
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Log log = new Log(DateTime.Now, e.ExceptionObject.ToString()); Log.Write(log); try { PLCBool plcVariable1 = new PLCBool(Statics.Machine1Motor); plcVariable1.Stop(); PLCBool plcVariable2 = new PLCBool(Statics.Machine2Motor); plcVariable2.Stop(); } catch (Exception) { } }
private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { Log log = new Log(DateTime.Now, e.Exception.ToString()); Log.Write(log); try { PLCBool plcVariable1 = new PLCBool(Statics.Machine1Motor); plcVariable1.Stop(); PLCBool plcVariable2 = new PLCBool(Statics.Machine2Motor); plcVariable2.Stop(); } catch (Exception) { } e.Handled = true; }
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { LoadConfig(); StartNIDistributedSystemManager(); // Reset Counters PLCBool counter1Reset = new PLCBool(Statics.Counter1Reset); counter1Reset.Value = true; PLCBool counter2Reset = new PLCBool(Statics.Counter2Reset); counter2Reset.Value = true; counter1Reset.Value = false; counter2Reset.Value = false; // formReadBarcode.Barcode1Read += formReadBarcode_Barcode1Read; formReadBarcode.Barcode2Read += formReadBarcode_Barcode2Read; //formReadBarcode.Visible = false; formReadBarcode.Show(); formReadBarcode.Hide(); BindGridViewBarcodeReader1(); BindGridViewBarcodeReader2(); Timer1.Interval = new TimeSpan(0, 0, 0, 0, 1000); Timer2.Interval = new TimeSpan(0, 0, 0, 0, 2); TimerWatchdog.Interval = new TimeSpan(0, 0, 0, 0, 500); Timer1.IsEnabled = true; Timer2.IsEnabled = true; TimerWatchdog.IsEnabled = true; Timer1.Tick += Timer1Tick; Timer2.Tick += Timer2Tick; TimerWatchdog.Tick += TimerWatchdog_Tick; }
public void StopMachine2Motor() { PLCBool plcVariable = new PLCBool(Lib.Statics.Machine2Motor); plcVariable.Value = true; }
public void StartMachine2Motor() { PLCBool plcVariable = new PLCBool(Lib.Statics.Machine2Motor); plcVariable.Value = false; }
public void Stop02() { BarcodeScanner.Lib.PLCBool plcVariable = new PLCBool(BarcodeScanner.Lib.Statics.Machine2Motor); plcVariable.Stop(); }
public void Start01() { BarcodeScanner.Lib.PLCBool plcVariable = new PLCBool(BarcodeScanner.Lib.Statics.Machine1Motor); plcVariable.Start(); }
private void ButtonStopMachine2_OnClick(object sender, RoutedEventArgs e) { BarcodeScanner.Lib.PLCBool plcVariable = new PLCBool(BarcodeScanner.Lib.Statics.Machine2Motor); plcVariable.Start(); }
public static void stopMotor() { PLCBool plcVariable = new PLCBool(MachineMotor); plcVariable.Value = true; }
public static void startMotor() { PLCBool plcVariable = new PLCBool(MachineMotor); plcVariable.Value = false; }