vector.com|Contact
Search tips

apple banana
Find rows that contain at least one of the two words.

+apple +juice
Find rows that contain both words.

+apple macintosh
Find rows that contain the word 'apple', but rank rows higher if they also contain 'macintosh'.

+apple -macintosh
Find rows that contain the word 'apple' but not 'macintosh'.

+apple ~macintosh
Find rows that contain the word 'apple', but if the row also contains the word 'macintosh', rate it lower than if row does not. This is "softer" than a search for '+apple -macintosh', for which the presence of 'macintosh' causes the row not to be returned at all.

+apple +(>turnover >strudel)
Find rows that contain the words 'apple' and 'turnover', or 'apple' and 'strudel' (in any order), but rank 'apple turnover' higher than 'apple strudel'.

apple*
Find rows that contain words such as 'apple', 'apples', 'applesauce', or 'applet'.

"some words"
Find rows that contain the exact phrase 'some words' (for example, rows that contain 'some words of wisdom' but not "some noise words").

By continuing to use this site you agree to the use of cookies. For more information and to find out how to change this click here. Accept Cookies
Please enable cookies in your browser for this website.
Search:
Advanced search

Setting Up a Gateway between Two CAN Busses

Last updated: 2019-12-12
Question:

How to set up a gateway between two CAN buses?

Answer:

A gateway is used to send messages from one bus to another bus and vice versa. A manipulation of signals is possible, sometimes signals are sent in different messages. A common use case is the integration of a new (next generation) ECU into an existing CAN bus replacing an older version of the ECU.

To set up the gateway, do the following:

Add a node in simulation setup for the first CAN network. Assign a .CAN file name and edit it. Here is an example:

on message CAN1.*
{
  message CAN2.* m;
  if(this.DIR==RX)        // if it is a received frame
  {
   if(this.CAN==1)
   {
    m=this;
    output(m);      // send it to the other channel
   }
  }
}

on message CAN2.*           
{
 message CAN1.* m;
 if(this.DIR==RX)        // if it is a received frame
 {
  if(this.CAN==2)
  {
   m=this;
   output(m);      // send it to the other channel
  }
 }
}

Then add another node in the simulation setup of the other network (here CAN2). Assign the same CAN file as for the first network (CAN1). In both network's simulation setup windows, the node block should carry a bridge icon (indicating the gateway).

In the above example all messages from CAN1 network are sent immediately to CAN2 network and vice versa.

If you want to manipulate a signal, you have to add an "on message..." event procedure for the message containing this signal, e.g.

on message CAN1.0x123
{
 message CAN2.0x123 m;
 // this is an example for a message that will be manipulated before it is sent on CAN2
 if (this.DIR==RX)           // if this message is received
 {
  if(this.CAN==1)
  {
   m=this;
   m.Byte(0)=0x17;     // for example manipulate the first byte
   m.Byte(1)=0x17;     // for example manipulate the second byte
   // you can use signal-based access as well:  m.SignalName = ....
   output(m);
  }
 }
}

Such a manipulation is possible for messages received on either bus, you have to adjust the "on message CANx.xxx" statement accordingly.

For more complex gateways, you may want to send signals received from one bus in messages with a different CAN ID on the other bus. In this case you have to store the received signal values for later sending in a timer-trigged event procedure.

 
Article Options
2019-12-12
Views: 1518