static void Main(string[] args) { ADAM6KReqService ADAM6KReqService = new ADAM6KReqService(); DeviceModel Device = new DeviceModel() { IPAddress = "172.18.3.241" }; if (ADAM6KReqService.OpenCOM(Device.IPAddress)) { Device = ADAM6KReqService.GetDevice(); string typ = ADAM6KReqService.GetDevRng(Device.ModuleType); Console.WriteLine("Get range code is [%s].", typ); IOModel IOitem = new IOModel() { Id = 40, Ch = 0, cRng = 251, }; ADAM6KReqService.UpdateIOConfig(IOitem); Console.WriteLine("Change range code is [%s].", IOitem.cRng); } Console.ReadKey(); }
static void Main(string[] args) { ADAM6KReqService ADAM6KReqService = new ADAM6KReqService(); DeviceModel Device = new DeviceModel() { IPAddress = "172.18.3.241" }; if (ADAM6KReqService.OpenCOM(Device.IPAddress)) { Device = ADAM6KReqService.GetDevice(); IOModel IOitem = new IOModel() { Id = 0, Ch = 0, cEn = 0, }; ADAM6KReqService.UpdateIOConfig(IOitem); Console.WriteLine("Change channel mask is disable."); } Console.ReadKey(); }
static void Main(string[] args) { ADAM6KReqService ADAM6KReqService = new ADAM6KReqService(); DeviceModel Device = new DeviceModel() { IPAddress = "172.18.3.188" }; if (ADAM6KReqService.OpenCOM(Device.IPAddress)) { Device = ADAM6KReqService.GetDevice(); List <IOModel> IO_Data = (List <IOModel>)ADAM6KReqService.GetListOfIOItems(""); // IOModel IOitem = new IOModel();//need to get twice. foreach (var item in (List <IOModel>)ADAM6KReqService.GetListOfIOItems("")) { if (item.Id == 0 && item.Ch == 0) { IOitem = new IOModel() { Id = item.Id, Ch = item.Ch, Tag = item.Tag, Val = item.Val, En = item.En, //DI Md = item.Md, Inv = item.Inv, Fltr = item.Fltr, FtLo = item.FtLo, FtHi = item.FtHi, FqT = item.FqT, FqP = item.FqP, CntIV = item.CntIV, CntKp = item.CntKp, OvLch = item.OvLch, }; } } IOitem.Md = 2; IOitem.Inv = 0; IOitem.Fltr = 1; // IOModel IOitem = new IOModel() //{ // Id = 0, // Ch = 0, // cEn = 0, //}; ADAM6KReqService.UpdateIOConfig(IOitem); Console.WriteLine("Change channel mask is disable."); } Console.ReadKey(); }
private void ADAM_AutoIO_LtoH_Latch_Load(object sender, EventArgs e) { #region -- Item -- chkbox = new CheckBox[num_item]; setTxtbox = new TextBox[num_item]; getTxtbox = new TextBox[num_item]; apaxTxtbox = new TextBox[num_item]; modbTxtbox = new TextBox[num_item]; resLabel = new Label[num_item]; chkbox.Initialize(); setTxtbox.Initialize(); getTxtbox.Initialize(); apaxTxtbox.Initialize(); modbTxtbox.Initialize(); resLabel.Initialize(); var text_style = new FontFamily("Times New Roman"); for (int i = 0; i < num_item; i++) { chkbox[i] = new CheckBox(); chkbox[i].Name = "StpChkIdx" + (i + 1).ToString(); chkbox[i].Location = new Point(10, 83 + 35 * (i + 1)); chkbox[i].Text = ""; chkbox[i].Parent = this; chkbox[i].CheckedChanged += new EventHandler(SubChkBoxChanged); setTxtbox[i] = new TextBox(); setTxtbox[i].Size = new Size(60, 25); setTxtbox[i].Location = new Point(174, 83 + 35 * (i + 1)); setTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); setTxtbox[i].TextAlign = HorizontalAlignment.Center; setTxtbox[i].Parent = this; getTxtbox[i] = new TextBox(); getTxtbox[i].Size = new Size(60, 25); getTxtbox[i].Location = new Point(240, 83 + 35 * (i + 1)); getTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); getTxtbox[i].TextAlign = HorizontalAlignment.Center; getTxtbox[i].Parent = this; apaxTxtbox[i] = new TextBox(); apaxTxtbox[i].Size = new Size(60, 25); apaxTxtbox[i].Location = new Point(306, 83 + 35 * (i + 1)); apaxTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); apaxTxtbox[i].TextAlign = HorizontalAlignment.Center; apaxTxtbox[i].Parent = this; modbTxtbox[i] = new TextBox(); modbTxtbox[i].Size = new Size(60, 25); modbTxtbox[i].Location = new Point(372, 83 + 35 * (i + 1)); modbTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); modbTxtbox[i].TextAlign = HorizontalAlignment.Center; modbTxtbox[i].Parent = this; resLabel[i] = new Label(); resLabel[i].Size = new Size(60, 25); resLabel[i].Location = new Point(438, 83 + 35 * (i + 1)); resLabel[i].Font = new Font(text_style, 12, FontStyle.Regular); resLabel[i].Text = ""; resLabel[i].Parent = this; } for (int i = 0; i < num_item; i++) { chkbox[i].Checked = true; } // dataGridView1.ColumnHeadersVisible = true; DataGridViewTextBoxColumn newCol = new DataGridViewTextBoxColumn(); // add a column to the grid newCol.HeaderText = "Time"; newCol.Name = "clmTs"; newCol.Visible = true; newCol.Width = 20; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Ch"; newCol.Name = "clmStp"; newCol.Visible = true; newCol.Width = 30; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Step"; newCol.Name = "clmIns"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Result"; newCol.Name = "clmDes"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Rowdata"; newCol.Name = "clmRes"; newCol.Visible = true; newCol.Width = 200; dataGridView1.Columns.Add(newCol); for (int i = 0; i < dataGridView1.Columns.Count - 1; i++) { dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } dataGridView1.Rows.Clear(); try { m_DataGridViewCtrlAddDataRow = new DataGridViewCtrlAddDataRow(DataGridViewCtrlAddNewRow); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } #endregion ADAM6KReqService = new ADAM6KReqService(); APAX5070Service = new ModbusTCPService(); ADAMmds = new ModbusTCPService(); //debug //ADAMConnection(); }