CAN控制器的Mask相关解释

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都可以显示出来

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值