can.c

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

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

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

  CAN_MSGFGCRL9  =  0x2007;      // load FIFO/gateway control register low
  CAN_MSGFGCRH9  =  0x0308;      // load FIFO/gateway control register high

  CAN_MSGCTRH9   =  0x0000;      // load message control register high
  CAN_MSGCTRL9   =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 10:
  ///  -----------------------------------------------------------------------
  ///  - message object 10 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_MSGCFGL10  =  0x000C;      // load message configuration register low

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

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

  CAN_MSGAMRL10  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH10  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL10   =  0x0000;      // load arbitration register low
  CAN_MSGARH10   =  0x0000;      // load arbitration register high
  CAN_MSGDRL100  =  0x0000;      // load data register 0 low
  CAN_MSGDRH100  =  0x0000;      // load data register 0 high
  CAN_MSGDRL104  =  0x0000;      // load data register 4 low
  CAN_MSGDRH104  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL10  =  0x2007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH10  =  0x0308;     // load FIFO/gateway control register high

  CAN_MSGCTRH10  =  0x0000;      // load message control register high
  CAN_MSGCTRL10  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 11:
  ///  -----------------------------------------------------------------------
  ///  - message object 11 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_MSGCFGL11  =  0x000C;      // load message configuration register low

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

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

  CAN_MSGAMRL11  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH11  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL11   =  0x0000;      // load arbitration register low
  CAN_MSGARH11   =  0x0000;      // load arbitration register high
  CAN_MSGDRL110  =  0x0000;      // load data register 0 low
  CAN_MSGDRH110  =  0x0000;      // load data register 0 high
  CAN_MSGDRL114  =  0x0000;      // load data register 4 low
  CAN_MSGDRH114  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL11  =  0x2007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH11  =  0x0308;     // load FIFO/gateway control register high

  CAN_MSGCTRH11  =  0x0000;      // load message control register high
  CAN_MSGCTRL11  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 12:
  ///  -----------------------------------------------------------------------
  ///  - message object 12 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_MSGCFGL12  =  0x000C;      // load message configuration register low

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

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

  CAN_MSGAMRL12  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH12  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL12   =  0x0000;      // load arbitration register low
  CAN_MSGARH12   =  0x0000;      // load arbitration register high
  CAN_MSGDRL120  =  0x0000;      // load data register 0 low
  CAN_MSGDRH120  =  0x0000;      // load data register 0 high
  CAN_MSGDRL124  =  0x0000;      // load data register 4 low
  CAN_MSGDRH124  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL12  =  0x2007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH12  =  0x0308;     // load FIFO/gateway control register high

  CAN_MSGCTRH12  =  0x0000;      // load message control register high
  CAN_MSGCTRL12  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 13:
  ///  -----------------------------------------------------------------------
  ///  - message object 13 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_MSGCFGL13  =  0x000C;      // load message configuration register low

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

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

  CAN_MSGAMRL13  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH13  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL13   =  0x0000;      // load arbitration register low
  CAN_MSGARH13   =  0x0000;      // load arbitration register high
  CAN_MSGDRL130  =  0x0000;      // load data register 0 low
  CAN_MSGDRH130  =  0x0000;      // load data register 0 high
  CAN_MSGDRL134  =  0x0000;      // load data register 4 low
  CAN_MSGDRH134  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL13  =  0x2007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH13  =  0x0308;     // load FIFO/gateway control register high

  CAN_MSGCTRH13  =  0x0000;      // load message control register high
  CAN_MSGCTRL13  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 14:
  ///  -----------------------------------------------------------------------
  ///  - message object 14 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_MSGCFGL14  =  0x000C;      // load message configuration register low

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

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

  CAN_MSGAMRL14  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH14  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL14   =  0x0000;      // load arbitration register low
  CAN_MSGARH14   =  0x0000;      // load arbitration register high
  CAN_MSGDRL140  =  0x0000;      // load data register 0 low
  CAN_MSGDRH140  =  0x0000;      // load data register 0 high
  CAN_MSGDRL144  =  0x0000;      // load data register 4 low
  CAN_MSGDRH144  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL14  =  0x2007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH14  =  0x0308;     // load FIFO/gateway control register high

  CAN_MSGCTRH14  =  0x0000;      // load message control register high
  CAN_MSGCTRL14  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 15:
  ///  -----------------------------------------------------------------------
  ///  - message object 15 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_MSGCFGL15  =  0x000C;      // load message configuration register low

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

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

  CAN_MSGAMRL15  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH15  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL15   =  0x0000;      // load arbitration register low
  CAN_MSGARH15   =  0x0000;      // load arbitration register high
  CAN_MSGDRL150  =  0x0000;      // load data register 0 low
  CAN_MSGDRH150  =  0x0000;      // load data register 0 high
  CAN_MSGDRL154  =  0x0000;      // load data register 4 low
  CAN_MSGDRH154  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL15  =  0x2007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH15  =  0x0308;     // load FIFO/gateway control register high

  CAN_MSGCTRH15  =  0x0000;      // load message control register high
  CAN_MSGCTRL15  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 16:
  ///  -----------------------------------------------------------------------
  ///  - message object 16 is valid
  ///  - enable receive interrupt; bit INTPND is set after successfull 
  ///    reception of a frame

  ///  - message object is used as receive object
  ///  - extended 29-bit identifier
  ///  - 8 valid data bytes
  ///  - this message object works with CAN node B
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

  CAN_MSGCFGL16  =  0x0086;      // load message configuration register low

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

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

  CAN_MSGAMRL16  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH16  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL16   =  0x0000;      // load arbitration register low
  CAN_MSGARH16   =  0x0000;      // load arbitration register high
  CAN_MSGDRL160  =  0x0000;      // load data register 0 low
  CAN_MSGDRH160  =  0x0000;      // load data register 0 high
  CAN_MSGDRL164  =  0x0000;      // load data register 4 low
  CAN_MSGDRH164  =  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 reception of a frame (FIFO 
  ///    reception)

  CAN_MSGFGCRL16  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH16  =  0x0210;     // load FIFO/gateway control register high

  CAN_MSGCTRH16  =  0x0000;      // load message control register high
  CAN_MSGCTRL16  =  0x5599;      // load message control register low

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

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

  CAN_MSGCFGL17  =  0x0006;      // load message configuration register low

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

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

  CAN_MSGAMRL17  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH17  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL17   =  0x0000;      // load arbitration register low
  CAN_MSGARH17   =  0x0000;      // load arbitration register high

⌨️ 快捷键说明

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