private void UptadeCoilsValue()
        {
            bool[] CoilsValue = new bool[100];
            CoilsValue = modbus.modbusClient.ReadCoils(0, 121);

            int    column = 1, row = 1, index = 0;
            string text;


            while (true)
            {
                CoilControl Coil = new CoilControl();
                column = 1;



                for (int i = 0; i < 11; i++)
                {
                    Coil = (CoilControl)tLp_PlcMemory.GetControlFromPosition(column, row);

                    text = CoilsValue[index].ToString();

                    Coil.Text = text;
                    if (String.Compare(Coil.Text, "True") == 0)
                    {
                        Coil.BackColor = Color.DeepSkyBlue;
                    }
                    else if (String.Compare(Coil.Text, "False") == 0)
                    {
                        Coil.BackColor = Color.DimGray;
                    }

                    column++;
                    index++;
                }

                if (column == 12 && row == 11)
                {
                    break;
                }

                row++;
            }
        }
        private void CreateCoil()
        {
            int StartingAdress = 0;
            int row            = 0;
            int column         = 0;

            Label lb_Adress = new Label();

            lb_Adress.Text     = "Adres";
            lb_Adress.Name     = lb_Adress.Text;
            lb_Adress.Location = new Point(10, 6);
            tLp_PlcMemory.Controls.Add(lb_Adress, column, row);

            column++;

            for (int i = 0; i < 11; i++)
            {
                Label lb_AdressInfo = new Label();
                lb_AdressInfo.Text      = (i).ToString();
                lb_AdressInfo.TextAlign = ContentAlignment.MiddleCenter;
                lb_AdressInfo.Name      = lb_AdressInfo.Text;
                lb_AdressInfo.Location  = new Point(10, 6);
                tLp_PlcMemory.Controls.Add(lb_AdressInfo, column, row);

                column++;
            }

            row = 1;


            while (true)
            {
                column = 0;
                lb_Adress lb_Coil = new lb_Adress();
                lb_Coil.Text     = (StartingAdress).ToString() + "-" + (StartingAdress + 9).ToString();
                lb_Coil.Name     = lb_Coil.Text;
                lb_Coil.Location = new Point(10, 6);

                tLp_PlcMemory.Controls.Add(lb_Coil, column, row);

                for (int i = 0; i < 11; i++)
                {
                    column++;
                    CoilControl Coil = new CoilControl();
                    Coil.Text      = "-";
                    Coil.Adress    = StartingAdress;
                    Coil.Value     = false;
                    Coil.Size      = new Size(60, 18);
                    Coil.Location  = new Point(10, 6);
                    Coil.Visible   = true;
                    Coil.BackColor = Color.DimGray;
                    Coil.AutoSize  = false;
                    Coil.TextAlign = ContentAlignment.MiddleCenter;
                    tLp_PlcMemory.Controls.Add(Coil, column, row);
                    StartingAdress++;
                }

                if (column == 11 && row == 11)
                {
                    break;
                }
                row++;
            }
        }