예제 #1
0
        public override bool Init(HardWareInfoBase infoHardWare)
        {
            GoogolTechExtCardInfo googoTechMCInfo = infoHardWare as GoogolTechExtCardInfo;

            //   Global.logger.InfoFormat("初始化固高拓展卡,卡名称{0}", googoTechMCInfo.hardwareName);
            usCardNo = (short)googoTechMCInfo.iCardNo;
            usExtNo  = (short)googoTechMCInfo.iExtCardNo;
            short sRtn = 0;

            sRtn = gts.mc.GT_OpenExtMdl((short)usCardNo, googoTechMCInfo.m_strExtDllName);
            if (!HandleErrorMessage(sRtn))
            {
                //    Global.logger.ErrorFormat("初始化固高拓展卡{0}失败", googoTechMCInfo.hardwareName);
                bInitOK = false;
                return(false);
            }
            //sRtn = gts.mc.GT_Stop(0xFF, 0);

            sRtn = gts.mc.GT_ResetExtMdl((short)usCardNo);
            sRtn = gts.mc.GT_LoadExtConfig((short)usCardNo, googoTechMCInfo.m_strConfigPath);
            //sRtn = gts.mc.GT_ClrSts((short)usCardNo, 1, 8);//清除轴报警和限位
            bInitOK = true;

            System.Threading.Thread threadScan = new System.Threading.Thread(ScanThreadFunction);
            threadScan.IsBackground = true;
            threadScan.Start();
            return(true);
        }
예제 #2
0
 override public bool Init(HardWareInfoBase infoHardWare)
 {
     bInitOK = true;
     System.Threading.Thread threadScan = new System.Threading.Thread(ScanThreadFunction);
     threadScan.IsBackground = true;
     threadScan.Start();
     return(true);
 }
예제 #3
0
 private void listViewNFHardWare_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewNFHardWare.SelectedItems.Count > 0)
     {
         HardWareInfoBase hwInfoB = HardwareManage.hardDoc.m_HardWareDictionary[listViewNFHardWare.Items[listViewNFHardWare.SelectedItems[0].Index].Text];
         hwInfoB.ShowSettingForm(panel1);
     }
 }
예제 #4
0
        override public bool Init(HardWareInfoBase infoHardWare)
        {
            // Global.logger.Info("初始化雷塞IO卡");
            LEISAIInputOutputInfo tempInfo = (LEISAIInputOutputInfo)infoHardWare;

            if (nCardTotal > 0)
            {
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    bInitOK  = true;
                    usCardNo = (ushort)tempInfo.iCardNo;
                }
                else
                {
                    bInitOK = false;
                    return(false);
                }
            }
            else
            {
                nCardTotal = LTDIO.ioc_board_init();
                if (nCardTotal <= 0)//控制卡初始化
                {
                    //  Global.logger.Error("初始化雷塞IO卡失败");
                    bInitOK = false;
                    return(false);
                }
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    //    Global.logger.Info("初始化雷塞IO卡成功");
                    bInitOK  = true;
                    usCardNo = (ushort)tempInfo.iCardNo;
                }
                else
                {
                    //     Global.logger.Error("初始化雷塞IO卡失败");
                    bInitOK = false;
                    return(false);
                }
            }
            System.Threading.Thread threadScan = new System.Threading.Thread(ScanThreadFunction);
            threadScan.IsBackground = true;
            threadScan.Start();
            return(true);
        }
예제 #5
0
        public override bool Init(HardWareInfoBase infoHardWare)
        {
            //  Global.logger.Info("初始化凌华IO卡");
            ADLINKInputOutputInfo tempInfo = (ADLINKInputOutputInfo)infoHardWare;

            usCardNo = (ushort)tempInfo.iCardNo;
            bool ret;

            try
            {
                ret = DASK.Register_Card(tempInfo.hardwareModel, usCardNo) == 0 ? true : false;
            }
            catch (Exception)
            {
                //  Global.logger.Info("初始化凌华IO卡失败!");
                return(false);
            }
            ///    Global.logger.Info("初始化凌华IO卡成功!");
            return(ret);
        }
예제 #6
0
        override public bool Init(HardWareInfoBase infoHardWare)
        {
            AdvanceInputInfo hardWareInfo = (AdvanceInputInfo)infoHardWare;

            iCardNo = hardWareInfo.iCardNo;
            ErrorCode ret;

            try
            {
                ret = BDaqDevice.Open(iCardNo, AccessMode.ModeWriteWithReset, out m_device);
                if (ErrorCode.Success == ret)
                {
                    ret = m_device.GetModule(0, out m_dio);
                    if (ErrorCode.Success == ret)
                    {
                        bInitOK = true;
                    }
                    else
                    {
                        bInitOK = false;
                        return(false);
                    }
                }
                else
                {
                    bInitOK = false;
                    return(false);
                }
            }
            catch
            {
                bInitOK = false;
                return(false);
            }

            System.Threading.Thread threadScan = new System.Threading.Thread(ScanThreadFunction);
            threadScan.IsBackground = true;
            threadScan.Start();
            return(true);
        }
