⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 can.c

📁 xc164的双can的使用例程
💻 C
📖 第 1 页 / 共 5 页
字号:
  CAN_MSGDRL94   =  0x0000;      // load data register 4 low
  CAN_MSGDRH94   =  0x0000;      // load data register 4 high

  ///  - functionality of standard message object

  CAN_MSGFGCRL9  =  0x0000;      // load FIFO/gateway control register low
  CAN_MSGFGCRH9  =  0x0009;      // load FIFO/gateway control register high

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

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

  ///  - message object is used as receive object
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x000

  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

  ///  - functionality of standard message object

  CAN_MSGFGCRL10  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH10  =  0x000A;     // load FIFO/gateway control register high

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

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

  ///  - message object is used as receive object
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x00C

  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   =  0x0030;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL11  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH11  =  0x000B;     // load FIFO/gateway control register high

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

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

  ///  - message object is used as receive object
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x00D

  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   =  0x0034;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL12  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH12  =  0x000C;     // load FIFO/gateway control register high

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

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

  ///  - message object is used as receive object
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x00E

  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   =  0x0038;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL13  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH13  =  0x000D;     // load FIFO/gateway control register high

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

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

  ///  - message object is used as receive object
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x00F

  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   =  0x003C;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL14  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH14  =  0x000E;     // load FIFO/gateway control register high

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

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

  ///  - message object is used as receive object
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x010

  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   =  0x0040;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL15  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH15  =  0x000F;     // load FIFO/gateway control register high

  CAN_MSGCTRH15  =  0x0000;      // load message control register high
  CAN_MSGCTRL15  =  0x5599;      // 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
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x011

  CAN_MSGAMRL16  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH16  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL16   =  0x0000;      // load arbitration register low
  CAN_MSGARH16   =  0x0044;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL16  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH16  =  0x0010;     // 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
  ///  - enable receive interrupt; bit INTPND is set after successfull 
  ///    reception of a frame

  ///  - message object is used as receive object
  ///  - standard 11-bit identifier
  ///  - 0 valid data bytes
  ///  - this message object works with CAN node A
  ///  - remote monitoring is disabled
  ///  - receive interrupt node pointer: TwinCAN SRN 0

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

  ///  - acceptance mask 11-bit: 0x7FF
  ///  - identifier 11-bit:      0x012

  CAN_MSGAMRL17  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH17  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL17   =  0x0000;      // load arbitration register low
  CAN_MSGARH17   =  0x0048;      // load arbitration register high
  CAN_MSGDRL170  =  0x0000;      // load data register 0 low
  CAN_MSGDRH170  =  0x0000;      // load data register 0 high

⌨️ 快捷键说明

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