Esempio n. 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();
        }
Esempio n. 2
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();
        }
Esempio n. 3
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));
                }
            }
        }
Esempio n. 4
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();
        }
Esempio n. 5
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();
            }
        }
Esempio n. 6
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();
        }
Esempio n. 7
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];
        }
Esempio n. 8
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
            {
                ;
            }
        }