receive one Msg, send another Msg 0x0008

Hello everybody,

in the last days I was working more on other things, but now I just returned for some more small CAPL action.

For first time I had the problem to send a CAN Msg, when I receive another CAN-Msg (because for the moment, most of my diagnosis node based on: sending a request/Msg — data will be send (Request/Tx) and received (Response/Rx) via OSEK function–> analyze the Rx data)

I knew which data this should be (I looked for it in the trace), because I wanted to actively send it from a node as a substitute CAN frame for another node I deactivated, and where this signal originally comes from.

You can also find some help for this in the ‚ ProgrammingWithCAPL ‚ by chapter 11.3.

so lets say in trace I have seen, that I want to transmit data with ID 789, Data DLC is 4 and data is 0x01 0x02 0x03 0x04. Than one solution would be the following:

variables  /* declare Msg in the variables section */

{

message 0x789 myNewMsg = {dlc = 4};

}

on message TriggerMsg /*as you know, CAPL is not time- but event based. For trigger, in this case I choose another CAN Msg, that should be there if my new signal is also there; „on message“ is a CAPL function, „TriggerMsg“ is a example-name */

{

 myNewMsg.byte(0)= 0x01;

 myNewMsg.byte(1)= 0x02;

 myNewMsg.byte(2)= 0x03;

 myNewMsg.byte(3)= 0x04;

output(myNewMsg);

}

 

 

 

 

receive one Msg, send another Msg 0x0008

Hinterlasse einen Kommentar