예제 #7
0
파일: LEISAIMCard.cs 프로젝트: houxpGit/12
        override public bool Init(HardWareInfoBase infoHardWare)
        {
            LEISAIMCInfo tempInfo = (LEISAIMCInfo)infoHardWare;

            if (nCardTotal > 0)
            {
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    bInitOK = true;
                }
                else
                {
                    bInitOK = false;
                }
            }
            else
            {
                nCardTotal = LTDMC.dmc_board_init();
                if (nCardTotal <= 0)//控制卡初始化
                {
                    bInitOK = false;
                    return(false);
                }
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    bInitOK = true;
                }
                else
                {
                    bInitOK = false;
                }
            }
            usCardNo = (ushort)tempInfo.iCardNo;
            System.Threading.Thread threadScan = new System.Threading.Thread(ScanThreadFunction);
            threadScan.IsBackground = true;
            threadScan.Start();
            return(true);
        }
예제 #8
0
        public override bool Init(HardWareInfoBase infoHardWare)
        {
            ADLINKTechMCInfo adlinkMotionCard = infoHardWare as ADLINKTechMCInfo;
            int boardID_InBits = 0; //*BoardID_InBits:传回值,以bit表示,如果回传值为0x11,代表目前电脑上有二张卡片;
            int mode           = 0; //0:系统指定卡号 1:由拨码开关指定卡号 ;
            int ret            = 0;
            int i            = 0;
            int card_name    = 0;
            int tamp         = 0;
            int StartAxisID  = 0;
            int TotalAxisNum = 0;

            //    Global.logger.InfoFormat("初始化凌华运动控制卡,卡名称{0}", adlinkMotionCard.hardwareName);
            usCardNo = adlinkMotionCard.iCardNo;

            ret = APS168_W64.APS168.APS_initial(ref boardID_InBits, mode);//初始化(不管电脑接了几张卡,只需初始化一次) 。
            if (ret == 0)
            {
                for (i = 0; i < 16; i++)
                {
                    tamp = (boardID_InBits >> i) & 1;

                    if (tamp == 1)
                    {
                        ret = APS168_W64.APS168.APS_get_card_name(i, ref card_name);

                        if (card_name == (int)APS_Define_W32.APS_Define.DEVICE_NAME_PCI_825458 ||
                            card_name == (int)APS_Define_W32.APS_Define.DEVICE_NAME_AMP_20408C)
                        {
                            ret = APS168_W64.APS168.APS_get_first_axisId(i, ref StartAxisID, ref TotalAxisNum);

                            //----------------------------------------------------
                            v_card_name         = card_name;
                            v_board_id          = i;
                            v_total_axis        = TotalAxisNum;
                            v_is_card_initialed = YES;

                            //ret = APS168_W64.APS168.APS_load_param_from_file(infoHardWare.ConfigName);
                            ret     = APS168_W64.APS168.APS_load_param_from_file(System.AppDomain.CurrentDomain.BaseDirectory + adlinkMotionCard.m_strConfigPath);
                            bInitOK = true;
                            if (v_total_axis == 4)
                            {
                                v_channel = 2;
                            }
                            else if (v_total_axis >= 4)
                            {
                                v_channel = 4;
                            }

                            v_total_axis = 16;
                            //----------------------------------------------------
                            Is_Creat = NO;
                            //     Global.logger.InfoFormat("初始化凌华运动控制卡{0}成功。", adlinkMotionCard.hardwareName);
                            break;
                        }
                    }
                }

                if (v_board_id == -1)
                {
                    v_is_card_initialed = NO;
                    //     Global.logger.ErrorFormat("初始化凌华运动控制卡{0}失败。", adlinkMotionCard.hardwareName);
                    bInitOK = false;
                }
            }
            else
            {
                v_is_card_initialed = NO;
                //   Global.logger.ErrorFormat("初始化凌华运动控制卡{0}失败。", adlinkMotionCard.hardwareName);
                bInitOK = false;
            }
            Thread threadScan = new Thread(ScanThreadFunction);

            threadScan.IsBackground = true;
            threadScan.Start();
            return(bInitOK);
        }
