using EasyModbus; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; using System.Reflection.Emit; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using System.IO.Ports; using System.Drawing.Text; using System.Diagnostics; using ModbusClientVal.Properties; namespace ModbusClientVal { public partial class SID : Form { // private Rectangle buttonOrginalRectangle; // private Rectangle orginalFormSize; ModbusClient modbus = new ModbusClient(); //RTU DEĞİŞKENLERİ bool baglantidurumu; int[] baundrates = { 9600, 19200, 38400, 57600, 115200 }; String[] portlistesi; String[] paritys={"None","Even","Odd"}; //TCP DEĞİŞKENLERİ bool[] state; bool[] result; int[] MB_Result = new int[16]; int[] MB_State; // bool durum; int ButonMesafe; int secim ; int baglanti; int[] analog = new int[32]; int[] MB_Analog = new int[16]; int cihazserino; int[] kartmodel=new int[1]; string klavuz; string weblink; string youtube; public SID() { InitializeComponent(); // durum = false; } private void Form1_Load(object sender, EventArgs e) { portlistele(); //lblAdress.Location = new Point(900, 43); // 1532,43 RTUBOX.Size = new System.Drawing.Size(IPBOX.Size.Width, IPBOX.Size.Height); RTUBOX.Location = new System.Drawing.Point(IPBOX.Location.X, IPBOX.Location.Y); //ComPort.Location = new System.Drawing.Point(txtIPAddress.Location.X, txtIPAddress.Location.Y); //ComportBaglan.Location = new System.Drawing.Point(btnConnect.Location.X, btnConnect.Location.Y); //label7.Location = new System.Drawing.Point(btnConnect.Location.X-25, btnConnect.Location.Y+50); //txtSID.Location = new System.Drawing.Point(label7.Location.X + label7.Size.Width, label7.Location.Y); //BaundRate.Location = new System.Drawing.Point(txtPort.Location.X, txtPort.Location.Y); //ParityComboBox.Location= new System.Drawing.Point(txtPort.Location.X, txtPort.Location.Y+50); Control.CheckForIllegalCrossThreadCalls = false; IPBOX.Visible = false; RTUBOX.Visible=false; groupBox2.Visible=false; // groupBox4.Visible=false; LbCHL0.Visible = false; LbCHL1.Visible = false; LbCHL2.Visible = false; TxtCH0.Visible = false; TxtCH1.Visible = false; TxtCH2.Visible = false; lbl_mac.Visible = false; Button[] InputButtons = { IO1, IO2, IO3, IO4, IO5, IO6, IO7, IO8 ,MI9, MI10, MI11, MI12, MI13, MI14, MI15, MI16}; Button[] OutputButtons = { IO9, IO10, IO11, IO12, IO13, IO14, IO15, IO16, MO9, MO10, MO11, MO12, MO13, MO14, MO15, MO16 }; for (int i = 0; i < 8; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; InputButtons[i].Enabled = false; } modbus.UnitIdentifier = 3; for (int j = 0; j < baundrates.Length; j++) { BaundRate.Items.Add(baundrates[j]); } BaundRate.SelectedItem = baundrates[2]; for (int k = 0; k < paritys.Length; k++) { ParityComboBox.Items.Add(paritys[k]); } ParityComboBox.SelectedItem = paritys[0]; comboBox1.Items.Add("RM-4220-ET-RL"); comboBox1.Items.Add("RM-880-ET"); comboBox1.Items.Add("RM-881-ET"); comboBox1.Items.Add("RM-882-ET"); comboBox1.Items.Add("RM-883-ET"); comboBox1.Items.Add("RM-982-ET-RL"); //comboBox1.Items.Add("RM-884-ET");//16 MODBUS comboBox1.Items.Add("RM-780-MB"); comboBox1.Items.Add("RM-781-MB"); comboBox1.Items.Add("RM-782-MB"); //comboBox1.Items.Add("RM-783-MB");//4LÜ MODBUS //comboBox1.Items.Add("RM-784-MB");//16LI MODBUS txtIPAddress.Text = "192.168.1.44"; txtPort.Text = "502"; if (modbus.Connected) { connectPicturre.Image = ModbusClientVal.Properties.Resources.connect_ok; } else connectPicturre.Image = ModbusClientVal.Properties.Resources.connect_not_ok; //groupBox3.Visible=false; IP1.Text = "192"; IP2.Text = "168"; IP3.Text = "1"; IP4.Text = "44"; G1.Text = "192"; G2.Text = "168"; G3.Text = "1"; G4.Text = "1"; S1.Text = "255"; S2.Text = "255"; S3.Text = "255"; S4.Text = "0"; button2.FlatStyle = FlatStyle.Flat; button2.FlatAppearance.BorderSize = 0; button4.FlatStyle = FlatStyle.Flat; button4.FlatAppearance.BorderSize = 0; button5.FlatStyle = FlatStyle.Flat; button5.FlatAppearance.BorderSize = 0; //progressBar1.Visible = false; // LblIPFind.Visible = false; } //---------------------------TCP KODLARI private void btnConnect_Click(object sender, EventArgs e) { modbus.IPAddress = Convert.ToString(txtIPAddress.Text); modbus.Port = Convert.ToInt32(txtPort.Text); try { modbus.Connect(); txtStatus.Text= ""; // txtIPAddress.Enabled = false; button1.Enabled = true; kartmodel = modbus.ReadHoldingRegisters(49, 1); label14.Text = kartmodel+""; if (kartmodel[0] == cihazserino) { } else { txtStatus.Visible = true; txtStatus.Text = ("LÜTFEN DOĞRU CİHAZ SEÇİNİZ\nKart Modeliniz: RM-" + kartmodel[0] + "-ET\nSizin Seçiminiz: RM-" + cihazserino + "-ET"); comboBox1.Enabled = true; // txtIPAddress.Enabled = true; button1.Enabled = false; modbus.Disconnect(); } } catch (Exception ex) { txtStatus.Text = (ex.Message); } if (modbus.Connected == true) { connectPicturre.Image = ModbusClientVal.Properties.Resources.connect_ok; comboBox1.Enabled = false; lbl_mac.Visible = true; lbl_mac.Text ="MAC:" + GetMacAddress(txtIPAddress.Text); // mac adres oku txtIPAddress.Enabled = false; button1.Enabled = true; } else { connectPicturre.Image = ModbusClientVal.Properties.Resources.connect_not_ok; comboBox1.Enabled = true; txtIPAddress.Enabled = true; button1.Enabled = false; lbl_mac.Visible= false; } } public string GetMacAddress(string ipAddress) // MAC ADRES OKUMA { string macAddress = string.Empty; System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); pProcess.StartInfo.FileName = "arp"; pProcess.StartInfo.Arguments = "-a " + ipAddress; pProcess.StartInfo.UseShellExecute = false; pProcess.StartInfo.RedirectStandardOutput = true; pProcess.StartInfo.CreateNoWindow = true; pProcess.Start(); string strOutput = pProcess.StandardOutput.ReadToEnd(); string[] substrings = strOutput.Split('-'); if (substrings.Length >= 8) { macAddress = substrings[3].Substring(Math.Max(0, substrings[3].Length - 2)) + "-" + substrings[4] + "-" + substrings[5] + "-" + substrings[6] + "-" + substrings[7] + "-" + substrings[8].Substring(0, 2); return macAddress; } else { return "not found"; } } private void btnDisconnect_Click(object sender, EventArgs e) { modbus.Disconnect(); connectPicturre.Image = ModbusClientVal.Properties.Resources.connect_not_ok; comboBox1.Enabled = true; txtIPAddress.Enabled = true; button1.Enabled = false; lbl_mac.Visible = false; } private void timer1_Tick(object sender, EventArgs e) { try { if (modbus.Connected == true) { label14.Text = ""; if (baglanti == 1) { result = modbus.ReadCoils(16, 16); state = modbus.ReadDiscreteInputs(32, 16); analog = modbus.ReadHoldingRegisters(0, 32); connectPicturre.Image = ModbusClientVal.Properties.Resources.connect_ok; txtIPAddress.Enabled = false; button1.Enabled = true; } if (baglanti == 2) { MB_Result = modbus.ReadHoldingRegisters(16, 16); //Writes Coil #5 MB_State = modbus.ReadHoldingRegisters(32, 16); //Writes Coil #5 MB_Analog = modbus.ReadHoldingRegisters(0, 16); } } else { connectPicturre.Image = ModbusClientVal.Properties.Resources.connect_not_ok; } } catch (Exception ex) { txtStatus.Text = (ex.Message); } } private void timer2_Tick(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { TxtCH0.Text = analog[0].ToString(); // Analog CH0 TxtCH1.Text = analog[1].ToString(); // Analog CH1 TxtCH2.Text = analog[2].ToString(); // Analog CH2 cnt_0.Text = analog[24].ToString(); //CNT0 - 40025 cnt_1.Text = analog[25].ToString(); cnt_2.Text = analog[26].ToString(); cnt_3.Text = analog[27].ToString(); cnt_4.Text = analog[28].ToString(); cnt_5.Text = analog[29].ToString(); cnt_6.Text = analog[30].ToString(); cnt_7.Text = analog[31].ToString(); // CNT7 - 40032 } if ( baglanti == 2) { TxtCH0.Text = MB_Analog[0].ToString(); TxtCH1.Text = MB_Analog[1].ToString(); TxtCH2.Text = MB_Analog[2].ToString(); cnt_0.Text = MB_Result[8].ToString(); // IN0 CNT - 40025 cnt_1.Text = MB_Result[9].ToString(); cnt_2.Text = MB_Result[10].ToString(); cnt_3.Text = MB_Result[11].ToString(); cnt_4.Text = MB_Result[12].ToString(); cnt_5.Text = MB_Result[13].ToString(); cnt_6.Text = MB_Result[14].ToString(); cnt_7.Text = MB_Result[15].ToString(); // IN7 CNT - 40032 } if (result != null) { if ( baglanti == 1) { if (result[0] == true) { IO9.BackColor = Color.Green; } else if (result[0] == false) { IO9.BackColor = Color.Red; } if (result[1] == true) { IO10.BackColor = Color.Green; } else if (result[1] == false) { IO10.BackColor = Color.Red; } if (result[2] == true) { IO11.BackColor = Color.Green; } else if (result[2] == false) { IO11.BackColor = Color.Red; } if (result[3] == true) { IO12.BackColor = Color.Green; } else if (result[3] == false) { IO12.BackColor = Color.Red; } if (result[4] == true) { IO13.BackColor = Color.Green; } else if (result[4] == false) { IO13.BackColor = Color.Red; } if (result[5] == true) { IO14.BackColor = Color.Green; } else if (result[5] == false) { IO14.BackColor = Color.Red; } if (result[6] == true) { IO15.BackColor = Color.Green; } else if (result[6] == false) { IO15.BackColor = Color.Red; } if (result[7] == true) { IO16.BackColor = Color.Green; } else if (result[7] == false) { IO16.BackColor = Color.Red; } if (result[8] == true) { MO9.BackColor = Color.Green; } else if (result[8] == false) { MO9.BackColor = Color.Red; } if (result[9] == true) { MO10.BackColor = Color.Green; } else if (result[9] == false) { MO10.BackColor = Color.Red; } if (result[10] == true) { MO11.BackColor = Color.Green; } else if (result[10] == false) { MO11.BackColor = Color.Red; } if (result[11] == true) { MO12.BackColor = Color.Green; } else if (result[11] == false) { MO12.BackColor = Color.Red; } if (result[12] == true) { MO13.BackColor = Color.Green; } else if (result[12] == false) { MO13.BackColor = Color.Red; } if (result[13] == true) { MO14.BackColor = Color.Green; } else if (result[13] == false) { MO14.BackColor = Color.Red; } if (result[14] == true) { MO15.BackColor = Color.Green; } else if (result[14] == false) { MO15.BackColor = Color.Red; } if (result[15] == true) { MO16.BackColor = Color.Green; } else if (result[15] == false) { MO16.BackColor = Color.Red; } } } if (state != null) { if ( baglanti == 1) { if (state[0] == true) { IO1.BackColor = Color.Green; } else IO1.BackColor = Color.Red; if (state[1] == true) { IO2.BackColor = Color.Green; } else IO2.BackColor = Color.Red; if (state[2] == true) { IO3.BackColor = Color.Green; } else IO3.BackColor = Color.Red; if (state[3] == true) { IO4.BackColor = Color.Green; } else IO4.BackColor = Color.Red; if (state[4] == true) { IO5.BackColor = Color.Green; } else IO5.BackColor = Color.Red; if (state[5] == true) { IO6.BackColor = Color.Green; } else IO6.BackColor = Color.Red; if (state[6] == true) { IO7.BackColor = Color.Green; } else IO7.BackColor = Color.Red; if (state[7] == true) { IO8.BackColor = Color.Green; } else IO8.BackColor = Color.Red; if (state[8] == true) { MI9.BackColor = Color.Green; } else MI9.BackColor = Color.Red; if (state[9] == true) { MI10.BackColor = Color.Green; } else MI10.BackColor = Color.Red; if (state[10] == true) { MI11.BackColor = Color.Green; } else MI11.BackColor = Color.Red; if (state[11] == true) { MI12.BackColor = Color.Green; } else MI12.BackColor = Color.Red; if (state[12] == true) { MI13.BackColor = Color.Green; } else MI13.BackColor = Color.Red; if (state[13] == true) { MI14.BackColor = Color.Green; } else MI14.BackColor = Color.Red; if (state[14] == true) { MI15.BackColor = Color.Green; } else MI15.BackColor = Color.Red; if (state[15] == true) { MI16.BackColor = Color.Green; } else MI16.BackColor = Color.Red; } } if (MB_Result != null) { if ( baglanti == 2) { if (MB_Result[0] == 1) { IO9.BackColor = Color.Green; } else if (MB_Result[0] == 0) { IO9.BackColor = Color.Red; } if (MB_Result[1] == 1) { IO10.BackColor = Color.Green; } else if (MB_Result[1] == 0) { IO10.BackColor = Color.Red; } if (MB_Result[2] == 1) { IO11.BackColor = Color.Green; } else if (MB_Result[2] == 0) { IO11.BackColor = Color.Red; } if (MB_Result[3] == 1) { IO12.BackColor = Color.Green; } else if (MB_Result[3] == 0) { IO12.BackColor = Color.Red; } if (MB_Result[4] == 1) { IO13.BackColor = Color.Green; } else if (MB_Result[4] == 0) { IO13.BackColor = Color.Red; } if (MB_Result[5] == 1) { IO14.BackColor = Color.Green; } else if (MB_Result[5] == 0) { IO14.BackColor = Color.Red; } if (MB_Result[6] == 1) { IO15.BackColor = Color.Green; } else if (MB_Result[6] == 0) { IO15.BackColor = Color.Red; } if (MB_Result[7] == 1) { IO16.BackColor = Color.Green; } else if (MB_Result[7] == 0) { IO16.BackColor = Color.Red; } if (MB_Result[8] == 1) { MO9.BackColor = Color.Green; } else if (MB_Result[8] == 0) { MO9.BackColor = Color.Red; } if (MB_Result[9] == 1) { MO10.BackColor = Color.Green; } else if (MB_Result[9] == 0) { MO10.BackColor = Color.Red; } if (MB_Result[10] == 1) { MO11.BackColor = Color.Green; } else if (MB_Result[10] == 0) { MO11.BackColor = Color.Red; } if (MB_Result[11] == 1) { MO12.BackColor = Color.Green; } else if (MB_Result[11] == 0) { MO12.BackColor = Color.Red; } if (MB_Result[12] == 1) { MO13.BackColor = Color.Green; } else if (MB_Result[12] == 0) { MO13.BackColor = Color.Red; } if (MB_Result[13] == 1) { MO14.BackColor = Color.Green; } else if (MB_Result[13] == 0) { MO14.BackColor = Color.Red; } if (MB_Result[14] == 1) { MO15.BackColor = Color.Green; } else if (MB_Result[14] == 0) { MO15.BackColor = Color.Red; } if (MB_Result[15] == 1) { MO16.BackColor = Color.Green; } else if (MB_Result[15] == 0) { MO16.BackColor = Color.Red; } } } if (MB_State != null) { if (baglanti == 2) { if (MB_State[0] == 1) { IO1.BackColor = Color.Green; } else IO1.BackColor = Color.Red; if (MB_State[1] == 1) { IO2.BackColor = Color.Green; } else IO2.BackColor = Color.Red; if (MB_State[2] == 1) { IO3.BackColor = Color.Green; } else IO3.BackColor = Color.Red; if (MB_State[3] == 1) { IO4.BackColor = Color.Green; } else IO4.BackColor = Color.Red; if (MB_State[4] == 1) { IO5.BackColor = Color.Green; } else IO5.BackColor = Color.Red; if (MB_State[5] == 1) { IO6.BackColor = Color.Green; } else IO6.BackColor = Color.Red; if (MB_State[6] == 1) { IO7.BackColor = Color.Green; } else IO7.BackColor = Color.Red; if (MB_State[7] == 1) { IO8.BackColor = Color.Green; } else IO8.BackColor = Color.Red; if (MB_State[8] == 1) { MI9.BackColor = Color.Green; } else MI9.BackColor = Color.Red; if (MB_State[9] == 1) { MI10.BackColor = Color.Green; } else MI10.BackColor = Color.Red; if (MB_State[10] == 1) { MI11.BackColor = Color.Green; } else MI11.BackColor = Color.Red; if (MB_State[11] == 1) { MI12.BackColor = Color.Green; } else MI12.BackColor = Color.Red; if (MB_State[12] == 1) { MI13.BackColor = Color.Green; } else MI13.BackColor = Color.Red; if (MB_State[13] == 1) { MI14.BackColor = Color.Green; } else MI14.BackColor = Color.Red; if (MB_State[14] == 1) { MI15.BackColor = Color.Green; } else MI15.BackColor = Color.Red; if (MB_State[15] == 1) { MI16.BackColor = Color.Green; } else MI16.BackColor = Color.Red; } } } } catch (Exception EX) { txtStatus.Text = EX.Message; } } private void button1_Click_1(object sender, EventArgs e) { try { if (modbus.Connected == true) { modbus.WriteSingleRegister(4, int.Parse(S1.Text)); modbus.WriteSingleRegister(5, int.Parse(S2.Text)); modbus.WriteSingleRegister(6, int.Parse(S3.Text)); modbus.WriteSingleRegister(7, int.Parse(S4.Text)); modbus.WriteSingleRegister(8, int.Parse(IP1.Text)); modbus.WriteSingleRegister(9, int.Parse(IP2.Text)); modbus.WriteSingleRegister(10, int.Parse(IP3.Text)); modbus.WriteSingleRegister(11, int.Parse(IP4.Text)); modbus.WriteSingleRegister(12, int.Parse(G1.Text)); modbus.WriteSingleRegister(13, int.Parse(G2.Text)); modbus.WriteSingleRegister(14, int.Parse(G3.Text)); modbus.WriteSingleRegister(15, int.Parse(G4.Text)); modbus.WriteSingleCoil(48, true); modbus.Disconnect(); MessageBox.Show(" IP ADRESİ DEĞİŞTİRİLDİ:\n" + IP1.Text + "." + IP2.Text + "." + IP3.Text + "." + IP4.Text); txtIPAddress.Text = IP1.Text + "." + IP2.Text + "." + IP3.Text + "." + IP4.Text; } else txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } public static List GetConnectedIPAddresses() { var ipAddresses = new List(); // NetworkInterface sınıfını kullanarak tüm ağ arayüzlerini alın var networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); // Her ağ arayüzü için IP adreslerini kontrol edin foreach (var networkInterface in networkInterfaces) { var ipProperties = networkInterface.GetIPProperties(); // Bağlı olan IP adreslerini alın var connectedIPAddresses = ipProperties.UnicastAddresses .Where(address => address.IsDnsEligible && address.IsTransient == false) .Select(address => address.Address.ToString()) .ToList(); // Bağlı olan IP adreslerini sonuç listesine ekle ipAddresses.AddRange(connectedIPAddresses); } return ipAddresses; } private void StartCounting() { //LblIPFind.Visible = true; // progressBar1.Visible = true; string message = ""; string localIPAddress = ""; IPHostEntry host; host = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in host.AddressList) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { localIPAddress = ip.ToString(); break; } } Ping ping = new Ping(); string subnet = localIPAddress.Substring(0, localIPAddress.LastIndexOf('.')); for (int i = 1; i < 255; i++) { string target = subnet + "." + i.ToString(); PingReply pingReply = ping.Send(target, 30); if (pingReply.Status == IPStatus.Success) { // message += (target + " is connected."); // progressBar1.Value++; } } MessageBox.Show(message); this.Enabled = true; this.Cursor = Cursors.Default; //LblIPFind.Visible = false; // progressBar1.Visible = false; } private void button2_Click(object sender, EventArgs e) { var thread = new Thread(StartCounting); thread.IsBackground = true; thread.Start(); this.Cursor = Cursors.WaitCursor; this.Enabled = false; Application.DoEvents(); } //---------------------------RTU KODLARI---------------------------- void portlistele() { ComPort.Items.Clear(); portlistesi = SerialPort.GetPortNames(); foreach (String portadi in portlistesi) { ComPort.Items.Add(portadi); if (portlistesi[0] != null) { ComPort.SelectedItem = portlistesi[0]; } } } private void ComportBaglan_Click(object sender, EventArgs e) { try { if (baglantidurumu == false) { //MessageBox.Show(ComPort.GetItemText(ComPort.SelectedItem) + ""); // serialPort1.PortName = ComPort.GetItemText(ComPort.SelectedItem); //modbus = new ModbusClient(); modbus.SerialPort = ComPort.GetItemText(ComPort.SelectedItem); //serialPort1.BaudRate = Convert.ToInt32(BaundRate.SelectedItem);// modbus.Baudrate = Convert.ToInt32(BaundRate.SelectedItem); modbus.UnitIdentifier = byte.Parse(txtSID.Text); if ((string)ParityComboBox.SelectedItem == "None") { modbus.Parity = System.IO.Ports.Parity.None; } else if ((string)ParityComboBox.SelectedItem == "Even") { modbus.Parity = System.IO.Ports.Parity.Even; } else if ((string)ParityComboBox.SelectedItem == "Odd") { modbus.Parity = System.IO.Ports.Parity.Odd; } //serialPort1.Open(); modbus.Connect(); groupBox2.Enabled = true; ComPort.Enabled = false; BaundRate.Enabled = false; ParityComboBox.Enabled = false; baglantidurumu = true; ComportBaglan.Text = "BAĞLANTIYI KES"; BtSID.Enabled = true; kartmodel = modbus.ReadHoldingRegisters(49, 1); label2.Text = kartmodel[0]+""; if (kartmodel[0] == 780 || kartmodel[0] == 781 || kartmodel[0] == 782) { if (kartmodel[0] == cihazserino) { comboBox1.Enabled = false; } else { txtStatus.Visible = true; txtStatus.Text = ("LÜTFEN DOĞRU CİHAZ SEÇİNİZ\nKart Modeliniz: RM-" + kartmodel[0] + "-MB\nSizin Seçiminiz: RM-" + cihazserino + "-MB"); comboBox1.Enabled = true; modbus.Disconnect(); } } } else { modbus.Disconnect(); ComPort.Enabled = true; BaundRate.Enabled = true; ParityComboBox.Enabled = true; baglantidurumu = false; ComportBaglan.Text = "BAĞLAN"; BtSID.Enabled = false; comboBox1.Enabled = true; } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text= ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void TRUtimer1_Tick(object sender, EventArgs e) { if (modbus.Connected == true) { connectPicture2.Image = ModbusClientVal.Properties.Resources.connect_ok; } else { connectPicture2.Image = ModbusClientVal.Properties.Resources.connect_not_ok; } } //RTU-TCP ORTAK DENETİMLER private void IO9_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(16, !result[0]); } if (baglanti == 2) { if (MB_Result[0] == 1) { modbus.WriteSingleRegister(16, 0); } if (MB_Result[0] == 0) { modbus.WriteSingleRegister(16, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO10_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(17, !result[1]); } if (baglanti == 2) { if (MB_Result[1] == 1) { modbus.WriteSingleRegister(17, 0); } if (MB_Result[1] == 0) { modbus.WriteSingleRegister(17, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO11_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(18, !result[2]); } if (baglanti == 2) { if (MB_Result[2] == 1) { modbus.WriteSingleRegister(18, 0); } if (MB_Result[2] == 0) { modbus.WriteSingleRegister(18, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO12_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(19, !result[3]); } if (baglanti == 2) { if (MB_Result[3] == 1) { modbus.WriteSingleRegister(19, 0); } if (MB_Result[3] == 0) { modbus.WriteSingleRegister(19, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO13_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(20, !result[4]); } if (baglanti == 2) { if (MB_Result[4] == 1) { modbus.WriteSingleRegister(20, 0); } if (MB_Result[4] == 0) { modbus.WriteSingleRegister(20, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO14_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(21, !result[5]); } if (baglanti == 2) { if (MB_Result[5] == 1) { modbus.WriteSingleRegister(21, 0); } if (MB_Result[5] == 0) { modbus.WriteSingleRegister(21, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO15_Click(object sender, EventArgs e) { try { if (modbus.Connected == true ) { if (baglanti == 1) { modbus.WriteSingleCoil(22, !result[6]); } if (baglanti == 2) { if (MB_Result[6] == 1) { modbus.WriteSingleRegister(22, 0); } if (MB_Result[6] == 0) { modbus.WriteSingleRegister(22, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO16_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(23, !result[7]); } if (baglanti == 2) { if (MB_Result[7] == 1) { modbus.WriteSingleRegister(23, 0); } if (MB_Result[7] == 0) { modbus.WriteSingleRegister(23, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { BaundRate.SelectedItem = 2; IPBOX.Visible = true; pictureBox3.Visible = true; Button[] InputButtons = { IO1, IO2, IO3, IO4, IO5, IO6, IO7, IO8,MI9,MI10,MI11,MI12,MI13,MI14,MI15,MI16 }; Button[] OutputButtons = { IO9, IO10, IO11, IO12, IO13, IO14, IO15, IO16,MO9,MO10,MO11,MO12,MO13,MO14,MO15,MO16}; ButonMesafe = 20; secim = comboBox1.SelectedIndex; TxtCH0.Text = ""; TxtCH1.Text = ""; TxtCH2.Text = ""; lblCounter.Visible = true; lblReset.Visible = true; label18.Visible = false; button5.Visible = false; for (int i = 0; i < 8; i++) { InputButtons[i].BackColor = Color.Gray; OutputButtons[i].BackColor = Color.Gray; } if ((string)comboBox1.SelectedItem == "RM-880-ET") // RM- 880-ET 8DO { RTUBOX.Visible = false; GrpSID.Visible = false; IPBOX.Visible = true; groupBox2.Visible = true; //groupBox4.Visible = true; cihazserino = 880; baglanti = 1; lblCounter.Visible = false; lblReset.Visible = false; LbCHL0.Visible = false; LbCHL1.Visible = false; LbCHL2.Visible = false; TxtCH0.Visible = false; TxtCH1.Visible = false; TxtCH2.Visible = false; cnt_0.Visible = false; cnt_1.Visible = false; cnt_2.Visible = false; cnt_3.Visible = false; cnt_4.Visible = false; cnt_5.Visible = false; cnt_6.Visible = false; cnt_7.Visible = false; RES0.Visible = false; RES1.Visible = false; RES2.Visible = false; RES3.Visible = false; RES4.Visible = false; RES5.Visible = false; RES6.Visible = false; RES7.Visible = false; CNT_Label_0.Visible = false; CNT_Label_1.Visible = false; CNT_Label_2.Visible = false; CNT_Label_3.Visible = false; CNT_Label_4.Visible = false; CNT_Label_5.Visible = false; CNT_Label_6.Visible = false; CNT_Label_7.Visible = false; pictureBox3.Image = ModbusClientVal.Properties.Resources.ethernet; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM880ET.pdf"; label17.Visible = false; button4.Visible = false; //weblink = ""; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_880_ET_fw; for (int i = 0; i < 8; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20,20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 8; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 8; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = "OUT0---- 00016----40017" + // "\nOUT1---- 00017----40018" + // "\nOUT2---- 00018----40019" + // "\nOUT3---- 00019----40020" + // "\nOUT4---- 00020----40021" + // "\nOUT5---- 00021----40022" + // "\nOUT6---- 00022----40023" + // "\nOUT7---- 00023----40024"; } if ((string)comboBox1.SelectedItem == "RM-881-ET") { RTUBOX.Visible = false; GrpSID.Visible = false; IPBOX.Visible = true; groupBox2.Visible = true; //groupBox4.Visible = true; cihazserino = 881; baglanti = 1; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = false; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = false; cnt_0.Visible = true; cnt_1.Visible = true; cnt_2.Visible = true; cnt_3.Visible = true; cnt_4.Visible = true; cnt_5.Visible = true; cnt_6.Visible = true; cnt_7.Visible = true; RES0.Visible = true; RES1.Visible = true; RES2.Visible = true; RES3.Visible = true; RES4.Visible = true; RES5.Visible = true; RES6.Visible = true; RES7.Visible = true; CNT_Label_0.Visible = true; CNT_Label_1.Visible = true; CNT_Label_2.Visible = true; CNT_Label_3.Visible = true; CNT_Label_4.Visible = true; CNT_Label_5.Visible = true; CNT_Label_6.Visible = true; CNT_Label_7.Visible = true; pictureBox3.Image = ModbusClientVal.Properties.Resources.ethernet; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM881ET.pdf"; label17.Visible = false; button4.Visible = false; //weblink = ""; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_881_ET_fw; // RM_881_ET 8 input for (int i = 0; i < 8; i++) { InputButtons[i].Visible = true; OutputButtons[i].Visible = false; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 8; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 8; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = "IN0----10033----30033" + // "\nIN1---- 10034----30034" + // "\nIN2---- 10035----30035" + // "\nIN3---- 10036----30036" + // "\nIN4---- 10037----30037" + // "\nIN5---- 10038----30038" + // "\nIN6---- 10039----30039" + // "\nIN7---- 10040----30040"; } if ((string)comboBox1.SelectedItem == "RM-882-ET") // select RM-882-ET { RTUBOX.Visible = false; GrpSID.Visible = false; IPBOX.Visible = true; groupBox2.Visible = true; // groupBox4.Visible = true; cihazserino = 882; baglanti = 1; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = false; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = false; cnt_0.Visible = true; cnt_1.Visible = true; cnt_2.Visible = true; cnt_3.Visible = true; cnt_4.Visible = true; cnt_5.Visible = true; cnt_6.Visible = true; cnt_7.Visible = true; RES0.Visible = true; RES1.Visible = true; RES2.Visible = true; RES3.Visible = true; RES4.Visible = true; RES5.Visible = true; RES6.Visible = true; RES7.Visible = true; CNT_Label_0.Visible = true; CNT_Label_1.Visible = true; CNT_Label_2.Visible = true; CNT_Label_3.Visible = true; CNT_Label_4.Visible = true; CNT_Label_5.Visible = true; CNT_Label_6.Visible = true; CNT_Label_7.Visible = true; pictureBox3.Image = ModbusClientVal.Properties.Resources.ethernet; label15.Visible = true; button2.Visible = true; klavuz = "VALDUINO_RM882ET.pdf"; label17.Visible = true; button4.Visible = true; weblink = "https://www.valerm.com.tr/valduino-rm-882-et-modbus-tcp-io-modul/"; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_882_ET_fw; for (int i = 0; i < 8; i++) { InputButtons[i].Visible = true; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 8; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 8; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = "OUT0-- - 00016----40017" + // "\nOUT1---- 00017----40018" + // "\nOUT2---- 00018----40019" + // "\nOUT3---- 00019----40020" + // "\nOUT4---- 00020----40021" + // "\nOUT5---- 00021----40022" + // "\nOUT6---- 00022----40023" + // "\nOUT7---- 00023----40024" + //"\nIN0----10033----30033" + //"\nIN1---- 10034----30034" + //"\nIN2---- 10035----30035" + //"\nIN3---- 10036----30036" + //"\nIN4---- 10037----30037" + // "\nIN5---- 10038----30038" + //"\nIN6---- 10039----30039" + //"\nIN7---- 10040----30040" + // "\nCH0--40001" + //"\nCH1--40002"; } if ((string)comboBox1.SelectedItem == "RM-4220-ET-RL") { RTUBOX.Visible = false; GrpSID.Visible = false; IPBOX.Visible = true; groupBox2.Visible = true; // groupBox4.Visible = true; cihazserino = 4220; baglanti = 1; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = false; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = false; cnt_0.Visible = true; cnt_1.Visible = true; cnt_2.Visible = true; cnt_3.Visible = true; cnt_4.Visible = false; cnt_5.Visible = false; cnt_6.Visible = false; cnt_7.Visible = false; RES0.Visible = true; RES1.Visible = true; RES2.Visible = true; RES3.Visible = true; RES4.Visible = false; RES5.Visible = false; RES6.Visible = false; RES7.Visible = false; CNT_Label_0.Visible = true; CNT_Label_1.Visible = true; CNT_Label_2.Visible = true; CNT_Label_3.Visible = true; CNT_Label_4.Visible = false; CNT_Label_5.Visible = false; CNT_Label_6.Visible = false; CNT_Label_7.Visible = false; pictureBox3.Image = ModbusClientVal.Properties.Resources.ethernet; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM4220-ET-RL.pdf"; label17.Visible = false; button4.Visible = false; weblink = "https://www.valerm.com.tr/rm-4220-et-rl/"; label18.Visible = false; button5.Visible = false; youtube = "https://www.youtube.com/watch?v=LlHAKZEZJl8"; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_442_ET_RL; // --------------------------------- for (int i = 0; i < 4; i++) { InputButtons[i].Visible = true; // inputs visible InputButtons[i].Size = new Size(20, 20); } for (int i = 0; i < 2; i++) { OutputButtons[i].Visible = true; //outputs visible OutputButtons[i].Size = new Size(20, 20); } for (int i = 4; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(200, 250); OutputButtons[0].Location = new Point(330, 250); for (int i = 1; i < 4; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + 25, InputButtons[i - 1].Location.Y); } for (int i = 1; i < 2; i++) { OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + 25, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = "OUT0---- 00016----40017" + // "\nOUT1---- 00017----40018" + // "\nOUT2---- 00018----40019" + // "\nOUT3---- 00019----40020" + // "\nIN0----10033----30033" + // "\nIN1---- 10034----30034" + // "\nIN2---- 10035----30035" + // "\nIN3---- 10036----30036"; } // if ((string)comboBox1.SelectedItem == "RM-883-ET") { RTUBOX.Visible = false; GrpSID.Visible = false; IPBOX.Visible = true; groupBox2.Visible = true; // groupBox4.Visible = true; cihazserino = 883; baglanti = 1; LbCHL0.Visible = false; LbCHL1.Visible = false; LbCHL2.Visible = false; TxtCH0.Visible = false; TxtCH1.Visible = false; TxtCH2.Visible = false; cnt_0.Visible = true; cnt_1.Visible = true; cnt_2.Visible = true; cnt_3.Visible = true; cnt_4.Visible = false; cnt_5.Visible = false; cnt_6.Visible = false; cnt_7.Visible = false; RES0.Visible = true; RES1.Visible = true; RES2.Visible = true; RES3.Visible = true; RES4.Visible = false; RES5.Visible = false; RES6.Visible = false; RES7.Visible = false; CNT_Label_0.Visible = true; CNT_Label_1.Visible = true; CNT_Label_2.Visible = true; CNT_Label_3.Visible = true; CNT_Label_4.Visible = false; CNT_Label_5.Visible = false; CNT_Label_6.Visible = false; CNT_Label_7.Visible = false; pictureBox3.Image = ModbusClientVal.Properties.Resources.ethernet; label15.Visible = true; button2.Visible = true; klavuz = "VALDUINO_RM883ET.pdf"; label17.Visible = true; button4.Visible = true; weblink = "https://www.valerm.com.tr/rm-883-et/"; label18.Visible = true; button5.Visible = true; youtube = "https://www.youtube.com/watch?v=LlHAKZEZJl8"; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_883_ET_fw; for (int i = 0; i < 4; i++) { InputButtons[i].Visible = true; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 4; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 4; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = "OUT0---- 00016----40017" + // "\nOUT1---- 00017----40018" + // "\nOUT2---- 00018----40019" + // "\nOUT3---- 00019----40020" + // "\nIN0----10033----30033" + // "\nIN1---- 10034----30034" + // "\nIN2---- 10035----30035" + // "\nIN3---- 10036----30036"; } // if ((string)comboBox1.SelectedItem == "RM-780-MB") //------------ RM-780-MB------------------------------------------------------ { RTUBOX.Visible= true; GrpSID.Visible = true; IPBOX.Visible = false; groupBox2.Visible = false; // groupBox4.Visible = false; cihazserino = 780; baglanti = 2; lblCounter.Visible = false; lblReset.Visible = false; LbCHL0.Visible = false; LbCHL1.Visible = false; LbCHL2.Visible = false; TxtCH0.Visible = false; TxtCH1.Visible = false; TxtCH2.Visible = false; cnt_0.Visible = false; cnt_1.Visible = false; cnt_2.Visible = false; cnt_3.Visible = false; cnt_4.Visible = false; cnt_5.Visible = false; cnt_6.Visible = false; cnt_7.Visible = false; RES0.Visible = false; RES1.Visible = false; RES2.Visible = false; RES3.Visible = false; RES4.Visible = false; RES5.Visible = false; RES6.Visible = false; RES7.Visible = false; CNT_Label_0.Visible = false; CNT_Label_1.Visible = false; CNT_Label_2.Visible = false; CNT_Label_3.Visible = false; CNT_Label_4.Visible = false; CNT_Label_5.Visible = false; CNT_Label_6.Visible = false; CNT_Label_7.Visible = false; pictureBox3.Image = ModbusClientVal.Properties.Resources.RS485; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM780MB.pdf"; label17.Visible = false; button4.Visible = false; //weblink = ""; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_780_MB_fw; GrpSID.Location = new Point(12, 225); for (int i = 0; i < 8; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 8; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 8; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } BaundRate.SelectedItem = 2; // lblAdress.Text = ""; } if ((string)comboBox1.SelectedItem == "RM-781-MB") //-------------------------- 781 -------------------------------- { RTUBOX.Visible = true; GrpSID.Visible = true; IPBOX.Visible = false; groupBox2.Visible = false; //groupBox4.Visible = false; cihazserino = 781; baglanti = 2; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = false; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = false; cnt_0.Visible = true; cnt_1.Visible = true; cnt_2.Visible = true; cnt_3.Visible = true; cnt_4.Visible = true; cnt_5.Visible = true; cnt_6.Visible = true; cnt_7.Visible = true; RES0.Visible = true; RES1.Visible = true; RES2.Visible = true; RES3.Visible = true; RES4.Visible = true; RES5.Visible = true; RES6.Visible = true; RES7.Visible = true; CNT_Label_0.Visible = true; CNT_Label_1.Visible = true; CNT_Label_2.Visible = true; CNT_Label_3.Visible = true; CNT_Label_4.Visible = true; CNT_Label_5.Visible = true; CNT_Label_6.Visible = true; CNT_Label_7.Visible = true; pictureBox3.Image = ModbusClientVal.Properties.Resources.RS485; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM781MB.pdf"; label17.Visible = false; button4.Visible = false; //weblink = ""; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_781_MB_fw; GrpSID.Location = new Point(12, 225); for (int i = 0; i < 8; i++) { InputButtons[i].Visible = true; OutputButtons[i].Visible = false; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 8; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 8; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } BaundRate.SelectedItem = 2; //lblAdress.Text = ""; } if ((string)comboBox1.SelectedItem == "RM-782-MB") { RTUBOX.Visible = true; GrpSID.Visible = true; IPBOX.Visible = false; groupBox2.Visible = false; // groupBox4.Visible = false; cihazserino = 782; baglanti = 2; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = false; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = false; cnt_0.Visible = true; cnt_1.Visible = true; cnt_2.Visible = true; cnt_3.Visible = true; cnt_4.Visible = true; cnt_5.Visible = true; cnt_6.Visible = true; cnt_7.Visible = true; RES0.Visible = true; RES1.Visible = true; RES2.Visible = true; RES3.Visible = true; RES4.Visible = true; RES5.Visible = true; RES6.Visible = true; RES7.Visible = true; CNT_Label_0.Visible = true; CNT_Label_1.Visible = true; CNT_Label_2.Visible = true; CNT_Label_3.Visible = true; CNT_Label_4.Visible = true; CNT_Label_5.Visible = true; CNT_Label_6.Visible = true; CNT_Label_7.Visible = true; pictureBox3.Image = ModbusClientVal.Properties.Resources.RS485; label15.Visible = true; button2.Visible = true; klavuz = "VALDUINO_RM782MB.pdf"; label17.Visible = true; button4.Visible = true; weblink = "https://www.valerm.com.tr/valduino-rm-782-mb/"; label18.Visible = true; button5.Visible = true; youtube = "https://youtu.be/WlWdhtUs2lk"; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_782_MB_fw; GrpSID.Location = new Point(12, 225); for (int i = 0; i < 8; i++) { InputButtons[i].Visible = true; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 8; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 8; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = ""; } if ((string)comboBox1.SelectedItem == "RM-982-ET-RL") { RTUBOX.Visible = false; GrpSID.Visible = false; IPBOX.Visible = true; groupBox2.Visible = true; // groupBox4.Visible = true; cihazserino = 982; baglanti = 1; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = true; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = true; cnt_0.Visible = true; cnt_1.Visible = true; cnt_2.Visible = true; cnt_3.Visible = true; cnt_4.Visible = true; cnt_5.Visible = true; cnt_6.Visible = true; cnt_7.Visible = true; RES0.Visible = true; RES1.Visible = true; RES2.Visible = true; RES3.Visible = true; RES4.Visible = true; RES5.Visible = true; RES6.Visible = true; RES7.Visible = true; CNT_Label_0.Visible = true; CNT_Label_1.Visible = true; CNT_Label_2.Visible = true; CNT_Label_3.Visible = true; CNT_Label_4.Visible = true; CNT_Label_5.Visible = true; CNT_Label_6.Visible = true; CNT_Label_7.Visible = true; pictureBox3.Image = ModbusClientVal.Properties.Resources.ethernet; label15.Visible = true; button2.Visible = true; klavuz = "VALDUINO_RM882ET.pdf"; label17.Visible = true; button4.Visible = true; weblink = "https://www.valerm.com.tr/"; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_982_ET_RL; for (int i = 0; i < 8; i++) { InputButtons[i].Visible = true; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 8; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 8; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = "OUT0-- - 00016----40017" + // "\nOUT1---- 00017----40018" + // "\nOUT2---- 00018----40019" + // "\nOUT3---- 00019----40020" + // "\nOUT4---- 00020----40021" + // "\nOUT5---- 00021----40022" + // "\nOUT6---- 00022----40023" + // "\nOUT7---- 00023----40024" + //"\nIN0----10033----30033" + //"\nIN1---- 10034----30034" + //"\nIN2---- 10035----30035" + //"\nIN3---- 10036----30036" + //"\nIN4---- 10037----30037" + // "\nIN5---- 10038----30038" + //"\nIN6---- 10039----30039" + //"\nIN7---- 10040----30040" + // "\nCH0--40001" + //"\nCH1--40002"; } if ((string)comboBox1.SelectedItem == "RM-884-ET") { RTUBOX.Visible = false; GrpSID.Visible = false; IPBOX.Visible = true; groupBox2.Visible = true; //groupBox4.Visible = true; cihazserino = 884; baglanti = 1; LbCHL0.Visible = false; LbCHL1.Visible = false; LbCHL2.Visible = false; TxtCH0.Visible = false; TxtCH1.Visible = false; TxtCH2.Visible = false; pictureBox3.Image = ModbusClientVal.Properties.Resources.ethernet; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM884ET.pdf"; label17.Visible = false; button4.Visible = false; //weblink = ""; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_782_MB_fw; GrpSID.Location = new Point(12, 225); for (int i = 0; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 16; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = "" + // "OUT0---- 00016----40017" + // "\nOUT1---- 00017----40018" + // "\nOUT2---- 00018----40019" + // "\nOUT3---- 00019----40020" + // "\nOUT4---- 00020----40021" + // "\nOUT5---- 00021----40022" + // "\nOUT6---- 00022----40023" + // "\nOUT7---- 00023----40024" + // "\nOUT8---- 00024----40025" + // "\nOUT9---- 00025----40026" + // "\nOUT10---- 00026----40027" + // "\nOUT11---- 00027----40028" + // "\nOUT12---- 00028----40029" + // "\nOUT13---- 00029----40030" + // "\nOUT14---- 00030----40031" + // "\nOUT15---- 00031----40032" + // ""; } if ((string)comboBox1.SelectedItem == "RM-783-MB") { RTUBOX.Visible = true; GrpSID.Visible = true; IPBOX.Visible = false; groupBox2.Visible = false; //groupBox4.Visible = false; cihazserino = 783; baglanti = 2; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = false; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = false; pictureBox3.Image = ModbusClientVal.Properties.Resources.RS485; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM783MB.pdf"; label17.Visible = false; button4.Visible = false; //weblink = ""; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_782_MB_fw; GrpSID.Location = new Point(12, 225); for (int i = 0; i < 4; i++) { InputButtons[i].Visible = true; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } for (int i = 4; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = false; } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 16; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = ""; } if ((string)comboBox1.SelectedItem == "RM-784-MB") { RTUBOX.Visible = true; GrpSID.Visible = true; IPBOX.Visible = false; groupBox2.Visible = false; //groupBox4.Visible = false; cihazserino = 784; baglanti = 2; LbCHL0.Visible = true; LbCHL1.Visible = true; LbCHL2.Visible = false; TxtCH0.Visible = true; TxtCH1.Visible = true; TxtCH2.Visible = false; pictureBox3.Image = ModbusClientVal.Properties.Resources.RS485; label15.Visible = false; button2.Visible = false; klavuz = "VALDUINO_RM784MB.pdf"; label17.Visible = false; button4.Visible = false; //weblink = ""; pictureBox1.Image = ModbusClientVal.Properties.Resources.RM_782_MB_fw; GrpSID.Location = new Point(12, 225); for (int i = 0; i < 16; i++) { InputButtons[i].Visible = false; OutputButtons[i].Visible = true; InputButtons[i].Size = new Size(20, 20); OutputButtons[i].Size = new Size(20, 20); } InputButtons[0].Location = new Point(160, 200); OutputButtons[0].Location = new Point(245, 400); for (int i = 1; i < 16; i++) { InputButtons[i].Location = new Point(InputButtons[i - 1].Location.X + ButonMesafe, InputButtons[i - 1].Location.Y); OutputButtons[i].Location = new Point(OutputButtons[i - 1].Location.X + ButonMesafe, OutputButtons[i - 1].Location.Y); } // lblAdress.Text = ""; } } //DENEME BUTONU private void button3_Click(object sender, EventArgs e) { try { } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void groupBox3_Enter(object sender, EventArgs e) { } private void pictureBox2_Click(object sender, EventArgs e) { } private void pictureBox2_Click_1(object sender, EventArgs e) { } private void timer4_Tick(object sender, EventArgs e) { } private void BtSID_Click(object sender, EventArgs e) { try { int nSID = int.Parse(txtNewSID.Text); if(nSID > 240) { nSID = 240; txtNewSID.Text = "240"; } modbus.WriteSingleRegister(50, nSID); modbus.WriteSingleRegister(51, 1); txtSID.Text = txtNewSID.Text; modbus.Disconnect(); ComportBaglan.Text = "BAGLAN"; } catch (Exception) { } } private void MO9_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(24, !result[9]); } if (baglanti == 2) { if (MB_Result[9] == 1) { modbus.WriteSingleRegister(24, 0); } if (MB_Result[9] == 0) { modbus.WriteSingleRegister(24, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void MO10_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(25, !result[10]); } if (baglanti == 2) { if (MB_Result[10] == 1) { modbus.WriteSingleRegister(25, 0); } if (MB_Result[10] == 0) { modbus.WriteSingleRegister(25, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void MO11_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(26, !result[11]); } if (baglanti == 2) { if (MB_Result[11] == 1) { modbus.WriteSingleRegister(26, 0); } if (MB_Result[11] == 0) { modbus.WriteSingleRegister(26, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void MO12_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(27, !result[12]); } if (baglanti == 2) { if (MB_Result[12] == 1) { modbus.WriteSingleRegister(27, 0); } if (MB_Result[12] == 0) { modbus.WriteSingleRegister(27, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void MO13_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(28, !result[13]); } if (baglanti == 2) { if (MB_Result[13] == 1) { modbus.WriteSingleRegister(28, 0); } if (MB_Result[13] == 0) { modbus.WriteSingleRegister(28, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void MO14_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(29, !result[14]); } if (baglanti == 2) { if (MB_Result[14] == 1) { modbus.WriteSingleRegister(29, 0); } if (MB_Result[14] == 0) { modbus.WriteSingleRegister(29, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void MO15_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(30, !result[15]); } if (baglanti == 2) { if (MB_Result[15] == 1) { modbus.WriteSingleRegister(30, 0); } if (MB_Result[15] == 0) { modbus.WriteSingleRegister(30, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void MO16_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(31, !result[16]); } if (baglanti == 2) { if (MB_Result[16] == 1) { modbus.WriteSingleRegister(31, 0); } if (MB_Result[16] == 0) { modbus.WriteSingleRegister(31, 1); } } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void IO8_Click(object sender, EventArgs e) { } private void label10_Click(object sender, EventArgs e) { } private void IO1_Click(object sender, EventArgs e) { } private void MI9_Click(object sender, EventArgs e) { } private void RES0_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(24, true); } if (baglanti == 2) { modbus.WriteSingleRegister(40, 1); // cnt 0 } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void RES1_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(25, true); } if (baglanti == 2) { modbus.WriteSingleRegister(41, 1); // cnt 0 } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void RES2_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(26, true); } if (baglanti == 2) { modbus.WriteSingleRegister(42, 1); // cnt 0 } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void RES3_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(27, true); } if (baglanti == 2) { modbus.WriteSingleRegister(43, 1); // cnt 0 } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void RES4_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(28, true); } if (baglanti == 2) { modbus.WriteSingleRegister(44, 1); // cnt 0 } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void RES5_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(29, true); } if (baglanti == 2) { modbus.WriteSingleRegister(45, 1); // cnt 0 } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void RES6_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(30, true); } if (baglanti == 2) { modbus.WriteSingleRegister(46, 1); // cnt } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void RES7_Click(object sender, EventArgs e) { try { if (modbus.Connected == true) { if (baglanti == 1) { modbus.WriteSingleCoil(31, true); } if (baglanti == 2) { modbus.WriteSingleRegister(47, 1); // cnt 0 } } else { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } catch (Exception) { txtStatus.Visible = true; txtStatus.Text = ("Lütfen Bağlantınızı Kontrol Ediniz Veya Doğru Kartı Seçtiğinizden Emin Olun"); } } private void label8_Click(object sender, EventArgs e) { } private void txtNewSID_TextChanged(object sender, EventArgs e) { } private void label9_Click(object sender, EventArgs e) { } private void button2_Click_1(object sender, EventArgs e) { try { // string klavuz = "VALDUINO_RM882ET.pdf"; string path = Directory.GetCurrentDirectory();//Exe nin bulunduğu dizin i getirme // label6.Text = path; System.Diagnostics.Process.Start(path + "\\" + klavuz); } catch (Exception) { } } private void ComPort_SelectedIndexChanged(object sender, EventArgs e) { } private void txtIPAddress_TextChanged(object sender, EventArgs e) { } private void ComPort_Click(object sender, EventArgs e) { if (ComPort.Items.Count > 0) { } else { portlistele(); } } private void pictureBox1_Click(object sender, EventArgs e) { } private void button4_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start(weblink); } catch (Exception) { } } private void label18_Click(object sender, EventArgs e) { } private void button5_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start(youtube); } catch (Exception) { } } private void label20_Click(object sender, EventArgs e) { } private void label16_Click(object sender, EventArgs e) { } private void TxtCH0_TextChanged(object sender, EventArgs e) { } // MODBUS TURU AYARLARI } }