How can I continuously monitor more than one CAN signal in loop and activate a condition based on its value in CAPL?

25 Views Asked by At

I've created a loop cycle in CAPL that I'd like to follow step by step. The loop is running, and it must wait until the signal MAX_V does not reach 3.9. If it reaches 3.9, it will send some signal and after that it will go to second step or case.

    StartPowerCycle()
   {
  int i;

  for (i = 0; i <@sysvar::Panel::cycleNumber ; i++)
  {
    write("Loop number: %d", i+1);

        switch (step)
        
        {
          case 1:
            {
              if (Profile == 1 && $BAT_T >= 39.2)
              {
                msg3.Send_Coil.phys = 65280;
                output(msg3);
                while($Max_V >= 3.9) 
                {
                  msg3.Send_Coil_DC_Terminal.phys = 0; 
                  output(msg3);
                 }    
              }
            }
            
          case 2:
            {
              setTimer(Delay, 1800);
              write("Case %d",step);
      
            }

I tried this code, but it does not wait until the condition is met. could you please help us?

0

There are 0 best solutions below