예제 #9
0
 static public void InitHardWare()
 {
     hardwardDictionary = new Dictionary <string, HardWareBase>();
     foreach (KeyValuePair <string, HardWareInfoBase> item in hardDoc.m_HardWareDictionary)
     {
         #region Demo
         if (item.Value.hardwareVender == HardWardVender.Demo)
         {
             if (item.Value.hardwareTpye == HardWardType.InputCard)
             {
                 DemoInputCard demoCard = new DemoInputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.InputOutputCard)
             {
                 DemoInputOutputCard demoCard = new DemoInputOutputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.MotionCard)
             {
                 DemoMCard demoCard = new DemoMCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.OutputCard)
             {
                 DemoOutputCard demoCard = new DemoOutputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
         }
         #endregion
         #region LEISAI
         if (item.Value.hardwareVender == HardWardVender.LEADTECH)
         {
             if (item.Value.hardwareTpye == HardWardType.InputCard)
             {
                 LEISAIInputCard demoCard = new LEISAIInputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.InputOutputCard)
             {
                 LEISAIInputOutputCard demoCard = new LEISAIInputOutputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.MotionCard)
             {
                 LEISAIMCard demoCard = new LEISAIMCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 HardWareInfoBase tempInfo       = item.Value;
                 LEISAIMCInfo     tempInfoLEISAI = (LEISAIMCInfo)tempInfo;
                 demoCard.usCardNo = (ushort)tempInfoLEISAI.iCardNo;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.OutputCard)
             {
                 LEISAIOutputCard demoCard = new LEISAIOutputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
         }
         #endregion
         #region GOOGOL
         if (item.Value.hardwareVender == HardWardVender.GOOGOL)
         {
             if (item.Value.hardwareTpye == HardWardType.MotionCard)
             {
                 GoogoTechMCard demoCard = new GoogoTechMCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 HardWareInfoBase tempInfo       = item.Value;
                 GoogoTechMCInfo  tempInfoLEISAI = (GoogoTechMCInfo)tempInfo;
                 demoCard.usCardNo = (short)tempInfoLEISAI.iCardNo;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.ExpansionModule)
             {
                 GoogolTechExtCard demoCard = new GoogolTechExtCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 HardWareInfoBase      tempInfo       = item.Value;
                 GoogolTechExtCardInfo tempInfoGoogol = (GoogolTechExtCardInfo)tempInfo;
                 demoCard.usCardNo = (short)tempInfoGoogol.iCardNo;
                 demoCard.usExtNo  = (short)tempInfoGoogol.iExtCardNo;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
         }
         #endregion
         #region ADVANCE
         if (item.Value.hardwareVender == HardWardVender.ADVANTECH)
         {
             if (item.Value.hardwareTpye == HardWardType.InputCard)
             {
                 AdvanceInputCard demoCard = new AdvanceInputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.OutputCard)
             {
                 AdvanceOutputCard demoCard = new AdvanceOutputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
         }
         #endregion
         #region ADLINK
         if (item.Value.hardwareVender == HardWardVender.ADLINK)
         {
             if (item.Value.hardwareTpye == HardWardType.MotionCard)
             {
                 ADLINKMotionCard demoCard = new ADLINKMotionCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 demoCard.hardwareModel  = item.Value.hardwareModel;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.InputOutputCard)
             {
                 ADLINKInputOuputCard demoCard = new ADLINKInputOuputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 demoCard.hardwareModel  = item.Value.hardwareModel;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
             if (item.Value.hardwareTpye == HardWardType.InputCard)
             {
                 ADLINKInputCard demoCard = new ADLINKInputCard();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 demoCard.hardwareModel  = item.Value.hardwareModel;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
         }
         #endregion
         #region Softservo
         if (item.Value.hardwareVender == HardWardVender.SOFTSERVO)
         {
             if (item.Value.hardwareTpye == HardWardType.MotionCard)
             {
                 SoftservoControler demoCard = new SoftservoControler();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
         }
         #endregion
         #region Beckhoff
         if (item.Value.hardwareVender == HardWardVender.BECKHOFF)
         {
             if (item.Value.hardwareTpye == HardWardType.MotionCard)
             {
                 BeckhoffADS demoCard = new BeckhoffADS();
                 demoCard.hardwareName   = item.Value.hardwareName;
                 demoCard.hardwareVender = item.Value.hardwareVender;
                 demoCard.hardwareTpye   = item.Value.hardwareTpye;
                 hardwardDictionary.Add(demoCard.hardwareName, demoCard);
             }
         }
         #endregion
     }
     foreach (KeyValuePair <string, HardWareBase> item in hardwardDictionary)
     {
         item.Value.Init(hardDoc.m_HardWareDictionary[item.Key]);
     }
 }
예제 #10
0
 virtual public bool Init(HardWareInfoBase infoHardWare)
 {
     return(true);
 }