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:

 

http://zone.ni.com/reference/en-XX/help/372841T-01/nixnet/nxpropsession_intfbaudrate64/

 

and CAN FD property:

 

http://zone.ni.com/reference/en-XX/help/372841W-01/nixnet/propertysessioninterfacecan64bitfdbaudrate...

 

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 4
(1,029 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 4
(991 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 4
(947 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.

Staff Technical Support Engineer | CLD CTA
National Instruments
Message 4 of 4
(925 Views)