public Form_APAX_5090(string IP, int SlotNum, AdamType i_adamType) { InitializeComponent(); adamUDP = new AdamSocket(); m_szSlots = null; m_idxID = SlotNum; // Set Slot_ID m_adamType = i_adamType; if (m_adamType == AdamType.Apax5070) { protoType = ProtocolType.Tcp; portNum = 502; } else { protoType = ProtocolType.Udp; portNum = 5048; } m_iConnectTimeout = 2000; // Connection Timeout m_iSendTimeout = 2000; // Send Timeout m_iReceiveTimeout = 2000; // Receive Timeout cbxPort.SelectedIndex = 0; m_szIP = IP; m_comPortParametersAry = new ComPortParameters[4]; this.StatusBar_IO.Text = ("Start to demo " + (APAX_INFO_NAME + ("-" + (DVICE_TYPE + " by clicking \'Start\' button.")))); }
public Form_APAX_5082(string IP, int SlotNum, int ScanTime, AdamType i_adamType) { InitializeComponent(); m_szSlots = null; m_idxID = SlotNum; // Set Slot_ID m_iScanCount = 0; m_iFailCount = 0; m_bChMask = new bool[AdamControl.APAX_MaxAIOCh]; m_ScanTime_LocalSys = ScanTime;// Scan time m_adamType = i_adamType; if (m_adamType == AdamType.Apax5070) { protoType = ProtocolType.Tcp; portNum = 502; } else { protoType = ProtocolType.Udp; portNum = 5048; } timer1.Interval = m_ScanTime_LocalSys; m_iTimeout = new int[3]; m_iTimeout[0] = 2000; // Connection Timeout m_iTimeout[1] = 2000; // Send Timeout m_iTimeout[2] = 2000; // Receive Timeout m_szIP = IP; this.StatusBar_IO.Text = ("Start to demo " + (APAX_INFO_NAME + ("-" + (DVICE_TYPE + " by clicking \'Start\' button.")))); }
/// <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; }