Esempio n. 1
0
        //初始化所有can通道
        private void InitCanAll()
        {
            VCI_INIT_CONFIG config = new VCI_INIT_CONFIG();

            config.AccCode = System.Convert.ToUInt32("0x" + textBox_AccCode.Text, 16);
            config.AccMask = System.Convert.ToUInt32("0x" + textBox_AccMask.Text, 16);
            config.Filter  = mFilter; //(Byte)comboBox_Filter.SelectedIndex;
            config.Mode    = mMode;   //(Byte)comboBox_Mode.SelectedIndex;
            config.Timing0 = System.Convert.ToByte(can0T0TextBox.Text, 16);
            config.Timing1 = System.Convert.ToByte(can0T1TextBox.Text, 16);
            DllAdapte.VCI_InitCAN(mDevType, mDevInd, 0 /*(UInt32)CanIndex.Can0*/, ref config);
            config.Timing0 = System.Convert.ToByte(can1T0TextBox.Text, 16);
            config.Timing1 = System.Convert.ToByte(can1T1TextBox.Text, 16);
            DllAdapte.VCI_InitCAN(mDevType, mDevInd, 1 /*(UInt32)CanIndex.Can1*/, ref config);
        }
Esempio n. 2
0
        //根据指定的can通道进行初始化
        private void InitCanByIndex(UInt32 canInd)
        {
            VCI_INIT_CONFIG config = new VCI_INIT_CONFIG();

            if (canInd == 0)
            {
                config.Timing0 = System.Convert.ToByte(can0T0TextBox.Text, 16);
                config.Timing1 = System.Convert.ToByte(can0T1TextBox.Text, 16);
            }
            else if (canInd == 1)
            {
                config.Timing0 = System.Convert.ToByte(can1T0TextBox.Text, 16);
                config.Timing1 = System.Convert.ToByte(can1T1TextBox.Text, 16);
            }

            config.AccCode = System.Convert.ToUInt32("0x" + textBox_AccCode.Text, 16);
            config.AccMask = System.Convert.ToUInt32("0x" + textBox_AccMask.Text, 16);
            config.Filter  = mFilter; //(Byte)comboBox_Filter.SelectedIndex;
            config.Mode    = mMode;   //(Byte)comboBox_Mode.SelectedIndex;
            DllAdapte.VCI_InitCAN(mDevType, mDevInd, canInd, ref config);
        }