can.c

来自「INFINEON公司弹片机XC164源码示例,CAN总线通讯初始化和应用代码示例」· C语言 代码 · 共 1,511 行 · 第 1/5 页

C
1,511
字号
  CAN_MSGDRH14   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO slave object connected to the 
  ///    base object 0
  ///  - the CANPTR is updated after a correct reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL1  =  0x0007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH1  =  0x0300;      // load FIFO/gateway control register high

  CAN_MSGCTRH1   =  0x0000;      // load message control register high
  CAN_MSGCTRL1   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 2:
  ///  -----------------------------------------------------------------------
  ///  - message object 2 is valid

  ///  - message object is used as receive object
  ///  - extended 29-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL2   =  0x0004;      // load message configuration register low

  CAN_MSGCFGH2   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0x0000
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL2   =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH2   =  0xE000;      // load acceptance mask register high
  CAN_MSGARL2    =  0x0000;      // load arbitration register low
  CAN_MSGARH2    =  0x0000;      // load arbitration register high
  CAN_MSGDRL20   =  0x0000;      // load data register 0 low
  CAN_MSGDRH20   =  0x0000;      // load data register 0 high
  CAN_MSGDRL24   =  0x0000;      // load data register 4 low
  CAN_MSGDRH24   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO slave object connected to the 
  ///    base object 0
  ///  - the CANPTR is updated after a correct reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL2  =  0x0007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH2  =  0x0300;      // load FIFO/gateway control register high

  CAN_MSGCTRH2   =  0x0000;      // load message control register high
  CAN_MSGCTRL2   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 3:
  ///  -----------------------------------------------------------------------
  ///  - message object 3 is valid

  ///  - message object is used as receive object
  ///  - extended 29-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL3   =  0x0004;      // load message configuration register low

  CAN_MSGCFGH3   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0x0000
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL3   =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH3   =  0xE000;      // load acceptance mask register high
  CAN_MSGARL3    =  0x0000;      // load arbitration register low
  CAN_MSGARH3    =  0x0000;      // load arbitration register high
  CAN_MSGDRL30   =  0x0000;      // load data register 0 low
  CAN_MSGDRH30   =  0x0000;      // load data register 0 high
  CAN_MSGDRL34   =  0x0000;      // load data register 4 low
  CAN_MSGDRH34   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO slave object connected to the 
  ///    base object 0
  ///  - the CANPTR is updated after a correct reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL3  =  0x0007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH3  =  0x0300;      // load FIFO/gateway control register high

  CAN_MSGCTRH3   =  0x0000;      // load message control register high
  CAN_MSGCTRL3   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 4:
  ///  -----------------------------------------------------------------------
  ///  - message object 4 is valid

  ///  - message object is used as receive object
  ///  - extended 29-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL4   =  0x0004;      // load message configuration register low

  CAN_MSGCFGH4   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0x0000
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL4   =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH4   =  0xE000;      // load acceptance mask register high
  CAN_MSGARL4    =  0x0000;      // load arbitration register low
  CAN_MSGARH4    =  0x0000;      // load arbitration register high
  CAN_MSGDRL40   =  0x0000;      // load data register 0 low
  CAN_MSGDRH40   =  0x0000;      // load data register 0 high
  CAN_MSGDRL44   =  0x0000;      // load data register 4 low
  CAN_MSGDRH44   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO slave object connected to the 
  ///    base object 0
  ///  - the CANPTR is updated after a correct reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL4  =  0x0007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH4  =  0x0300;      // load FIFO/gateway control register high

  CAN_MSGCTRH4   =  0x0000;      // load message control register high
  CAN_MSGCTRL4   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 5:
  ///  -----------------------------------------------------------------------
  ///  - message object 5 is valid

  ///  - message object is used as receive object
  ///  - extended 29-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL5   =  0x0004;      // load message configuration register low

  CAN_MSGCFGH5   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0x0000
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL5   =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH5   =  0xE000;      // load acceptance mask register high
  CAN_MSGARL5    =  0x0000;      // load arbitration register low
  CAN_MSGARH5    =  0x0000;      // load arbitration register high
  CAN_MSGDRL50   =  0x0000;      // load data register 0 low
  CAN_MSGDRH50   =  0x0000;      // load data register 0 high
  CAN_MSGDRL54   =  0x0000;      // load data register 4 low
  CAN_MSGDRH54   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO slave object connected to the 
  ///    base object 0
  ///  - the CANPTR is updated after a correct reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL5  =  0x0007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH5  =  0x0300;      // load FIFO/gateway control register high

  CAN_MSGCTRH5   =  0x0000;      // load message control register high
  CAN_MSGCTRL5   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 6:
  ///  -----------------------------------------------------------------------
  ///  - message object 6 is valid

  ///  - message object is used as receive object
  ///  - extended 29-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL6   =  0x0004;      // load message configuration register low

  CAN_MSGCFGH6   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0x0000
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL6   =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH6   =  0xE000;      // load acceptance mask register high
  CAN_MSGARL6    =  0x0000;      // load arbitration register low
  CAN_MSGARH6    =  0x0000;      // load arbitration register high
  CAN_MSGDRL60   =  0x0000;      // load data register 0 low
  CAN_MSGDRH60   =  0x0000;      // load data register 0 high
  CAN_MSGDRL64   =  0x0000;      // load data register 4 low
  CAN_MSGDRH64   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO slave object connected to the 
  ///    base object 0
  ///  - the CANPTR is updated after a correct reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL6  =  0x0007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH6  =  0x0300;      // load FIFO/gateway control register high

  CAN_MSGCTRH6   =  0x0000;      // load message control register high
  CAN_MSGCTRL6   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 7:
  ///  -----------------------------------------------------------------------
  ///  - message object 7 is valid

  ///  - message object is used as receive object
  ///  - extended 29-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL7   =  0x0004;      // load message configuration register low

  CAN_MSGCFGH7   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0x0000
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL7   =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH7   =  0xE000;      // load acceptance mask register high
  CAN_MSGARL7    =  0x0000;      // load arbitration register low
  CAN_MSGARH7    =  0x0000;      // load arbitration register high
  CAN_MSGDRL70   =  0x0000;      // load data register 0 low
  CAN_MSGDRH70   =  0x0000;      // load data register 0 high
  CAN_MSGDRL74   =  0x0000;      // load data register 4 low
  CAN_MSGDRH74   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO slave object connected to the 
  ///    base object 0
  ///  - the CANPTR is updated after a correct reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL7  =  0x0007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH7  =  0x0300;      // load FIFO/gateway control register high

  CAN_MSGCTRH7   =  0x0000;      // load message control register high
  CAN_MSGCTRL7   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 8:
  ///  -----------------------------------------------------------------------
  ///  - message object 8 is valid

  ///  - message object is used as transmit object
  ///  - extended 29-bit identifier
  ///  - 8 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL8   =  0x008C;      // load message configuration register low

  CAN_MSGCFGH8   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0xFFFF
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL8   =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH8   =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL8    =  0x0000;      // load arbitration register low
  CAN_MSGARH8    =  0x0000;      // load arbitration register high
  CAN_MSGDRL80   =  0x0000;      // load data register 0 low
  CAN_MSGDRH80   =  0x0000;      // load data register 0 high
  CAN_MSGDRL84   =  0x0000;      // load data register 4 low
  CAN_MSGDRH84   =  0x0000;      // load data register 4 high

  ///  - FIFO functionality; this is a FIFO base object for a 8 stage FIF0
  ///  - the CANPTR is updated after a correct transmission of a frame (FIFO 
  ///    transmission)

  CAN_MSGFGCRL8  =  0x2007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH8  =  0x0208;      // load FIFO/gateway control register high

  CAN_MSGCTRH8   =  0x0000;      // load message control register high
  CAN_MSGCTRL8   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 9:
  ///  -----------------------------------------------------------------------
  ///  - message object 9 is valid

  ///  - message object is used as transmit object
  ///  - extended 29-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled

  CAN_MSGCFGL9   =  0x000C;      // load message configuration register low

  CAN_MSGCFGH9   =  0x0000;      // load message configuration register high

  ///  - acceptance mask 29-bit: 0xFFFF
  ///  - identifier 29-bit:      0x0000

  CAN_MSGAMRL9   =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH9   =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL9    =  0x0000;      // load arbitration register low
  CAN_MSGARH9    =  0x0000;      // load arbitration register high
  CAN_MSGDRL90   =  0x0000;      // load data register 0 low
  CAN_MSGDRH90   =  0x0000;      // load data register 0 high
  CAN_MSGDRL94   =  0x0000;      // load data register 4 low

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?