Example #1
0
        public Form1()
        {
            InitializeComponent();

            int iIdx;

            m_bStart   = false;                      // the action stops at the beginning
            m_szIP     = "172.18.3.200";             // modbus slave IP address
            m_iPort    = 502;                        // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP

            m_Adam6000Type = Adam6000Type.Adam6024;  // the sample is for ADAM-6050

            // modbus current list view item
            m_iAiTotal = AnalogInput.GetChannelTotal(m_Adam6000Type);
            m_iDiTotal = DigitalInput.GetChannelTotal(m_Adam6000Type);
            m_iAoTotal = AnalogOutput.GetChannelTotal(m_Adam6000Type);
            m_iDoTotal = DigitalOutput.GetChannelTotal(m_Adam6000Type);

            m_bChEnabled = new bool[m_iAiTotal];
            m_byAiRange  = new byte[m_iAiTotal];
            m_byAoRange  = new byte[m_iAoTotal];

            for (iIdx = 0; iIdx < m_iAoTotal; iIdx++)
            {
                //
                cbxAOChannel.Items.Add(iIdx.ToString());
                //
            }
            cbxAOChannel.SelectedIndex = -1;

            txtModule.Text = m_Adam6000Type.ToString();
        }
Example #2
0
        //public string HelloWorld()
        //{
        //    return "Hello World";
        //}

        public void adamconnect(string varIPAddress, string varPortNo)
        {
            try
            {
                m_bStart = false;

                m_szIP     = varIPAddress;               // GlobalVariable.strDIOIPAddress_glb;
                m_iPort    = Convert.ToInt32(varPortNo); // GlobalVariable.strDIOPortNumber_glb);
                adamModbus = new AdamSocket();
                adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP
                m_Adam6000Type = Adam6000Type.Adam6066;  //InitAdam6066();
                int iDI = 12, iDO = 2;
                m_iDoTotal = iDO;
                m_iDiTotal = iDI;
                if (adamModbus.Connect(m_szIP, ProtocolType.Tcp, m_iPort))
                {
                    // panelDIO.Enabled = true;
                    m_iCount = 0;    // reset the reading counter
                    //timer1.Enabled = true; // enable timer
                    m_bStart = true; // starting flag
                }
                else
                {
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "toastr", "toastr.success('Adam is not connected. Please check.');", true);
                }
            }
            catch { }
        }
Example #3
0
        public void info()
        {
            #region 定义模块参数
            // m_bStart = false;			// the action stops at the beginning
            m_szIP1 = "10.0.0.2";                           // modbus slave IP address
            m_szIP2 = "10.0.0.3";                           // modbus slave IP address
            m_szIP3 = "10.0.0.4";                           // modbus slave IP address
            m_szIP4 = "10.0.0.5";                           // modbus slave IP address
            m_szIP5 = "10.0.0.6";                           // modbus slave IP address
            m_szIP6 = "10.0.0.7";                           // modbus slave IP address
            m_szIP7 = "10.0.0.8";                           // modbus slave IP address
            m_szIP8 = "10.0.0.9";                           // modbus slave IP address
            m_szIP9 = "10.0.0.10";                          // modbus slave IP address

            m_iPort     = 502;                              // modbus TCP port is 502
            adamModbus1 = new AdamSocket();
            adamModbus1.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus1.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus2 = new AdamSocket();
            adamModbus2.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus2.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus3 = new AdamSocket();
            adamModbus3.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus3.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus4 = new AdamSocket();
            adamModbus4.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus4.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus5 = new AdamSocket();
            adamModbus5.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus5.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus6 = new AdamSocket();
            adamModbus6.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus6.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus7 = new AdamSocket();
            adamModbus7.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus7.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus8 = new AdamSocket();
            adamModbus8.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus8.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            adamModbus9 = new AdamSocket();
            adamModbus9.SetTimeout(500, 500, 500);          // 设置超时时间
            adamModbus9.AdamSeriesType = AdamType.Adam6200; // set AdamSeriesType for  ADAM-6217

            m_Adam6000Type = Adam6000Type.Adam6217;         // the sample is for ADAM-6217
            m_iAiTotal     = AnalogInput.GetChannelTotal(m_Adam6000Type);
            m_bChEnabled   = new bool[m_iAiTotal];
            m_byRange      = new ushort[m_iAiTotal];
            #endregion

            red_net = new Thread(red);
            red_net.Start();
        }
