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:
and CAN FD property:
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.
Solved! Go to Solution.
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.
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.
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.