Page 1 of 1

Enumeration on CAN Rx (DBC)

PostPosted: Tue Jan 14, 2025 12:35 pm
by bing
I have been trying write Rx Script on Enumeration from DBC, I can't seem to get the script working.
Do I have to Rx them as Getinteger to local integer channel first than map a local enumeration channel?

Thanks,

Re: Enumeration on CAN Rx (DBC)

PostPosted: Fri Feb 14, 2025 11:25 pm
by Loic
Hi,

You can directly assign a channel from your RX code with the .GetEnum() function on your DBC signal. To make it work the DBC signal must have a value table (vt) assigned to it and the target channel must have the same vt assigned as Data Type (might also work by creating an enumeration data type identical to the vt but usually it is more convenient to work directly with the vt as it allows discontinuity in the key values, unlike the enumeration).

If you are not working with Value Tables, then you have to get the value of your DBC signal (either raw unsigned, scaled, or whatever is corresponding to you need and setup) and assign it with the .Set() function.

Re: Enumeration on CAN Rx (DBC)

PostPosted: Wed Feb 26, 2025 11:04 am
by bing
Are you sure .GetEnum() is available?


Loic wrote:Hi,

You can directly assign a channel from your RX code with the .GetEnum() function on your DBC signal. To make it work the DBC signal must have a value table (vt) assigned to it and the target channel must have the same vt assigned as Data Type (might also work by creating an enumeration data type identical to the vt but usually it is more convenient to work directly with the vt as it allows discontinuity in the key values, unlike the enumeration).

If you are not working with Value Tables, then you have to get the value of your DBC signal (either raw unsigned, scaled, or whatever is corresponding to you need and setup) and assign it with the .Set() function.

Re: Enumeration on CAN Rx (DBC)

PostPosted: Thu Feb 27, 2025 2:19 pm
by adrian
If you are using Build version 1.4.3.263 or later .GetEnum() will be available if the signal you are receiving has an associated value table in the dbc file.

Re: Enumeration on CAN Rx (DBC)

PostPosted: Fri Feb 28, 2025 4:50 am
by bing
I am using 1.4.4.898, under Library it does not have CanComms.xxxEnum
Is it normal?

adrian wrote:If you are using Build version 1.4.3.263 or later .GetEnum() will be available if the signal you are receiving has an associated value table in the dbc file.

Re: Enumeration on CAN Rx (DBC)

PostPosted: Fri Feb 28, 2025 11:40 am
by adrian
Yes that's correct, you don't use the CANComms library if you are using dbc import.

If you go to Help>Manuals>Examples>DBC Import it details how to use the dbc import.