Example #4
0
        private ushort[] m_usRange; //for newer version
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            Database.SetInitializer(new CpDashboardDatabaseInitializer());

            RouteTable.Routes.MapHttpRoute(
                name: "Alert",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = System.Web.Http.RouteParameter.Optional }
                );

            CpDashboardContext cont = new CpDashboardContext();

            cont.Database.Initialize(true);
            cont.Database.CreateIfNotExists();

            //set a timer
            //adam initializer
            m_bStart   = false;                      // the action stops at the beginning
            m_szIP     = "192.168.10.10";            // modbus slave IP address
            m_iPort    = 502;                        // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP
            adamUDP = new AdamSocket();
            adamUDP.SetTimeout(1000, 1000, 1000);    // set timeout for UDP

            m_Adam6000Type = Adam6000Type.Adam6015;  // the sample is for ADAM-6015

            adamUDP.Connect(AdamType.Adam6000, m_szIP, ProtocolType.Udp);
            if (adamUDP.Configuration().GetFirmwareVer(out m_szFwVersion))
            {
                m_DeviceFwVer = int.Parse(m_szFwVersion.Trim().Substring(0, 1));
            }
            adamUDP.Disconnect();

            m_iAiTotal = AnalogInput.GetChannelTotal(m_Adam6000Type);
            m_iDoTotal = DigitalOutput.GetChannelTotal(m_Adam6000Type);

            //txtModule.Text = m_Adam6000Type.ToString();
            m_bChEnabled = new bool[m_iAiTotal];

            //firmware version
            //fwversion.Text = m_DeviceFwVer.ToString();

            if (m_DeviceFwVer > m_Adam6000NewerFwVer)
            {
                m_usRange = new ushort[m_iAiTotal];
            }

            if (cont.Database.Exists())
            {
                // start the retrieving datas and save to db;
                startSending();
            }
        }
Example #5
0
        /// <summary>
        /// 根据参数,构造modbus,生成adamSocket实例
        /// </summary>
        /// <param name="ip">从站ip</param>
        /// <param name="series">研华板卡的系列</param>
        /// <param name="type">研华板卡的具体型号</param>
        /// <param name="port">modbus通信端口,默认为502</param>
        public AdamHelper(string ip, AdamType series,
                          Adam6000Type type, int port = 502)
        {
            adamModbus = new AdamSocket();
            slaveIp    = ip;
            modbusPort = port;
            //adamSeries = Advantech.Adam.AdamType.Adam6200;

            adamSeries = (Advantech.Adam.AdamType)series;
            adamType   = (Advantech.Adam.Adam6000Type)type;
        }
Example #6
0
        public AdamCNT()
        {
            cnt          = 0;
            m_szIP       = Constants.DEF_IP;
            m_iPort      = Constants.DEF_PORT;
            m_adamModbus = new AdamSocket();
            m_adamUDP    = new AdamSocket();
            m_adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP
            m_Adam6000Type = Adam6000Type.Adam6051;    // the sample is for ADAM-6051

            InitAdam6051();
        }
Example #7
0
        public Form1()
        {
            InitializeComponent();

            m_bStart   = false;                      // the action stops at the beginning
            m_szIP     = "172.18.3.232";             // modbus slave IP address
            m_iPort    = 502;                        // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP

            m_Adam6000Type = Adam6000Type.Adam6050;  // the sample is for ADAM-6050
            //m_Adam6000Type = Adam6000Type.Adam6050W; // the sample is for ADAM-6050W
            //m_Adam6000Type = Adam6000Type.Adam6051; // the sample is for ADAM-6051
            //m_Adam6000Type = Adam6000Type.Adam6051W; // the sample is for ADAM-6051W
            //m_Adam6000Type = Adam6000Type.Adam6052; // the sample is for ADAM-6052
            //m_Adam6000Type = Adam6000Type.Adam6055; // the sample is for ADAM-6055
            //m_Adam6000Type = Adam6000Type.Adam6060; // the sample is for ADAM-6060
            //m_Adam6000Type = Adam6000Type.Adam6060W; // the sample is for ADAM-6060W
            //m_Adam6000Type = Adam6000Type.Adam6066; // the sample is for ADAM-6066

            if (m_Adam6000Type == Adam6000Type.Adam6050 ||
                m_Adam6000Type == Adam6000Type.Adam6050W)
            {
                InitAdam6050();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6051 ||
                     m_Adam6000Type == Adam6000Type.Adam6051W)
            {
                InitAdam6051();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6052)
            {
                InitAdam6052();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6055)
            {
                InitAdam6055();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6060 ||
                     m_Adam6000Type == Adam6000Type.Adam6060W)
            {
                InitAdam6060();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6066)
            {
                InitAdam6066();
            }

            txtModule.Text = m_Adam6000Type.ToString();
        }
