04-16-2015 10:20 PM
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
Solved! Go to Solution.
04-17-2015 11:11 AM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
04-17-2015 12:25 PM
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
04-17-2015 01:38 PM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
04-17-2015 02:41 PM
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
04-17-2015 04:25 PM
it looks like the payload is not transmitted in HEX value its decimal values how do i change this.
04-20-2015 07:12 AM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord