03-09-2023 01:58 AM
Hi! All
Now I use "CAN" and want to send 8 commands in a program, among which 6 commands have the same frame ID. The following is part of the screenshot of my program. My problem now is that what I read is the result after the execution of the first command, and I want to see the result of the execution of the following commands. If not, do I have to break them down into steps using TestStand?The ID of the third through eighth commands must be 773.My program now has to loop through the first to third commands.Fourth to eighth command, just run it once, so for fourth to eighth command I used a parallel structure.
please help me. Thanky you.😭
Solved! Go to Solution.
03-09-2023 08:40 AM - edited 03-09-2023 08:40 AM
The idea of CAN is actually to use different IDs to be able to distinguish messages. If you send out 5 messages to ID 500 and the counterpart would reply using the same ID or a specific ID that is connected to 500, then the replies would also all have the same ID. You couldn't sort of to which of the 5 sent messages which reply belongs. The code you built is also asynchronous.
I would do it differently. The loops are only for sending and receiving, they don't define the ID. The ID and the related payload would be placed in variables outside of these two loops. The outer loop would this way define what to send and when.
03-09-2023 08:42 AM
It sounds like you have some kind of command and response API. For this you will likely want some of your code to be in series, where you send the command, and then wait for the specific response with some kind of timeout. Part 6 of my CAN blog goes over the multiple different XNet session types, which can help in waiting for various responses.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-09-2023 08:50 AM
Hi MaSta,
@MaSta wrote:
The idea of CAN is actually to use different IDs to be able to distinguish messages.
CAN allows for "multiplexing" messages. The CAN driver handles such messages by parsing the "multiplexer" value. So one ArbID can be used to transfer a large number of signal values…
I had to implement such messages just two weeks ago and now I know the (old) NI-CAN driver handles multiplexed messages off-the-shelf (when the DBC is well-defined)!
03-09-2023 09:06 AM - edited 03-09-2023 09:08 AM
XNet also handles multiplexed signals fairly well. However I found a few behaviors of it to what I would consider a bug. When I developed the Frame Signal conversion I changed the behavior of these conversions to be in line with what I thought they should be.
But still since OP was talking about seeing a response, I suspect they are doing something else like the ISO15765, UDS, KWP2000, or some other command response scheme.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord