/// <summary> /// GetSeatNumber /// </summary> /// <param name="seatNumber"></param> /// <param name="actUtlType"></param> /// <returns>resSeatNum</returns> static Int16 GetSeatNumber(int seatNumber, ActUtlType actUtlType) { Dictionary <int, string> dict = new Dictionary <int, string>(); dict.Add(1, "D513"); int IRetLineNum_Write = actUtlType.SetDevice(dict[seatNumber], seatNumber); int IRetLineNum_Read = actUtlType.GetDevice2(dict[seatNumber], out short resSeatNum); return(resSeatNum); }
private void btnTest001_Click(object sender, EventArgs e) { //Task.Delay(100); //Console.WriteLine("Nhan nut X5!"); //wfKheho wftemp = new wfKheho(ref plcFX3G, ref COMSylvac); //wftemp.stringDoneKheho += InputKhehoToExcel; //wftemp.ShowDialog(); //wftemp.Dispose(); // Test if (!currentPLCBit["X11"]) { plcFX3G.SetDevice("X11", 1); } else { plcFX3G.SetDevice("X11", 0); } }
/// <summary> /// Xử lý khi Camera lỗi /// Báo lỗi ra PLC /// Ghi Log /// </summary> /// <param name="x"></param> private void CameraFailProcess(int x) { log.Error("Camera Error Event Process"); plcKefico.SetDevice("M3020", 1); mainCamera.Stop(); Console.WriteLine("Camera Fail When Capture Frame : " + x.ToString()); }
public bool SetDevice(string device, int lData) { try { int RCode = actUtlType.SetDevice(device, lData); if (0 == RCode) { message = "PLC地址" + device + "设置成功,结果:" + lData; return(true); } else { message = "PLC地址" + device + "读取成功,结果:" + lData; return(false); } } catch (Exception ex) { _isOpen = false; return(false); } }
private void Button2_Click(object sender, EventArgs e) { plc.SetDevice(textBox1.Text, Convert.ToInt16(textBox2.Text)); }
internal int SetValue(string adr, bool value) { Err = plc.SetDevice(adr, value == true ? 1 : 0); return(Err); }
private void but_Write_Click(object sender, EventArgs e) { if (plcStat == true) { plc.SetDevice(TxtAdd_W.Text, Convert.ToInt16(TxtVal_W.Text)); } }