/// <summary> /// GetLineNumber /// </summary> /// <param name="actUtlType"></param> /// <returns>resLineNum</returns> static Int16 GetLineNumber(ActUtlType actUtlType) { int IRetLineNum_Write = actUtlType.SetDevice2("D512", 1); int IRetLineNum_Read = actUtlType.GetDevice2("D512", out short resLineNum); return(resLineNum); }
/// <summary> /// 「RESET」ボタンクリック(X1をON->OFF) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ResetButton_Click(object sender, EventArgs e) { //X1デバイスをON int ret = ActUtlType.SetDevice2("X1", ON); Thread.Sleep(500); //X1デバイスをOFF ret = ActUtlType.SetDevice2("X1", OFF); this.C0Text.Text = ReadC0Value(); this.Y3Text.Text = ReadY3Value(); }
/// <summary> /// 「COUNT UP」ボタンクリック(X3をON->OFF) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CountUpButton_Click(object sender, EventArgs e) { //X3デバイスをON int ret = ActUtlType.SetDevice2("X3", ON); ShowMessage(ret); if (ret != SUCCESS) { return; } Thread.Sleep(500); //X3デバイスをOFF ret = ActUtlType.SetDevice2("X3", OFF); ShowMessage(ret); if (ret != SUCCESS) { return; } this.C0Text.Text = ReadC0Value(); this.Y3Text.Text = ReadY3Value(); }
private void Form1_Load(object sender, EventArgs e) { getFileNames(); _cameraMV = new Connection(); _cameraMV.ConnectionEventCallback += _cameraMV_ConnectionEventCallback; cbbCheDoChay.Items.Add(RunMode.mode.NORMAL); cbbCheDoChay.Items.Add(RunMode.mode.CHECK); cbbCheDoChay.SelectedIndex = 0; cbbTenDL.DataSource = SQLite.Instance().LayToanBoBangDanhSachDaiLy()[1]; _dsDaiLy = SQLite.Instance().LayDaiLy(cbbTenDL.SelectedItem.ToString()); dvDSDaiLy.DataSource = SQLite.Instance().TaoBang("SELECT *FROM DanhSachDaiLy"); txtThuMucLuuAnh.Text = Properties.Settings.Default.PathLuuAnh; _stringOfToolVS = Properties.Settings.Default.StringOfToolVS; txtToolVS.Text = _stringOfToolVS; Fx1s.ActLogicalStationNumber = 1; int result = Fx1s.Open(); if (result != 0) { _statusPLC = false; lblStatusPLC.Text = "PLC chưa kết nối"; lblStatusPLC.BackColor = Color.Red; MessageBox.Show("Chưa kết nối PLC"); } else { _statusPLC = true; lblStatusPLC.Text = "PLC đã kết nối"; lblStatusPLC.BackColor = Color.Green; MessageBox.Show("Kết nối PLC thành công"); } try { short data1 = Properties.Settings.Default.TriggerDelay; Fx1s.SetDevice2("D1", data1); txtTriggerDelay.Text = data1.ToString(); short data2 = Properties.Settings.Default.RejectDelay; Fx1s.SetDevice2("D3", data2); txtRejectDelay.Text = data2.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// C0デバイスの値を書き換える /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WriteC0Button_Click(object sender, EventArgs e) { //C0デバイスを変更 short val = short.Parse(this.C0Text.Text); int ret = ActUtlType.SetDevice2("C0", val); }