Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate CAN Signal Min and Max values based on DBC file

Solved!
Go to solution

Hi there,

 

Is there any VI out there that can calculate the signal Min & Max values based on the bit length, scaling offset, scaling factor etc. from the .dbc file?

 

Reason I need this:

 

I would like to verify that some signals are being routed from one bus to another correctly. So I would like to send the min value, then the max value and then min value again over the buses to verify this. In other words I need to know what the scaled min & max values are before sending them so I know what values to look for on the other side to verify that the signal is routing correctly.

 

Thanks

0 Kudos
Message 1 of 4
(8,785 Views)

There is not "A VI" that does this but I have an example of doing this using XNet.  I made a CAN Blog Post 12 showing one way of doing this using the XY session type, which was inspired by some information in this thread from earlier.

0 Kudos
Message 2 of 4
(8,776 Views)

Thanks for the reply Hooovahh,

 

However this is not what I am looking for.

 

What I want to do is parse the dbc files and figure out what the actual min&max values for a given signal is. For example see the screenshot below that shows a signal defined in a dbc file before and after the actual min/max values are calculated based on the value type,bit length,factor and offset. You can see how the max is slightly different now.

 

Before calculation of signal min/max valuesBefore calculation of signal min/max valuesAfter calculation of signal min/max valuesAfter calculation of signal min/max values

 

So using the calculated min/max values I would like to writes these values over the bus, then verify that the values are received on the other side. Otherwise If i parse out the min/max using the property of the XNET database I will get a min value of 0 and max of 200 but on the receiving bus the max value will be 127.5 as you can see from the calculated max. Hopefully this explains it a bit better.

 

Thanks

0 Kudos
Message 3 of 4
(8,766 Views)
Solution
Accepted by jkerrigan12

Oh yeah sorry.  This is pretty easy too using XNet.  Import the DBC, then you can get a reference to that database, get the cluster, get the signal, get the offset scaling, and number of bits then calculate what the min max is.  Also in the DBC there is a Min and Max that is defined for a signal.  You don't have to abide by this min and max and can write values outside of it.  Attached is a VI in 2017 which will read a DBC import it, and then get the Min/Max of the signal both ways for the first signal in the DBC.  All that should be needed is XNet drivers.  The main VI is Main Find Min Max Example.vi.  All the other VIs in the zip help with importing the database, but if it is already imported you can just reference it by name and not need them.

Message 4 of 4
(8,762 Views)