LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN problem, need modified version of ncReadNet.vi in nican.llb

CAN messages that I have to read from a controller use Extended Frame Format. An example follows:

Messages greater than eight bytes are sent using multiple frames of data. The first frame specifies the length of data in bytes and the CRC value associated with the message.

      Data:               [0]    [1]    [2]    [3]    [4]     [5]    [6]    [7] 

                    Lgh  

1A900002      8      2      0      0      0      82     A      0      0     (4th frame)

1A900001      8      1      1      2      8       3      1      2       0    (3rd frame)

1A900000      8      B4    1E   3      0      85     8     14      0     (2nd frame)

1A900000      8      14     0     0      0       0      0     36     43    (1st frame)     data lgh = 0x14      crc = 0x4336

 

So with the attached VI 0x0A80000 is used to get the above message

So for example if I want to get Data[4] and Data[5] of 1A900002 above, the response, for example 1A900002 is used as shown in the attached VI, and this works as expected. The output, Fault No. is A82

Acquiring the CRC in the first frame of x4336 (Little Endian format) for example, also works using 1A900000 with Data[6] and Data[7]

Acquiring data from 1A900001 is also works as expected.

The problem is acquiring data from the 2nd frame, 1A900000 which has the same id as the 1st frame. The CAN function, ncReadNet.vi only allows 8 byte frames. I’m guessing that the only way that I can get data from the 2nd frame is if I had a CAN function that would let me get 16 bytes instead of only 8. Does anyone have any suggestions. Unfortunately the Controller is for an approved medical device and its software can’t be changed.

Thank you.

0 Kudos
Message 1 of 2
(3,098 Views)

Chuck,

 

What is the behavior you are seeing? This code looks to me like it will send out a frame with ID A800000 then read each frame that is returned. If your above sequenced is put on the bus, I would expect this loop to run 4 times (once per frame) and output a Fault No. for each frame for 0.1 seconds. So using the expression there I would expect Faul No. to cycle through these values:

- x0000

- x0885

- x0103

- x0A82

 

You would not have 16 bytes on one frame with a certain Arb ID. You would have 2 seperate frames, 8 bytes each,  with the same Arb ID.

 

Is this not what you are seeing? It may be helpful to output an array of all the Fault No.'s like this:

 can.png

 

Another helpful tool would be the NI-CAN Bus Monitor. This will let you easily monitor all the traffic on the CAN bus. Note that you cannot run the Bus Monitor and access the same CAN port from LabVIEW at the same time.

 

Let me know what you are seeing on your end.

---

Peter Flores
Applications Engineer
0 Kudos
Message 2 of 2
(3,077 Views)