开发者

CAPL program in CANanalyzer 7.0 tool

开发者 https://www.devze.com 2023-03-17 19:24 出处:网络
开发者_JAVA技巧/*@@var:*/ variables { int a,b; mstimer ramky; } /*@@end*/ /*@@startStart:Start:*/ on start
开发者_JAVA技巧
/*@@var:*/
variables
{

int a,b;
mstimer ramky;
}
/*@@end*/

/*@@startStart:Start:*/
on start
{ settimer (ramky,500);
}
/*@@end*/

/*@@timer:ramky:*/
on timer ramky
{

write("timer was started");
}
/*@@end*/

/*@@key:'a':*/
on key 'a'
{
write("hey u have pressed the key a");
a=5;
b=51;
check();
}
/*@@end*/

/*@@caplFunc:check():*///function
check ()
{
for(;a<=50;a++)
write("a=%d b=%d",a,b);
write("a=%d b=%d",a,b);
//again();

}
/*@@end*/

/*@@caplFunc:again():*///function
again ()
{
while(a==b)
write(" and b are same");
}
/*@@end*/

this is the program in executed in the CANanlyzer 7.0 tool then my output was none and my pc was hanging so I want to know what will the reason for not giving the output? Is there any problem with in the program?


I see that CAPL script is not well establised. Here you set the timer first and then you are not resetting again. The variables declared in On key event should be done on global decleration section because you are not passing the varaiables as arguments in function call. probably code stucks when check() function is invoked.

0

精彩评论

暂无评论...
验证码 换一张
取 消