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

📄 can.c

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

  ///  - functionality of standard message object

  CAN_MSGFGCRL17  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH17  =  0x0011;     // load FIFO/gateway control register high

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

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

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

  CAN_MSGAMRL18  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH18  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL18   =  0x0000;      // load arbitration register low
  CAN_MSGARH18   =  0x004C;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL18  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH18  =  0x0012;     // load FIFO/gateway control register high

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

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

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

  CAN_MSGAMRL19  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH19  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL19   =  0x0000;      // load arbitration register low
  CAN_MSGARH19   =  0x0050;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL19  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH19  =  0x0013;     // load FIFO/gateway control register high

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

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

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

  CAN_MSGAMRL20  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH20  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL20   =  0x0000;      // load arbitration register low
  CAN_MSGARH20   =  0x0054;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL20  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH20  =  0x0014;     // load FIFO/gateway control register high

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

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

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

  CAN_MSGAMRL21  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH21  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL21   =  0x0000;      // load arbitration register low
  CAN_MSGARH21   =  0x0058;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL21  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH21  =  0x0015;     // load FIFO/gateway control register high

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

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

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

  CAN_MSGAMRL22  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH22  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL22   =  0x0000;      // load arbitration register low
  CAN_MSGARH22   =  0x005C;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL22  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH22  =  0x0016;     // load FIFO/gateway control register high

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

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

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

  CAN_MSGAMRL23  =  0xFFFF;      // load acceptance mask register low
  CAN_MSGAMRH23  =  0xFFFF;      // load acceptance mask register high
  CAN_MSGARL23   =  0x0000;      // load arbitration register low
  CAN_MSGARH23   =  0x0060;      // 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

  ///  - functionality of standard message object

  CAN_MSGFGCRL23  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH23  =  0x0017;     // load FIFO/gateway control register high

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

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 24:
  ///  -----------------------------------------------------------------------
  ///  - message object 24 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_MSGCFGL24  =  0x0000;      // load message configuration register low
  CAN_MSGCFGH24  =  0x0000;      // load message configuration register high

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

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

  ///  - functionality of standard message object

  CAN_MSGFGCRL24  =  0x0000;     // load FIFO/gateway control register low
  CAN_MSGFGCRH24  =  0x0018;     // load FIFO/gateway control register high

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

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 25:
  ///  -----------------------------------------------------------------------
  ///  - message object 25 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_MSGCFGL25  =  0x0000;      // load message configuration register low
  CAN_MSGCFGH25  =  0x0000;      // load message configuration register high

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

  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   =  0x0068;      // load arbitration register high
  CAN_MSGDRL250  =  0x0000;      // load data register 0 low
  CAN_MSGDRH250  =  0x0000;      // load data register 0 high

⌨️ 快捷键说明

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