From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Breaking up a CAN Frame

I Have a Frame that I am trying to brake up 

The Frame contains an Array containing:  Time stamp, 64 bit pay load, CAN ID, Type and if extended.

I Need to extract just the 64 bit pay load but am not finding a good way to do it.

The 64 bit pay load contains 2 32 bit IEEE 745 floating point numbers.

I am using the example CAN FRAME INPUT STREAM.VI with data coming from a TI. Launch pad.

It is generating all the required data 

I have tried some of the ARRAY icons ARRAY SUBSET etc without any luck.

Anyone got a good idea 

 

0 Kudos
Message 1 of 4
(1,511 Views)
  1. Are you using a NI CAN interface and NI-CAN?
  2. Do you have the devices' "secrete decoder ring"  to decode the CAN frame?

Here's an example of a CAN bus "sniffer" I write for a Toshiba Lithium Battery pack. It should give you an idea of how to do it...

 

TCanMon.png

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(1,507 Views)

Thanks for the VI

The Bus is being handled by an NI-USB8502 which uses NI-XNET.

I found that I am having a little luck using the Delete From Array Icon then use the deleted output.

Next I need to split up the pay load into 2 32 bit binary sections.

0 Kudos
Message 3 of 4
(1,492 Views)

Hi John,

 


john@crane wrote:

Next I need to split up the pay load into 2 32 bit binary sections.


So the payload contains 8 bytes and you want to create 2 numbers from it.

Are those numbers integers, FXP or SGL entities? (SGL because of your other thread where you also forgot to provide useful information.)

 

You may use UnflattenFromString:

(You may also use a typedefined cluster instead of the SGL array constant…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(1,447 Views)