LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN BUS reading: Interfacing USB-8473 with LABVIEW

Solved!
Go to solution

I managed to sort out the Drivers by reinstalling the NI CAN and selecting LABVIEW 32 bit

 

I managed to monitor traffic in the CAN network using NI MAX, and CAN bus monitor. Below are the results.

 

NI MAX Bus MonitorNI MAX Bus Monitor

 

I am trying to replicate this on the LABVIEW. I will develop the logic to decipher from HEX to readable values with signal names.

 

But the issue now is that I can't see all of the Arbitration ID some ID's repeat. Not sure if it's my array size that is wrong or what.

 

My LABVIEW  VI AttemptMy LABVIEW VI Attempt

0 Kudos
Message 11 of 20
(1,580 Views)

Hi Kulani,

 


@Kulani93 wrote:

But the issue now is that I can't see all of the Arbitration ID some ID's repeat. Not sure if it's my array size that is wrong or what.


In the bus monitor you see the "sample rate" of those messages: they vary from ~20 to ~200Hz!

So why do you wonder you receive the same ArbID repeatedly?

 

You have initialized the array size to "31 rows" and there are 31 rows shown on your UI. Coincidence?

 

Btw. what kind of ECU is this? (Which vehicle?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 12 of 20
(1,575 Views)

Wow yes, you are right, the CAN messages are at different speeds.

 

I am reading random signals just to check if the hardware works.

 

We are using the OpenECU M580 by Pi-Innovo to use a controller for our control system that we are developing.

 

I have just set the array size to what I saw would be monitor.

 

What would be the correct logic to read these CAN messages?

0 Kudos
Message 13 of 20
(1,570 Views)

I can see now that if I am reading at 200 Hz or every 5 ms, I get 4 signals in the array because they are the ones updating the fast, then as soon as the 2nd fastest signals broadcast, they get append in the array as well and so on.

 

So the way I have designed my VI, will not allow me to see them as in the Bus Monitor.

 

Not sure what to do now.

 

Edit: I also have my Attribute block to Read Entries Pending. Which might prioritize faster signals. 

0 Kudos
Message 14 of 20
(1,566 Views)

Hi Kulani,

 


@Kulani93 wrote:

So the way I have designed my VI, will not allow me to see them as in the Bus Monitor.


Your VI only shows the latest messages.

The busmonitor shows the value of the last message per ArbID and some statistics, like number of received messages per ArbID and their rate. This is different/more than your VI is doing right now…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 15 of 20
(1,556 Views)

Thank you much.

 

How can I make work similar to the Bus Monitor? Make it show and keep the last message per ArbID?

0 Kudos
Message 16 of 20
(1,553 Views)

@Kulani93 wrote:

Thank you much.

 

How can I make work similar to the Bus Monitor? Make it show and keep the last message per ArbID?


The Producer/Consumer example is what I would recommend.

 

But in general to do a scrolling Table (a Table in LabVIEW is just Fancy String Array)  you need to use shift registers on your loop and Build Array to append each iteration to the Table (array).

 

Don't forget to limit the maximum Table (array) size or you will end up with a memory leak as the Table (array) grows.

 

========================
=== Engineer Ambiguously ===
========================
Message 17 of 20
(1,546 Views)

I struggle to recognise some of the APIs used in Indexing the enquired data.

 

Would you be able to upload your VI for me to see?

0 Kudos
Message 18 of 20
(1,530 Views)

Sure, here's one for a Toshiba lithium ion battery pack.

 

It requires the NI-CAN package to be installed.

 

 

========================
=== Engineer Ambiguously ===
========================
Message 19 of 20
(1,506 Views)

Hi all.

 

I am using the USB 8473 and Frame API (instead of CAN API) because it seems to be the one with the most support by my device.

 

I need to be able to decode the data from my can line, and I saw that I can just config this on NI MAX CAN Channel properties. Link:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000PAMISA4&l=en-ZA

 

How do I then integrate this into my VI?

 

Screenshot 2022-10-06 080754.jpg

0 Kudos
Message 20 of 20
(1,444 Views)