コード例 #1
0
        private bool getCanBitRate()
        {
            long freq;
            int  tseg1, tseg2, sjw, nosamp, syncmode;

            if (Canlib.canGetBusParams(CANHandle, out freq, out tseg1, out tseg2, out sjw, out nosamp, out syncmode) != 0)
            {
                return(FAIL);
            }
            CANBitRate = freq;
            return(PASS);
        }
コード例 #2
0
        // CAN return rate
        public static string CanRateReturn(string canInterface)
        {
            long bitrate;
            int  tseg1;
            int  tseg2;
            int  sjw;
            int  noSamp;
            int  syncmode;

            string hardwareString0 = canInterface.Replace(" ", "");

            string[] msgOutput = hardwareString0.Split(';');

            Canlib.canGetBusParams(Convert.ToInt32(msgOutput[3]), out bitrate, out tseg1, out tseg2, out sjw, out noSamp, out syncmode);
            return(bitrate.ToString());
        } // End KvaserCanRateReturn
コード例 #3
0
        //****************************
        // Bus Settings Tab
        //****************************
        private void RetrieveBus_Click(object sender, EventArgs e)
        {
            Canlib.canStatus status;
            long             bitrate;
            int tseg1;
            int tseg2;
            int sjw;
            int noSamp;
            int syncmode;
            int canHandle = 0;

            status = Canlib.canGetBusParams(canHandle, out bitrate, out tseg1, out tseg2, out sjw, out noSamp, out syncmode);
            toolStripStatusLabel1.Text = CommonUtils.ErrorMsg("Retrieve Bus", status);

            if (status == 0)
            {
                bitrateBox.Text = bitrate.ToString();
                tseg1Box.Text   = tseg1.ToString();
                tseg2Box.Text   = tseg2.ToString();
                sjwBox.Text     = sjw.ToString();
                noSampBox.Text  = noSamp.ToString();
            }
        }