Ejemplo n.º 1
0
        public SelfForm()
        {
            InitializeComponent();
            masterinfo = new MasterInfo(5);
            masterinfo.LoadInfo();
            //logfile = new LogFile();
            DAQ1        = new DAQ();
            DAQ2        = new DAQ();
            DAQ3        = new DAQ();
            DAQ4        = new DAQ();
            DAQ5        = new DAQ();
            barcoderead = new BarcodeRead();
            mlcp        = new MLCP();
            bin         = new Binary();

            nmfdio = new NMFDIO();

            inifile = new IniFiles(@"C:\Users\abc\Data\Option.ini");
            Spec    = new List <string>();
            //Spec = logfile.LoadSpec(2, 92);
            IP       = new short[3];
            NMFstate = new int[3];

            ReadData = "";
            ID       = "";
            IsNICon  = false;
            IsNMFCon = false;
            bytes    = ConvertByteArray("0D");
            list     = new List <string>();
            info     = new List <string>();
            info2    = new List <bool>();
            //strar = new string[5];
            bin.Load(@"C:\Users\abc\Data\Spec\Spec1", ref info, ref info2);

            NIName = inifile.ReadString("NI", "DevName", "");
            if (NIName == "")
            {
                MessageBox.Show("Option 탭에서 NI DevName을 확인해주세요");
            }
            try
            {
                IP[0]  = Convert.ToInt16(inifile.ReadString("NMF", "DevName1", ""));
                IP[1]  = Convert.ToInt16(inifile.ReadString("NMF", "DevName2", ""));
                IP[2]  = Convert.ToInt16(inifile.ReadString("NMF", "DevName3", ""));
                DevNum = Convert.ToInt16(inifile.ReadString("NMF", "DevName4", ""));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Option 탭에서 NMF DevName을 확인해주세요");
            }

            //SSC_.Open();
            try
            {
                BarcodeScanner1.PortName = inifile.ReadString("Barcode1", "PortName", "");
                BarcodeScanner2.PortName = inifile.ReadString("Barcode2", "PortName", "");
                MLCP.PortName            = inifile.ReadString("Meter", "PortName", "");
                SSC_.PortName            = inifile.ReadString("SSC", "PortName", "");
                //Idread = new IDRead(inifile.ReadString("SSC", "PortName", ""), 19200);

                BarcodeScanner1.Open();
                BarcodeScanner2.Open();
                MLCP.Open();
                SSC_.Open();
                //Idread.Connect();
            }
            catch
            {
                MessageBox.Show("장비 연결을 확인해주세요");
            }

            //IsNMFCon = nmfdio.Connect(DevNum, IP[0], IP[1], IP[2], 200);

            DAQ1.Analog_Connect(NIName, "ai0");
            DAQ2.Analog_Connect(NIName, "ai1");
            DAQ3.Analog_Connect(NIName, "ai2");
            DAQ4.Analog_Connect(NIName, "ai3");
            DAQ5.Analog_Connect(NIName, "ai4");
            DAQ1.Digital_Connect(NIName);
            DAQ2.Digital_Connect(NIName);
            DAQ3.Digital_Connect(NIName);
            DAQ4.Digital_Connect(NIName);
        }