Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

how to respond to a message automatically upon receiving a message.

Hello,
 
Is there a way I can configure a CAN object where upon receiving a certain message the application will send a message automatically like a periodic message. One thing I can do to solve this problem is I can monitor all the frames comming from the port and upon receiving a certain message I can write the case structure to write a message. The problem I have is I want to do this in a seperate loop from my main application. In my main application I will be monitoring all the messages and doing other stuff. The response to the message is very critical thats why I want to do that in a seperate loop. If I do this response in a seperate loop then in my main loop I am loosing some of the messages as i am reading them in another loop. Please let me know what is the best way to solve this problem.  Thanks in advance.
 
Mudda.
0 Kudos
Message 1 of 8
(5,239 Views)

Hi Mudda,

You could receive all messages using a read mult in your main loop and a second loop to receive a certain ID (message) using a wait for the state  "read available" and a read object.

If the Id arrives process the message and send the answer using a write object and a waite for the state "write success" if it is the same ID, otherwise you have to create a second Object for a second ID.

This is possible because the driver creates different memories on the device for the Network Interface Object (all IDs) and certain objects (single IDs).

DirkW

Message 2 of 8
(5,230 Views)
Hello Dirk,
 
I appreciate for your feed back. I am new to the Lab View CAN. You said in your reply that I can create a waite for state. When I communicate with my controller all the messages are going to come with the same frame ID/Arbitration ID, is there a way I can waite for a particular message (specific data bytes)? Can I make an object with specific message or data bytes? with the examples VI's I was not able to make objects with same arbitration ID, is there a way around this? The reason why I am asking is if I need to send two periodic messages with same Arbitration ID I can't do that. I know I am deviating from the main question but your help is well appreciated.
 
Thanks,
 
Mudda.
0 Kudos
Message 3 of 8
(5,228 Views)
 

Hello Dirk,

I found something on the knowledge at the following link.

http://zone.ni.com/devzone/cda/epd/p/id/1284.

There are no comments on what function is doing what. Could you take a look at it and let me know whether this is something that can help me. If this helps can you add comments on what each function is doing.

Thanks,

Mudda.

0 Kudos
Message 4 of 8
(5,223 Views)

Hi Mudda,

The Link you found describes how to use the remote Frame Option to run a periodic receiving object. This is for sure nothing you can use with your situation.

CAN known this remote frames to trigger devices which are able to understand a remote Frame as a way to trigger a certain answer frame. A remote frame does not contain any data and has the same Id as the frame which is requested.

In your case if there is only one particular ID on the BUS  and you need to answer with the same ID twice in different rates? You could use two different ports for two objects with the same ID connected to the same BUS?

In order to receive a message with special content within the data bytes, you could configure a port to filter all incoming message using the ID and the data bytes as well. See the Filter example coming with the driver for more information.

DirkW

Message 5 of 8
(5,203 Views)

Hello Dirk,

Thanks for the information. I have so many questions regarding the CAN comunication. Is there any way I can contact you through phone? I have SSP if you are a NI application engineer.

Thanks,

Mudda.

0 Kudos
Message 6 of 8
(5,205 Views)
Hi Mudda,

No, iam not an application engineer but you could call the support. We have specialized AEs for industrial communication including CAN.
Iam sure they can help you the same way i can, if you try to explain as good as you can what what you want to achieve.

DirkW

0 Kudos
Message 7 of 8
(5,194 Views)
 

Hi Mudda,

Here is a link if you want to request phone support. I hope this helps!

Regards,

Missy S.
Project Engineer
RoviSys
0 Kudos
Message 8 of 8
(5,177 Views)