CAN的过滤寄存器
Posted 旭日初扬
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CAN的过滤寄存器相关的知识,希望对你有一定的参考价值。
一、结构体函数与寄存器
typedef struct
{
uint16_t CAN_FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bitconfiguration, first one for a 16-bit configuration).This parameter can be a value between 0x0000 and 0xFFFF */指定寄存器的标识号 (32位配置的msb,第一个是16位配置的msb) 这个参数的取值在0x0000到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 */
指定过滤器标识号(32位配置的lsb, 16位配置的第二个lsb)。取值范围为0x0000 ~ 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 */
根据模式(32位配置的msb,第一个是16位配置的msb),指定过滤器掩码号或识别号。取值范围为0x0000 ~ 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 */
根据模式(32位配置的lsb(高16位), 16位配置的第二个lsb(低16位))指定过滤掩码号或识别号。取值范围为0x0000 ~ 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 */'
指定将分配给过滤器的FIFO(0或1)。该参数可以是@ref CAN_filter_FIFO的值
uint8_t CAN_FilterNumber; /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */指定将被初始化的筛选器。取值范围是0 ~ 13
uint8_t CAN_FilterMode; /*!< Specifies the filter mode to be initialized. This parameter can be a value of @ref CAN_filter_mode */
指定要初始化的筛选器模式。该参数可以是@ref CAN_filter_mode
uint8_t CAN_FilterScale; /*!< Specifies the filter scale. This parameter can be a value of @ref CAN_filter_scale */
指定筛选器比例。该参数可以是@ref CAN_filter_scale
FunctionalState CAN_FilterActivation; /*!< Enable or disable the filter. This parameter can be set either to ENABLE or DISABLE. */
启用或禁用过滤器。该参数可设置为“启用”或“禁用”。
} CAN_FilterInitTypeDef;
typedef struct
{
__IO uint32_t MCR;
__IO uint32_t MSR;
__IO uint32_t TSR;
__IO uint32_t RF0R;
__IO uint32_t RF1R;
__IO uint32_t IER;
__IO uint32_t ESR;
__IO uint32_t BTR;
uint32_t RESERVED0[88];
CAN_TxMailBox_TypeDef sTxMailBox[3];
CAN_FIFOMailBox_TypeDef sFIFOMailBox[2];
uint32_t RESERVED1[12];
__IO uint32_t FMR;
__IO uint32_t FM1R;
uint32_t RESERVED2;
__IO uint32_t FS1R;
uint32_t RESERVED3;
__IO uint32_t FFA1R;
uint32_t RESERVED4;
__IO uint32_t FA1R;
uint32_t RESERVED5[8];
#ifndef STM32F10X_CL // 条件编译
CAN_FilterRegister_TypeDef sFilterRegister[14];
#else
CAN_FilterRegister_TypeDef sFilterRegister[28];
#endif /* STM32F10X_CL */
} CAN_TypeDef;
CAN_FilterInitTypeDef CAN_FilterInitStructure;
CAN_FilterInitStructure.CAN_FilterNumber=0; //过滤器0
CAN_FilterInitStructure.CAN_FilterMode=CAN_FilterMode_IdMask;
CAN_FilterInitStructure.CAN_FilterScale=CAN_FilterScale_32bit; //32位
CAN_FilterInitStructure.CAN_FilterIdHigh=0x0000;32位ID
CAN_FilterInitStructure.CAN_FilterIdLow=0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh=0x0000;//32位MASK
CAN_FilterInitStructure.CAN_FilterMaskIdLow=0x0000;
CAN_FilterInitStructure.CAN_FilterFIFOAssignment=CAN_Filter_FIFO0;//过滤器0关联到FIFO0
CAN_FilterInitStructure.CAN_FilterActivation=ENABLE; //激活过滤器0
CAN_FilterInit(&CAN_FilterInitStructure);//滤波器初始化
以上是关于CAN的过滤寄存器的主要内容,如果未能解决你的问题,请参考以下文章
java.util.MissingResourceException: Can't find bundle for base name init, locale zh_CN问题的处理(代码片段