Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN periodic messages

My problem is that when using channels it seems that the channel identification has to be in a particular order when making a message, due to sending an array of data to cover the channels. As in, if I have one particular byte that is a channel that I want to change, and there's another channel in the same message that I want to change, they have to be sent in sequential order or I get a "not a valid channel" error. This is when there are other channels that may be in the message as well. I want to be able to send an update for a specific channel(s) without having to update the rest of the channels in that message which may fall inbetween.
There seems to be no example code for how to send periodic messages without sending in a loop to send t
he message, which eats up windows resources.
any help is appreciated.
0 Kudos
Message 1 of 3
(3,878 Views)
Hi,

I tested your VI. I don't think I understand exactly what you mean.

I created the two channel names you are using, with an additional dummy channel, in a single message (ABS config, vehicle reference speed). I changed the ordering and didn't get any errors. Could you give more information on the changes you make?

Also, I only used the two channels you included. The dummy channel is not used. Of course, a receiver might read the frame and assume that the dummy channel is being send. A message is a single CAN frame, which cannot be subdivided.

When using periodic output, you use the loop to keep the task active. In the example, you are configuring the interface to send the last sample until updated. In this case, until you call write, the sa
me frame is retransmitted without the host intervention. When a new value is detected the write VI is called.

BTW, I had to replace the array boolean operation to AND. That way if any of the element is false (not equal) the write is executed and the value is updated.

Hope this helps.

DiegoF
National Instruments
0 Kudos
Message 2 of 3
(3,878 Views)
I found the boolean and problem, took me a little while to notice why it wouldn't update correctly. I got a response from tech support that he didn't have the problem with messages either. I think that it saw a message with two channels and only two pieces of data being sent, which caused the error. Though when trying to send just one channel at a time it seems to work fine.
What I did was make 3 channels in one message, if you send out 1, then 2 like my program there does it works fine. But if I try to send channel 1 and 3 it errors that "can't find the channel in MAX, make sure the channel is named correctly".
I have broken down and now am going to resend all channels in a message when any one channel changes. Updating this the same way as my program ex
ample there it should not be too bad for sucking up windows resourses. Planning on making a seperate loop section to check each one of my messages to see what components changed.
Thanks for your input.
0 Kudos
Message 3 of 3
(3,878 Views)