From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Baud Rate Calculator VI?

Solved!
Go to solution

I'm looking for a VI that will give me the 64 bit custom code for CAN and CAN FD baud rates given a set of inputs.  By that I mean I want to give a VI a desired baud rate, and sample point, and it returns the custom hex code that is valid for the custom Baud Rate property:

 

https://www.ni.com/docs/en-US/bundle/ni-xnet/page/nixnet/nxpropsession_intfbaudrate64.html

 

and CAN FD property:

 

https://www.ni.com/docs/en-US/bundle/ni-xnet/page/nixnet/propertyclustercan64bitfdbaudrate.html

 

Yes I know you can just type in the baud rate and sample point into the dialog in the XNet Database Editor, or Bus Monitor in MAX.  But I work with a variety of hardware and don't want the user of my software to have to calculate the hex code, I just want them to give a baud rate and sample point and have the software figure it out.

 

I found a VI posted here which does generate a 32 bit valid custom hex for the interface, which appears to work in the 64 bit property too.  But I'm also looking to do this with the CAN FD baud.  I'll try editing that VI to support my needs but if that doesn't work out does someone have code, or know of code buried in the vi.lib or something that does this calculation?  Thanks.

0 Kudos
Message 1 of 7
(4,876 Views)

I feel a little silly because again I think I came up with my own solution.  I looked at the VI I linked to and I think I made all the needed changes for it to be applied to the 32 bit CAN FD custom baud settings.  My quick test with my hardware appears to work.  If anyone has another solution or a similar set of code for the 64 bit settings feel free to reply here.

0 Kudos
Message 2 of 7
(4,838 Views)
Solution
Accepted by topic author Hooovahh

Here is a copy of what I have for the CAN FD baud rates. I highly recommend reviewing it as it is 5 years old and I haven't looked at it since I made it.

 

I think finessing it into a 64-bit is probably doable, but I am not very familiar withe the 64-bit version as I haven't thought much about it in the last 5 years.

Message 3 of 7
(4,794 Views)

Hi Hooovahh,

 

I have a VI that converts 32-bit custom baud rate to 64-bit and vice versa. It does some bit shifting based on the information from the XNET Help. Hope that it is helpful to you.

Senior Technical Support Engineer | CLD CTA | NI


DISCLAIMER: The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Message 4 of 7
(4,772 Views)

I always try to "Engineer Ambitiously", but NI often gets in the way and breaks links on their own website.

 

The first 2 links now only go to help files.

0 Kudos
Message 5 of 7
(2,577 Views)

It is hard to know, but I think this link is one of them.  I also can't edit my first post.

0 Kudos
Message 6 of 7
(2,565 Views)

Thanks Hooovahh

0 Kudos
Message 7 of 7
(2,543 Views)