1

I need to access the values of several signals in order to calculate their total value. I also need to compare the value of a signal to a constant value for use in an if statement e.g.

on timer msTimer100
{ 
  if(msg1.Sig1 < 23)
  {
    x=1;
  }
  else 
  {
    x=0;
  }
}

However I get the operand not compatible in the if statement. I have also tried putting a $ sign in as $msg1.Sig1, however I get an error saying 'Service signal not found in database' despite that signal being present in the database. Any ideas?

MSpiller
  • 3,500
  • 2
  • 12
  • 24
A Kerr
  • 11
  • 2
  • The documentation says the syntax is `$message_name::signal_name`. Did you try that? – MSpiller Mar 11 '20 at 10:42
  • Yes, i get an error saying 'Signal oriented CAPL is not allowed within the current context'. – A Kerr Mar 11 '20 at 14:03
  • With CANoe open and the configuration loaded and saved, try importing the Configuration in your CAPL Browser instance. See toolbar menu for the relevant option. This scenario can happen if the CAPL Browser is opened independently of the CANoe configuration. Please let me know – Daemon Painter Mar 16 '20 at 09:03

1 Answers1

0

The correct syntax to access a signal is $message_name::signal_name.
You are getting the error 'Signal oriented CAPL is not allowed within the current context' probably because you are not using this code in a node and the node should be having Interaction Layer (CANoe IL) enabled.
Try the following :

  1. Add your code to a node in the simulation setup.
  2. Enable CANoe Interaction Layer - You can find more info about this in the Help.
  3. Use the syntax $message_name::signal_name to access the signal values.

Note: The syntax gives the current value in the bus only if its a simulated signal. This does not work for received (Rx) signals.

Shyam
  • 649
  • 1
  • 5
  • 20