예제 #1
0
        public string CloseCan()
        {
            int Ret;

            Ret = VCI_SDK.VCI_CloseCAN(_canNum);
            return(ErrMsg[Ret]);
        }
예제 #2
0
        public void SendData(List <CanDriver.canmsg_t> data)
        {
            byte CAN_No, Mode, RTR, DLC;

            CAN_No = 1;
            Mode   = RTR = 0;
            DLC    = 8;
            foreach (var canmsg in data)
            {
                int Ret;
                Ret = VCI_SDK.VCI_SendCANMsg_NoStruct(CAN_No, Mode, RTR, DLC, canmsg.id, canmsg.data);
            }
        }
예제 #3
0
        public string OpenCAN(string canName, int baundRate)
        {
            byte canNum = byte.Parse(canName.Substring(3, canName.Length - 3));

            _canNum = canNum;
            int Ret;

            byte[] Mod_CfgData = new byte[512];

            //Listen Only Mode
            Mod_CfgData[0] = 0; //CAN1 => 0:Disable, 1:Enable
            Mod_CfgData[1] = 0; //CAN2 => 0:Disable, 1:Enable
            VCI_SDK.VCI_Set_MOD_Ex(Mod_CfgData);

            Ret = VCI_SDK.VCI_OpenCAN_NoStruct(canNum, 1,                                  //7 - CAN7, 1-DevType = 7565-H1
                                               (uint)(Convert.ToSingle(baundRate) * 1000), // baund rate = 50
                                               (uint)(Convert.ToSingle(1000) * 1000));
            return(ErrMsg[Ret]);
        }