copy data from CAN Chanel 1 and send that data in CAN chanel 2 using CAPL

Status
Not open for further replies.

GaneshM

Newbie level 2
Joined
Aug 21, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
40
"copy data from CAN Chanel 1 and send that data in CAN chanel 2 using CAPL". Hi all, I am at Starting level of CAPL programming.. i faced this question in my interview , could you please help in this?

Thanks in Advance
 

hi Ganesh,

This might be helpful


Code:
variables
{
message output_msg_name output_msg_obj;
int i;
}

on message CAN1.input_msg_name
{
  input_msg_name in_msg_obj;
  in_msg_obj = this;
  output_msg_obj.dlc = in_msg_obj.dlc;     // populate the dlc field for the output message
  output_msg_obj.CAN = 2;                     // Assign CAN Channel to the Output message
  for(i = 0; i< in_msg_obj.dlc ; i++)
   {  
      output_msg_obj.byte[i] = in_msg_obj.byte[i];    // Copy the Data in the input message received.
   }

 output(output_msg_obj);

}

Lemme know if this helps.

Thanks .
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…