Пример #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="type">接口卡的型号</param>
        public ZLGCANFuction()
        {
            XmlHelper.LoadConfigInfo();

            ZLGInfo.DevType                   = SelectCANWnd.GetCanType(int.Parse(XmlHelper.m_strCanType));
            zlgInfo.DevIndex                  = uint.Parse(XmlHelper.m_strCanIndex);
            zlgInfo.DevChannel                = uint.Parse(XmlHelper.m_strCanChannel);
            ZLGInfo.Baudrate                  = SelectCANWnd.GetSelectBaudRate(int.Parse(XmlHelper.m_strBaudrate));
            zlgInfo.AccCode                   = 0x00000000;
            zlgInfo.AccMask                   = 0xFFFFFFFF;
            zlgInfo.Mode                      = 0;
            ZLGInfo.Timing0                   = 0x00;
            ZLGInfo.Timing1                   = 0x1C;
            zlgInfo.CANFD                     = uint.Parse(XmlHelper.m_strCanFD);
            zlgInfo.ArbitrationBaudrate       = SelectCANWnd.GetSelectArbitrationBaudRate(int.Parse(XmlHelper.m_strArbitration));
            zlgInfo.DataBaudRate              = SelectCANWnd.GetSelectDataBaudRate(int.Parse(XmlHelper.m_strDataBaudRate));
            zlgInfo.TerminaiResistanceEnabled = int.Parse(XmlHelper.m_strTerminalResistance);
        }
Пример #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="type">接口卡的型号</param>
        public ZLGFuction()
        {
            XmlHelper.LoadConfigInfo();

            ZLGInfo.DevType    = SelectCANWnd.GetCanType(int.Parse(XmlHelper.m_strCanType));
            zlgInfo.DevIndex   = uint.Parse(XmlHelper.m_strCanIndex);
            zlgInfo.DevChannel = uint.Parse(XmlHelper.m_strCanChannel);
            ZLGInfo.Baudrate   = SelectCANWnd.GetSelectBaudRate(int.Parse(XmlHelper.m_strBaudrate));
            zlgInfo.AccCode    = 0x00000000;
            zlgInfo.AccMask    = 0xFFFFFFFF;
            zlgInfo.Mode       = 0;
            ZLGInfo.Timing0    = 0x00;
            ZLGInfo.Timing1    = 0x1C;

            //lipeng 2020.04.02       增加CANFD驱动
            zlgInfo.CANFD = uint.Parse(XmlHelper.m_strCanFD);
            zlgInfo.ArbitrationBaudrate       = SelectCANWnd.GetSelectArbitrationBaudRate(int.Parse(XmlHelper.m_strArbitration));
            zlgInfo.DataBaudRate              = SelectCANWnd.GetSelectDataBaudRate(int.Parse(XmlHelper.m_strDataBaudRate));
            zlgInfo.TerminaiResistanceEnabled = int.Parse(XmlHelper.m_strTerminalResistance);
            if (ZLGInfo.DevType == (uint)ZLGType.PCAN)
            {
                PCANInterface.PCANInstance.RaiseRecvDataEvent += OnRaisePcanRecvDataEvent;
            }
        }