OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3624|回复: 3

关于STM32_CAN

[复制链接]

19

主题

48

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
276
金钱
276
注册时间
2015-5-18
在线时间
26 小时
发表于 2016-4-26 17:20:04 | 显示全部楼层 |阅读模式
1金钱
        CAN1->sFilterRegister[0].FR1=0X00000000;//32位ID
        CAN1->sFilterRegister[0].FR2=0X00000000;//32位MASK

        在例程代码里我看到这两句没找到在哪定义的。我想问一下作用是什么?新手求教多谢。

最佳答案

查看完整内容[请看2#楼]

typedef struct { uint16_t CAN_FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit configuration, first one for a 16-bit configuration). This parameter can be a value between 0x0000 and 0xFFFF */ uint16_t CAN_FilterIdLow; /*!< Specifies the f ...
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

2

主题

391

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1957
金钱
1957
注册时间
2014-8-8
在线时间
307 小时
发表于 2016-4-26 17:20:05 | 显示全部楼层
冷枫漠然 发表于 2016-4-26 20:06
定义的这个结构体在哪???我没有找到呢???

typedef struct
{
  uint16_t CAN_FilterIdHigh;             /*!< Specifies the filter identification number (MSBs for a 32-bit
                                              configuration, first one for a 16-bit configuration).
                                              This parameter can be a value between 0x0000 and 0xFFFF */

  uint16_t CAN_FilterIdLow;              /*!< Specifies the filter identification number (LSBs for a 32-bit
                                              configuration, second one for a 16-bit configuration).
                                              This parameter can be a value between 0x0000 and 0xFFFF */

  uint16_t CAN_FilterMaskIdHigh;         /*!< Specifies the filter mask number or identification number,
                                              according to the mode (MSBs for a 32-bit configuration,
                                              first one for a 16-bit configuration).
                                              This parameter can be a value between 0x0000 and 0xFFFF */

  uint16_t CAN_FilterMaskIdLow;          /*!< Specifies the filter mask number or identification number,
                                              according to the mode (LSBs for a 32-bit configuration,
                                              second one for a 16-bit configuration).
                                              This parameter can be a value between 0x0000 and 0xFFFF */

  uint16_t CAN_FilterFIFOAssignment;     /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.
                                              This parameter can be a value of @ref CAN_filter_FIFO */
  
  uint8_t CAN_FilterNumber;              /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */

  uint8_t CAN_FilterMode;                /*!< Specifies the filter mode to be initialized.
                                              This parameter can be a value of @ref CAN_filter_mode */

  uint8_t CAN_FilterScale;               /*!< Specifies the filter scale.
                                              This parameter can be a value of @ref CAN_filter_scale */

  FunctionalState CAN_FilterActivation;  /*!< Enable or disable the filter.
                                              This parameter can be set either to ENABLE or DISABLE. */
} CAN_FilterInitTypeDef;
回复

使用道具 举报

2

主题

391

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1957
金钱
1957
注册时间
2014-8-8
在线时间
307 小时
发表于 2016-4-26 17:35:54 | 显示全部楼层
CAN1->sFilterRegister[0].FR1=0X00000000;//32位ID 是你需要接收的ID范围
  CAN1->sFilterRegister[0].FR2=0X00000000;//32位MASK 结合上面设置屏蔽其他地址范围的bit为1必须与FR1一致值才能通过,0表示无所谓与FR1是否一直,这样组合就可以实现过滤了。
回复

使用道具 举报

19

主题

48

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
276
金钱
276
注册时间
2015-5-18
在线时间
26 小时
 楼主| 发表于 2016-4-26 20:06:47 | 显示全部楼层
365mcu 发表于 2016-4-26 17:35
CAN1->sFilterRegister[0].FR1=0X00000000;//32位ID 是你需要接收的ID范围
  CAN1->sFilterRegister[0].FR ...

定义的这个结构体在哪???我没有找到呢???
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-2-27 02:07

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表