can.c

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

C
1,511
字号
  CAN_MSGDRL170  =  0x0000;      // load data register 0 low
  CAN_MSGDRH170  =  0x0000;      // load data register 0 high
  CAN_MSGDRL174  =  0x0000;      // load data register 4 low
  CAN_MSGDRH174  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL17  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH17  =  0x0310;     // load FIFO/gateway control register high

  CAN_MSGCTRH17  =  0x0000;      // load message control register high
  CAN_MSGCTRL17  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 18:
  ///  -----------------------------------------------------------------------
  ///  - message object 18 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_MSGCFGL18  =  0x0006;      // load message configuration register low

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

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

  CAN_MSGAMRL18  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH18  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL18   =  0x0000;      // load arbitration register low
  CAN_MSGARH18   =  0x0000;      // load arbitration register high
  CAN_MSGDRL180  =  0x0000;      // load data register 0 low
  CAN_MSGDRH180  =  0x0000;      // load data register 0 high
  CAN_MSGDRL184  =  0x0000;      // load data register 4 low
  CAN_MSGDRH184  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL18  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH18  =  0x0310;     // load FIFO/gateway control register high

  CAN_MSGCTRH18  =  0x0000;      // load message control register high
  CAN_MSGCTRL18  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 19:
  ///  -----------------------------------------------------------------------
  ///  - message object 19 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_MSGCFGL19  =  0x0006;      // load message configuration register low

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

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

  CAN_MSGAMRL19  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH19  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL19   =  0x0000;      // load arbitration register low
  CAN_MSGARH19   =  0x0000;      // load arbitration register high
  CAN_MSGDRL190  =  0x0000;      // load data register 0 low
  CAN_MSGDRH190  =  0x0000;      // load data register 0 high
  CAN_MSGDRL194  =  0x0000;      // load data register 4 low
  CAN_MSGDRH194  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL19  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH19  =  0x0310;     // load FIFO/gateway control register high

  CAN_MSGCTRH19  =  0x0000;      // load message control register high
  CAN_MSGCTRL19  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 20:
  ///  -----------------------------------------------------------------------
  ///  - message object 20 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_MSGCFGL20  =  0x0006;      // load message configuration register low

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

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

  CAN_MSGAMRL20  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH20  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL20   =  0x0000;      // load arbitration register low
  CAN_MSGARH20   =  0x0000;      // load arbitration register high
  CAN_MSGDRL200  =  0x0000;      // load data register 0 low
  CAN_MSGDRH200  =  0x0000;      // load data register 0 high
  CAN_MSGDRL204  =  0x0000;      // load data register 4 low
  CAN_MSGDRH204  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL20  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH20  =  0x0310;     // load FIFO/gateway control register high

  CAN_MSGCTRH20  =  0x0000;      // load message control register high
  CAN_MSGCTRL20  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 21:
  ///  -----------------------------------------------------------------------
  ///  - message object 21 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_MSGCFGL21  =  0x0006;      // load message configuration register low

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

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

  CAN_MSGAMRL21  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH21  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL21   =  0x0000;      // load arbitration register low
  CAN_MSGARH21   =  0x0000;      // load arbitration register high
  CAN_MSGDRL210  =  0x0000;      // load data register 0 low
  CAN_MSGDRH210  =  0x0000;      // load data register 0 high
  CAN_MSGDRL214  =  0x0000;      // load data register 4 low
  CAN_MSGDRH214  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL21  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH21  =  0x0310;     // load FIFO/gateway control register high

  CAN_MSGCTRH21  =  0x0000;      // load message control register high
  CAN_MSGCTRL21  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 22:
  ///  -----------------------------------------------------------------------
  ///  - message object 22 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_MSGCFGL22  =  0x0006;      // load message configuration register low

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

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

  CAN_MSGAMRL22  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH22  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL22   =  0x0000;      // load arbitration register low
  CAN_MSGARH22   =  0x0000;      // load arbitration register high
  CAN_MSGDRL220  =  0x0000;      // load data register 0 low
  CAN_MSGDRH220  =  0x0000;      // load data register 0 high
  CAN_MSGDRL224  =  0x0000;      // load data register 4 low
  CAN_MSGDRH224  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL22  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH22  =  0x0310;     // load FIFO/gateway control register high

  CAN_MSGCTRH22  =  0x0000;      // load message control register high
  CAN_MSGCTRL22  =  0x5595;      // load message control register low

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 23:
  ///  -----------------------------------------------------------------------
  ///  - message object 23 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_MSGCFGL23  =  0x0006;      // load message configuration register low

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

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

  CAN_MSGAMRL23  =  0x0000;      // load acceptance mask register low
  CAN_MSGAMRH23  =  0xE000;      // load acceptance mask register high
  CAN_MSGARL23   =  0x0000;      // load arbitration register low
  CAN_MSGARH23   =  0x0000;      // load arbitration register high
  CAN_MSGDRL230  =  0x0000;      // load data register 0 low
  CAN_MSGDRH230  =  0x0000;      // load data register 0 high
  CAN_MSGDRL234  =  0x0000;      // load data register 4 low
  CAN_MSGDRH234  =  0x0000;      // load data register 4 high

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

  CAN_MSGFGCRL23  =  0x0007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH23  =  0x0310;     // load FIFO/gateway control register high

  CAN_MSGCTRH23  =  0x0000;      // load message control register high
  CAN_MSGCTRL23  =  0x5595;      // load message control register low

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

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

  CAN_MSGCFGL24  =  0x008E;      // load message configuration register low

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

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

  CAN_MSGAMRL24  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH24  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL24   =  0x0000;      // load arbitration register low
  CAN_MSGARH24   =  0x0000;      // load arbitration register high
  CAN_MSGDRL240  =  0x0000;      // load data register 0 low
  CAN_MSGDRH240  =  0x0000;      // load data register 0 high
  CAN_MSGDRL244  =  0x0000;      // load data register 4 low
  CAN_MSGDRH244  =  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_MSGFGCRL24  =  0x2007;     // load FIFO/gateway control register low
  CAN_MSGFGCRH24  =  0x0218;     // load FIFO/gateway control register high

  CAN_MSGCTRH24  =  0x0000;      // load message control register high
  CAN_MSGCTRL24  =  0x5595;      // load message control register low

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

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

  CAN_MSGCFGL25  =  0x000E;      // load message configuration register low

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

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

  CAN_MSGAMRL25  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH25  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL25   =  0x0000;      // load arbitration register low
  CAN_MSGARH25   =  0x0000;      // load arbitration register high

⌨️ 快捷键说明

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