Enumeration on CAN Rx (DBC)

Support forum for users of the M1 Build

Enumeration on CAN Rx (DBC)

Postby bing on Tue Jan 14, 2025 12:35 pm

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,
bing
 
Posts: 42
Joined: Sun Aug 24, 2008 10:52 am

Re: Enumeration on CAN Rx (DBC)

Postby Loic on Fri Feb 14, 2025 11:25 pm

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.
Loic
 
Posts: 3
Joined: Mon Dec 04, 2023 10:08 pm

Re: Enumeration on CAN Rx (DBC)

Postby bing on Wed Feb 26, 2025 11:04 am

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.
bing
 
Posts: 42
Joined: Sun Aug 24, 2008 10:52 am

Re: Enumeration on CAN Rx (DBC)

Postby adrian on Thu Feb 27, 2025 2:19 pm

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.
adrian
MoTeC
 
Posts: 721
Joined: Mon Apr 13, 2015 5:16 pm

Re: Enumeration on CAN Rx (DBC)

Postby bing on Fri Feb 28, 2025 4:50 am

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.
bing
 
Posts: 42
Joined: Sun Aug 24, 2008 10:52 am

Re: Enumeration on CAN Rx (DBC)

Postby adrian on Fri Feb 28, 2025 11:40 am

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.
adrian
MoTeC
 
Posts: 721
Joined: Mon Apr 13, 2015 5:16 pm


Return to M1 Build

Who is online

Users browsing this forum: No registered users and 0 guests