Example #8
0
 public Adam6000(string name, Adam6000Type model)  : base(name, new ChannelsInfo {
     AnalogInputsCount    = AnalogInput.GetChannelTotal(model),
     AnalogOutputsCount   = AnalogOutput.GetChannelTotal(model),
     DiscreteInputsCount  = DigitalInput.GetChannelTotal(model),
     DiscreteOutputsCount = DigitalOutput.GetChannelTotal(model),
     CounterInputsCount   = DigitalInput.GetChannelTotal(model)
 })
 {
     Model = model;
     if (AnalogInputs != null)
     {
         AIRanges = new List <byte>(new byte[AnalogInputs.Count]);
     }
 }
Example #9
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            m_bStart   = false;                      // the action stops at the beginning
            m_szIP     = "172.18.3.93";              // modbus slave IP address
            m_iPort    = 502;                        // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP
            adamModbus.AdamSeriesType = AdamType.Adam6200;
            adamModbus.Connect(m_szIP, ProtocolType.Tcp, m_iPort);

            m_Adam6000Type = Adam6000Type.Adam6224; // the sample is for ADAM-6224

            m_iAoChTotal        = AnalogOutput.GetChannelTotal(m_Adam6000Type);
            m_iAoRangeTotal     = AnalogOutput.GetRangeTotal(m_Adam6000Type, Adam6000_RangeFormat.Ushort);
            m_iDiTotal          = DigitalInput.GetChannelTotal(m_Adam6000Type);
            m_DiValueStartAddr  = 1;
            m_iAoValueStartAddr = 1;
            txtModule.Text      = m_Adam6000Type.ToString();
            m_usRange           = new ushort[m_iAoChTotal];
            m_usAoValue         = new ushort[m_iAoChTotal];

            InitialDiDgViewModbusGeneralRow(m_DiValueStartAddr, m_iDiTotal, ref dgViewDiChannelInfo);

            InitialAoDgViewModbusGeneralRow(m_iAoValueStartAddr, m_iAoChTotal, ref dgViewAoChannelInfo);
            for (int i = 0; i < m_iAoChTotal; i++)
            {
                cbxAoChannel.Items.Add(i.ToString());
            }

            cbxAoChannel.Items.Add("All");

            if (m_Adam6000Type == Adam6000Type.Adam6224)
            {
                for (int i_iIndex = 0; i_iIndex < m_iAoRangeTotal; i_iIndex++)
                {
                    ushort usRangeCode  = AnalogOutput.GetRangeCode2Byte(m_Adam6000Type, i_iIndex);
                    string strRangeName = AnalogOutput.GetRangeName(m_Adam6000Type, usRangeCode);
                    cbxAoOutputRange.Items.Add(new ComboItem(strRangeName, usRangeCode));
                }
            }
        }
Example #10
0
        public Form1()
        {
            InitializeComponent();

            m_bStart     = false;                      // the action stops at the beginning
            m_szIP       = "10.0.0.1";                 // modbus slave IP address
            m_iPort      = 502;                        // modbus TCP port is 502
            m_adamModbus = new AdamSocket();
            m_adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP

            m_Adam6000Type = Adam6000Type.Adam6051;    // the sample is for ADAM-6051

            InitAdam6051();
            SetModeItem();
            btnEnableDisable(false);
            txtModule.Text = m_Adam6000Type.ToString();
        }
Example #11
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            m_bStart   = false;                      // the action stops at the beginning
            m_szIP     = "172.18.3.147";             // modbus slave IP address
            m_iPort    = 502;                        // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP

            m_Adam6000Type = Adam6000Type.Adam6250;  // the sample is for ADAM-6250
            //m_Adam6000Type = Adam6000Type.Adam6251; // the sample is for ADAM-6251
            //m_Adam6000Type = Adam6000Type.Adam6256; // the sample is for ADAM-6256
            //m_Adam6000Type = Adam6000Type.Adam6260; // the sample is for ADAM-6260
            //m_Adam6000Type = Adam6000Type.Adam6266; // the sample is for ADAM-6266

            txtModule.Text = m_Adam6000Type.ToString();

            if (m_Adam6000Type == Adam6000Type.Adam6250)
            {
                InitAdam6250();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6251)
            {
                InitAdam6251();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6256)
            {
                InitAdam6256();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6260)
            {
                InitAdam6260();
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6266)
            {
                InitAdam6266();
            }
        }
