CAPL: display data of received message onto a GUI

637 Views Asked by At

I am new to CANoe/CAPL.

I am trying to display the data of the received message onto a GUI. This will be a message that is 64 bytes, so I would like multi-line support. Thus far, all I have seen as an option for multi-line GUI box is the "CAPL Output View".

For instance, if I receive a message from 0x01333DDC, 00 00 10 AC DD; I want 00 00 10 AC DD to be printed on the GUI input window. I also want multi-line printing as the messages are 64 bytes.

I have tried:

  1. Assign message.byte() to a system variable, then use PutValueToControl()
  2. PutValueToControl(messageXxX)

In all cases, all 0 values are returned on the CAPL output view, although message received through trace window actually shows that there are non-zero values in the message data.

Thank you in advance for any comments/help,

Edit: Below is my code. This is done on a real CAN bus (not simulated) as there is an ECU connected that sends the message. The message is configured to 64 bytes in size and named msg_DATA_REQ_REC. It is stored in a system variable of int array 64 bytes named DATA_REQ_REC.

I am trying to output the message data content into a CAPL output view named Rx_DATA on a panel named "MONITOR_PANEL". Also, an LED indicator (LED_REC) is set to blink when the message is received.

on message DATA_REQ_REC                //When when DATA_REQ is received from other ECU on CAN
{
  //store received message data into system variable DATA_REQ_REC
  for (i = 0; i < 64; i++)
  {
    @MONITOR_PANEL::DATA_REQ_REC[i] = msg_DATA_REQ_REC.byte(i);
  }
  putValueToControl("MONITOR_PANEL", "Rx_DATA", "\r \r");
  
  //If the first byte is empty
  if (@MONITOR_PANEL::DATA_REQ_REC[0] == 0x00)
  {
    //do nothing
  }else
  {
    //display all 64 bytes of data in DATA_REQ_REC
  for (i = 0; i < 64; i++)  
  {
   putValueToControl("MONITOR_PANEL", "Rx_DATA", @MONITOR_PANEL::DATA_REQ_REC[i]);
  }
    putValueToControl("MONITOR_PANEL", "Rx_DATA", "\r \r");*/
  }

//need to move LED activation into else statement if want to blink only for APDU_REQ with data
  @MONITOR_PANEL::LED_REC = 1;       //Turn on Data Indicator LED
  setTimer(Timer_LED_REC, 200);  //set LED timer  
}

on timer Timer_LED_REC
{
 @MONITOR_PANEL::LED_REC = 0;        //Turn off Data Indicator LED
}
0

There are 0 best solutions below