Delay function in CAPL

0down votefavorite

I have a CAPL test node that controls a GPIB power supply. This CAPL generates a signal that is modified each 3 ms. My CAPL looks like this:

...
testcase wavGenerator()
{
   GPIBWrite(myDevice, "VOLT", voltValue);
   testwaitfortimeout(3);
   ...
}

The problem is that this testwaitfortimeout() function generates a comment in the test report, and since i use this function 2000/3000 times for each testcase, I end with a enormous test report.

I have tried implementing a function to generate a "delay" like waitfortimeout() does, like this:

void delay(int ms)
{
   float refTime;
   refTime = timeNowFloat();
   while(timeNowFloat() < (refTime + ms*100))
   {
      /* Wait to reach expected time*/
   }
}

but this crashes CANoe. I have tried something like this with setTimer() functions but the problem is the same. How can I generate this delay?

capl canoe

shareimprove this question

asked Dec 13 '17 at 23:21

PySerial Killer

14019

add a comment

2 Answers

activeoldestvotes

up vote2down vote

One idea could be to use a timer:

variables
{
  msTimer myTimer;
}

testcase wavGenerator()
{
  GPIBWrite(myDevice, "VOLT", voltValue);
  setTimer(myTimer, 3);
}

on timer myTimer
{
  // your code
}

Alternatively you can always create a custom style-sheet (XSLT) that filters all calls to testwaitfortimeout from the report.

shareimprove this answer

answered Dec 15 '17 at 14:44

PiranhA

1365

add a comment

 

up vote0down vote

I found a way to deal with this, using a timer, an EnvVar and the function testWaitForEnvVar()

on timer tDelay
{
  @EnvDelayFunct = 1;
}

void delay(int ms)
{
  write("Wait for %i ms", ms);
  int a;
  setTimer(tDelay, ms);
  a = testWaitForEnvVar(EnvDelayFunct, 0);
  @EnvDelayFunct = 0;
}

shareimprove this answer

  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值