LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read CAN Frames

Solved!
Go to solution

Hi NI Forum,

 

I am using the NI CAN API to read CAN frames from the bus, this works fairly good. 

I now would like to convert this raw data with an dbc file to an actuall Engineering Unit. I have used Xnet before to import an dbc file and read specific massages. I tried to use the xnet converter vi and Frame to Signal vi  to convert raw data to a signal. I could not get it working is there another easier way to get the actuall values from the dbc file?

I attached my vi.

Thanks for your help

Martin

0 Kudos
Message 1 of 7
(7,466 Views)

Man wouldn't it be nice if there were a simple to use API that you provide the DBC, and signals, and frames to convert, and it returns the engineering units?  And if someone made such a cool tool for free I would feel like I owed that person a beer.

 

https://decibel.ni.com/content/docs/DOC-39793

 

If your hardware is an XNET device I'd recommend using the XNET library, but if not then I recommend using XNET conversion.

0 Kudos
Message 2 of 7
(7,429 Views)

Hi Hooovahh,

 

yes that would be great and thanks for this VI. 
I used this API in my vi the problem is If i read the CAN Data with the ncReadNETMult.Vi the output is not matching the xnet Frame conversion or your CAN Frame Signal Conversion input. I attached my vi in the first email.

How can I use your API with the ncReadNetMult.vi? if i get this working I will sent you a sixpack of beer.

Thanks a lot.

Martin

0 Kudos
Message 3 of 7
(7,413 Views)

Okay try this.  When you do a read you get a 1D array of frames, so use a for loop to convert from one frame format to the other.  Then do the conversion on all frames you happen to read.  This doens't handle extended messages well, you can add code to help with that.  And your wait timer seems a bit low, you may want to make it higher if the messages you want to see aren't sent once every 10ms or faster.

0 Kudos
Message 4 of 7
(7,399 Views)

Hooovahh this allready looks better but i get an error massage when i run the test:

 

Error -1074384737 occurred at XNET Convert (Frame CAN to Signal).vi:4090001

Possible reason(s):

NI-XNET: (Hex 0xBFF6309F) You wrote a frame whose payload length is larger than the maximum payload allowed by the database (e.g. wrote 10 bytes for CAN frame, max 8 bytes). Solution: Never write more payload bytes than the Payload Length Maximum property of the session.

 

The Data i am sending is just 1 byt long.

 

Thanks

0 Kudos
Message 5 of 7
(7,394 Views)

it looks like the payload is not transmitted in HEX value its decimal values  how do i change this. 

 

 

0 Kudos
Message 6 of 7
(7,388 Views)
Solution
Accepted by topic author DEGBM24

0x08 is the same as 0d08 formatting the display of the payload length is not your problem.  Your database says the payload is less than 8 bytes, but you provided 8 bytes from the frame that was read.  Either only provide the same number of bytes, or change your database to allow for 8 bytes of payload.

0 Kudos
Message 7 of 7
(7,355 Views)