使用 'on message' 在 CAPL 中的 .byte(1) 中查找消息

问题描述

例如,我需要在总线中找到 byte(1) 的消息 0x02。

当我使用

on message 0x02
{
}

像吗?

on message *
{
   if(this.id==0x02)
   {
   }
}

然后我如何使用 .byte(1) 的消息?

解决方法

你的第二段代码是正确的方法。

on message *
{
   if(this.id == 0x02)
   {
      write("%x",this.byte(1));
   }
}

如上所示,您甚至可以将 .byte(1) 用于 this 关键字。