04-23-2025 02:46 AM
Hello everyone,
I'm really new to Labview and XNET CAN vi. I'm trying to interface with a board through CAN bus and I have to configure and set some parameters. As hardware I'm using a CAN HS/FD Interface NI-XNET USB-8502 and Labview version is the 2024. In attachment the .vi file! I tried to navigate through the examples and web forums but I'm still confused, also because all the examples are real time one while I have to run a software almost automatically so that all DBC data have to be...let's say hidden inside the VI.
As you will see I need to send as output quite a lot messages: some represent 1 bit signals of a DBC file, others signals of 1 byte lenght and still others 8-bytes frames.
I have three different question for you (a lot I know but I'm really a newbie):
As it is shown in the image below, the CAN frame "CeiSetValues" is an 8-byte frame.
What I need to do is to put at 0 the final two bites so I "prepared" an array of 64 elements (well I actually think I did but I'm also not so sure it is correct) but this seems to be incorrect
because the Frame CAN sink needs (as it said) a 1D array of typedef 'XNET Frame CAN.ctl' cluster of 6 elements.
Now, what i didn't get is that it is asking for a cluster of 6 elements...I mean, it is a 8-byte frame, where this "6" comes from and why "cluster"? Except for that, I would also like to ask (this
is not trivial because I'm pretty sure that putting those bits at 0 is ok) if there is a way to leave "untouched" the firsts 6 bytes of the frame. I put them to 0 to and it shouldn't really change
anything otherwise the only thing that comes up to me is to make 16 signal-out sessions for the 2 last bytes (not elegant and a bit boring)
I would like to understand if it is possible to use the signal-single point write funciton and the constants array as I did.
I'm so sorry to ask you all this things, also because maybe those are stupid but I'm really in hurry and I cannot get lot of informations about CAN driver in Labview.
Any help will be much more than appreciated, and also any Labview tips.
Many thanks
04-23-2025 03:35 AM
Hi gcambie,
@gcambie88 wrote:
- First of all, when I try to manage frame signals I get the error: "These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match. Show the Context Help window to see what data type is required.
The type of the source is 1D array of
unsigned long [32-bit integer (0 to 4,294,967,295)].
The type of the sink is 1D array of
typedef 'XNET Frame CAN.ctl'
cluster of 6 elements."What I need to do is to put at 0 the final two bites so I "prepared" an array of 64 elements (well I actually think I did but I'm also not so sure it is correct) but this seems to be incorrect
because the Frame CAN sink needs (as it said) a 1D array of typedef 'XNET Frame CAN.ctl' cluster of 6 elements.
Now, what i didn't get is that it is asking for a cluster of 6 elements...I mean, it is a 8-byte frame, where this "6" comes from and why "cluster"?
That XNet function expects a cluster that defines a message frame. That cluster contains 6 elements, among them ArbID, timestamp and message payload data. You cannot wire a simple array of 8 bytes when you need to provide a full message frame!!!
04-23-2025 08:00 AM
I recommend you get familiar with those concepts:
Next to your question.
A few more advices to your VI:
06-12-2025 05:28 AM - edited 06-12-2025 05:30 AM
Many thanks Zyong!
I studied a litle bit and stood several things! Thank you for your advices!
Anyway, I am stuck with another issue which I really cannot go through. I would like to have a "IF CASE" for which the payload of a given frame is shown from the CAN stream. As it is shown in the pictures below, I would like to retrieve only 2 Frames from all over the CAN Cluster, which IDs are "1368" and "261" decimal.
The program works but as you can see, IDs and Payloads requested aren't shown ever even though I could see those frames to come into the table. I tried to switch one case in dec number thinking thta it could be the problem but nope...
And of course I'm selecting the ID and payload from Cluster table because if I put those indicators outside the case struct they show me all the stuff!
Anyone can help me understanding?
many thanks
06-13-2025 07:26 AM
This is what I usually do to keep the frames with the desired IDs.