CAN控制器的Mask
在使用CAN控制器接受数据的时候,会需要通过硬件屏蔽功能将不需要的数据给筛除。主要是通过将Code作为标准ID号,Mask作为筛查器
的kavaser的CAN控制器的help中这么写的
Code
This is a value where a ‘1’ in its binary representation means ‘the corresponding bit in the Code is significant’ and a ‘0’ means ‘the corresponding bit in the Code is not significant’.
其中二进制表示中的“1”表示“代码中对应的位是重要的,必须和Code完全一致”,“0”表示“代码中对应的位不重要”。
注意:需要先把该数字转换为二进制
Mask
This is a value where a significant ‘1’ in its binary representation means “accept the message if the corresponding bit in the message’s identifier is ‘1’”, and a signinficant ‘0’ means “accept the message if the corresponding bit in the message’s identifier is ‘0’”.
这是一个值,其中二进制表示中的有效“1”表示“如果消息标识符中的相应位为“1”,则接受该消息;符号“0”表示“如果消息标识符中的相应位为“0”,则接受该消息”。
注意:需要先把该数字转换为二进制
并且给出了一个例子.
Checking “Use Mask and Code”, and setting the (Standard) Mask to 0xFF and the (Standard) Code to 0x0F, will result in the accepting of all messages having an 11-bit identifier where the last eight bits are equal to 0x0F, for example, 0x00F, 0x10F, 0x20F, etc.
当Mask为FF,Code为0F,则10F、20F都可以显示出来