Example #12
0
        public Form1()
        {
            InitializeComponent();

            m_bStart   = false;                      // the action stops at the beginning
            m_szIP     = "172.18.3.201";             // modbus slave IP address
            m_iPort    = 502;                        // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP

            m_Adam6000Type = Adam6000Type.Adam6022;  // the sample is for ADAM-6050

            m_dVals      = new float[3];
            m_pv1LblHigh = new float[2];
            m_pv1LblLow  = new float[2];
            m_pv2LblHigh = new float[2];
            m_pv2LblLow  = new float[2];

            txtModule.Text = m_Adam6000Type.ToString();
        }
        public void Initialize()
        {
            m_bStart   = false;                                         // the action stops at the beginning
            m_szIP     = "192.168.1.3";                                 // modbus slave IP address
            m_iPort    = 502;                                           // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000);                    // set timeout for TCP
            adamModbus.AdamSeriesType = AdamType.Adam6200;              // set AdamSeriesType for  ADAM-6217
            m_Adam6000Type            = Adam6000Type.Adam6217;          // the sample is for ADAM-6217

            m_iAiTotal   = AnalogInput.GetChannelTotal(m_Adam6000Type); //channel number
            m_bChEnabled = new bool[m_iAiTotal];
            m_byRange    = new ushort[m_iAiTotal];

            fValue = new float[m_iAiTotal];
            pool   = new MysqlConnectionPool();


            Connect2Adam();
        }
        public AdamRetriever(int sensorNum)
        {
            sensorStatus = "false";
            sensorNumber = sensorNum;
            m_bStart     = false;                    // the action stops at the beginning
            m_szIP       = "192.168.10.10";          // modbus slave IP address
            m_iPort      = 502;                      // modbus TCP port is 502
            adamModbus   = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP
            adamUDP = new AdamSocket();
            adamUDP.SetTimeout(1000, 1000, 1000);    // set timeout for UDP

            m_Adam6000Type = Adam6000Type.Adam6015;  // the sample is for ADAM-6015

            adamUDP.Connect(AdamType.Adam6000, m_szIP, ProtocolType.Udp);
            if (adamUDP.Configuration().GetFirmwareVer(out m_szFwVersion))
            {
                m_DeviceFwVer = int.Parse(m_szFwVersion.Trim().Substring(0, 1));
            }
            adamUDP.Disconnect();

            m_iAiTotal = AnalogInput.GetChannelTotal(m_Adam6000Type);
            m_iDoTotal = DigitalOutput.GetChannelTotal(m_Adam6000Type);

            //txtModule.Text = m_Adam6000Type.ToString();
            m_bChEnabled = new bool[m_iAiTotal];

            //firmware version
            //fwversion.Text = m_DeviceFwVer.ToString();

            if (m_DeviceFwVer > m_Adam6000NewerFwVer)
            {
                m_usRange = new ushort[m_iAiTotal];
            }

            // start the retrieving datas and save to db;
            startRetrieving();
        }
Example #15
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            m_bStart   = false;                                // the action stops at the beginning
            m_szIP     = "172.18.3.189";                       // modbus slave IP address
            m_iPort    = 502;                                  // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000);           // set timeout for TCP
            adamModbus.AdamSeriesType = AdamType.Adam6200;     // set AdamSeriesType for  ADAM-6217
            m_Adam6000Type            = Adam6000Type.Adam6217; // the sample is for ADAM-6217

            m_iAiTotal = AnalogInput.GetChannelTotal(m_Adam6000Type);

            txtModule.Text = m_Adam6000Type.ToString();
            m_bChEnabled   = new bool[m_iAiTotal];
            m_byRange      = new ushort[m_iAiTotal];
        }
