Canbus ID filter and mask

CAN总线是一种无冲突的两线半双工总线系统,所有节点接收所有广播数据并判断是否相关。通过接受过滤器和屏蔽值,硬件实现对不需要的消息进行过滤。过滤器和屏蔽值用于决定接收到的帧标识符中哪些位需要比较。如果屏蔽位为0,则对应的ID位自动接受;如果屏蔽位为1,只有当该位与过滤器位匹配时才接受帧。通过设置不同的过滤器和屏蔽值,可以实现不同范围的帧ID接受策略。

Canbus ID filter and mask 

CANBUS is a two-wire, half-duplex, bus based LAN system that is ‘collision free’.

Data is BROADCAST onto the bus -THERE IS NO SUCH THNG AS A POINT TO POINT CONNECTION as with data LANs.

All nodes receive all broadcast data and decide whether or not that data is relevant.

A CANBUS B frame consists of a four byte header (containing a 29-bit identifier), followed by up to 8 data bytes.

A receiving node would examine the identifier to decide if it was relevant (e.g. waiting for a frame with ID 00001567 which contains data to switch on or off a motor).

It could do this via software (using a C if or case statement); in practice the Canbus interface contains firmware to carry out this task

using the acceptance filter and mask value to filter out unwanted messages.

The filter mask is used to determine which bits in the identifier of the received frame are compared with the filter

  • If a mask bit is set to a zero, the corresponding ID bit will automatically be accepted, regardless of the value of the filter bit.

  • If a mask bit is set to a one, the corresponding ID bit will be compare with the value of the filter bit;
    if they match it is accepted otherwise the frame is rejected.
     

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值