Example #16
0
        public void RefreshDIO(string varIPAddress, string varPortNo)
        {
            try
            {
                m_bStart = false;

                m_szIP     = varIPAddress;               // GlobalVariable.strDIOIPAddress_glb;
                m_iPort    = Convert.ToInt32(varPortNo); // GlobalVariable.strDIOPortNumber_glb);
                adamModbus = new AdamSocket();
                adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP
                m_Adam6000Type = Adam6000Type.Adam6066;  //InitAdam6066();
                int iDI = 12, iDO = 2;
                m_iDoTotal = iDO;
                m_iDiTotal = iDI;
                if (adamModbus.Connect(m_szIP, ProtocolType.Tcp, m_iPort))
                {
                    // panelDIO.Enabled = true;
                    m_iCount = 0;    // reset the reading counter
                    //timer1.Enabled = true; // enable timer
                    m_bStart = true; // starting flag
                }
                else
                {
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "toastr", "toastr.success('Adam is not connected. Please check.');", true);
                }
            }
            catch { }


            int iDiStart = 1, iDoStart = 17;
            int iChTotal;

            bool[] bDiData, bDoData, bData;

            //bool IsFirstWeight = false


            if (adamModbus.Modbus().ReadCoilStatus(iDiStart, m_iDiTotal, out bDiData) &&
                adamModbus.Modbus().ReadCoilStatus(iDoStart, m_iDoTotal, out bDoData))
            {
                iChTotal = m_iDiTotal + m_iDoTotal;
                bData    = new bool[iChTotal];
                Array.Copy(bDiData, 0, bData, 0, m_iDiTotal);
                Array.Copy(bDoData, 0, bData, m_iDiTotal, m_iDoTotal);

                if (bData[0].ToString() == "True")
                {
                    //btnSA.BackColor = System.Drawing.Color.Red;
                    varSA = false;
                    Session["SENSORSA"] = "0";
                }
                else if (bData[0].ToString() == "False")
                {
                    //btnSA.BackColor = System.Drawing.Color.GreenYellow;
                    varSA = true;
                    Session["SENSORSA"] = "1";
                }
                else if (bData[0].ToString() == "Fail")
                {
                }

                if (bData[1].ToString() == "True")
                {
                    //btnSB.BackColor = System.Drawing.Color.Red;
                    varSB = false;
                    Session["SENSORSB"] = "0";
                }
                else if (bData[1].ToString() == "False")
                {
                    //btnSB.BackColor = System.Drawing.Color.GreenYellow;
                    varSB = true;
                    Session["SENSORSB"] = "1";
                }
                else if (bData[1].ToString() == "Fail")
                {
                }


                if (bData[2].ToString() == "True")
                {
                    //btnSC.BackColor = System.Drawing.Color.Red;
                    varSC = false;
                    Session["SENSORSC"] = "0";
                }
                else if (bData[2].ToString() == "False")
                {
                    //btnSC.BackColor = System.Drawing.Color.GreenYellow;
                    varSC = true;
                    Session["SENSORSC"] = "1";
                }
                else if (bData[1].ToString() == "Fail")
                {
                }
            }

            //string varReturnData = varSA.ToString() + "," + varSB.ToString() + "," + varSC.ToString();

            //return varReturnData;
        }
Example #17
0
        private ushort[] m_usRange; //for newer version

        public Form1()
        {
            InitializeComponent();

            m_bStart   = false;                      // the action stops at the beginning
            m_szIP     = "172.18.3.222";             // modbus slave IP address
            m_iPort    = 502;                        // modbus TCP port is 502
            adamModbus = new AdamSocket();
            adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP
            adamUDP = new AdamSocket();
            adamUDP.SetTimeout(1000, 1000, 1000);    // set timeout for UDP

            m_Adam6000Type = Adam6000Type.Adam6015;  // the sample is for ADAM-6015
            //m_Adam6000Type = Adam6000Type.Adam6017; // the sample is for ADAM-6017
            //m_Adam6000Type = Adam6000Type.Adam6018; // the sample is for ADAM-6018

            adamUDP.Connect(AdamType.Adam6000, m_szIP, ProtocolType.Udp);
            if (adamUDP.Configuration().GetFirmwareVer(out m_szFwVersion))
            {
                m_DeviceFwVer = int.Parse(m_szFwVersion.Trim().Substring(0, 1));
            }
            adamUDP.Disconnect();

            m_iAiTotal = AnalogInput.GetChannelTotal(m_Adam6000Type);
            m_iDoTotal = DigitalOutput.GetChannelTotal(m_Adam6000Type);

            txtModule.Text = m_Adam6000Type.ToString();
            m_bChEnabled   = new bool[m_iAiTotal];

            if (m_DeviceFwVer < m_Adam6000NewerFwVer)
            {
                m_byRange = new byte[m_iAiTotal];
            }
            else
            {
                //for newer version Adam6017
                m_usRange = new ushort[m_iAiTotal];
            }

            // arrange channel text box

            if (m_Adam6000Type == Adam6000Type.Adam6015)
            {
                // Channel
                chkboxCh7.Visible   = false;
                txtAIValue7.Visible = false;
                // DO
                panelDO.Visible = false;
            }
            else if (m_Adam6000Type == Adam6000Type.Adam6017)
            {
                // DO
                btnCh2.Visible = false;
                txtCh2.Visible = false;
                btnCh3.Visible = false;
                txtCh3.Visible = false;
                btnCh4.Visible = false;
                txtCh4.Visible = false;
                btnCh5.Visible = false;
                txtCh5.Visible = false;
                btnCh6.Visible = false;
                txtCh6.Visible = false;
                btnCh7.Visible = false;
                txtCh7.Visible = false;
            }
            else  //Adam6018
            {
                ;
            }
        }