//****************************************************************************
// @Module        MultiCAN Controller 
// @Filename      CAN.C
// @Project       transceiver1.dav
//----------------------------------------------------------------------------
// @Controller    Infineon XC888CLM-8FF
//
// @Compiler      Keil
//
// @Codegenerator 1.1
//
// @Description:  This file contains functions that use the CAN module.
//
//----------------------------------------------------------------------------
// @Date          26.04.2007 15:38:20
//
//****************************************************************************

// USER CODE BEGIN (CAN_General,1)

// USER CODE END



//****************************************************************************
// @Project Includes
//****************************************************************************

#include "MAIN.H"

// USER CODE BEGIN (CAN_General,2)

// USER CODE END


//****************************************************************************
// @Macros
//****************************************************************************


// USER CODE BEGIN (CAN_General,3)

// USER CODE END


//****************************************************************************
// @Defines
//****************************************************************************

// USER CODE BEGIN (CAN_General,4)

// USER CODE END


//****************************************************************************
// @Typedefs
//****************************************************************************

// USER CODE BEGIN (CAN_General,5)

// USER CODE END


//****************************************************************************
// @Imported Global Variables
//****************************************************************************

// USER CODE BEGIN (CAN_General,6)

// USER CODE END


//****************************************************************************
// @Global Variables
//****************************************************************************


// USER CODE BEGIN (CAN_General,7)

// USER CODE END


//****************************************************************************
// @External Prototypes
//****************************************************************************

// USER CODE BEGIN (CAN_General,8)

// USER CODE END


//****************************************************************************
// @Prototypes Of Local Functions
//****************************************************************************

// USER CODE BEGIN (CAN_General,9)

// USER CODE END


//****************************************************************************
// @Function      void CAN_vInit(void) 
//
//----------------------------------------------------------------------------
// @Description   This is the initialization function of the CAN function 
//                library. It is assumed that the SFRs used by this library 
//                are in their reset state. 
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    None
//
//----------------------------------------------------------------------------
// @Date          26.04.2007
//
//****************************************************************************

// USER CODE BEGIN (Init,1)

// USER CODE END

void CAN_vInit(void)
{

  // USER CODE BEGIN (Init,2)

  // USER CODE END

  ///  -----------------------------------------------------------------------
  ///  Configuration of the Module Clock:
  ///  -----------------------------------------------------------------------
  ///  - the CAN module clock = 48,00 MHz
  ///  - FCLK runs at 2 times the frequency of PCLK.

  ///  - CMCON - Clock Control Register is Configured in MAIN_vInit

  //   - wait until Panel has finished the initialisation
    CAN_vWriteCANAddress(CAN_PANCTR); // Addressing CAN_PANCTR
    CAN_DATA1 = CAN_PANCTR_BUSY;
    while(CAN_DATA1 & CAN_PANCTR_BUSY){ // wait until Panel has finished the 
                                        // initialisation
      CAN_ADCON &= ~0x01;       
      }                         

  ///  -----------------------------------------------------------------------
  ///  Configuration of CAN Node 0:
  ///  -----------------------------------------------------------------------

  ///  General Configuration of the Node 0:
  ///  - set INIT and CCE

  //-----------CAN_NCR0 = 0x00000041-------------------------------------

    CAN_vWriteCANAddress(CAN_NCR0); // Addressing CAN_NCR0
    CAN_DATA0 = 0x41;            // load NODE 0 control register[7-0]
    CAN_vWriteEN(D0_VALID+ADR_INC); // Data0 is Valid for transmission and 
                                    // Write is EnabledCAN Address pointing 
                                    // to the CAN_NSR0.

  ///  -----------------------------------------------------------------------
  ///  Configuration of CAN Node 1:
  ///  -----------------------------------------------------------------------

  ///  General Configuration of the Node 1:
  ///  - set INIT and CCE

  //-----------CAN_NCR1 = 0x00000041-------------------------------------

    CAN_vWriteCANAddress(CAN_NCR1); // Addressing CAN_NCR1
    CAN_DATA0 = 0x41;            // load NODE 1 control register[7-0]
    CAN_vWriteEN(D0_VALID+ADR_INC); // Data0 is Valid for transmission and 
                                    // Write is EnabledCAN Address pointing 
                                    // to the CAN_NSR1.

  //  CAN Address pointing to the CAN_NIPR1
    CAN_ADCON = ADR_INC;         // Auto Increment the current address(+1)

  ///  - load NODE 1 interrupt pointer register
  //-----------CAN_NIPR1 = 0x00000000-------------------------------------

    CAN_DATA0 = 0x00;            // load NIPR1_LECINP, NIPR1_ALINP
    CAN_DATA1 = 0x00;            // load NIPR1_CFCINP, NIPR1_TRINP
    CAN_vWriteEN(D0_VALID+D1_VALID+ADR_INC); // Data0 and Data1 are Valid for 
                                             // with Auto Increment 
                                             // transmission and Write is 
                                             // Enabled CAN Address pointing 
                                             // to the CAN_NPCR1

  ///  -----------------------------------------------------------------------
  ///  Configuration of the used CAN Input Port Pins:
  ///  -----------------------------------------------------------------------
  ///  - Pin P1.4 is used as RXDC1_3 input

  //-----------CAN_NPCR1 = 0x00000003-------------------------------------
  ///  - Loop-back mode is disabled

    CAN_DATA0 = 0x03;            // Receive Select NPCR1_RXSEL
    CAN_DATA1 = 0x00;            // Loop-back mode is disabled
    CAN_vWriteEN(D0_VALID+D1_VALID+ADR_INC);  //  Data0 & 1 are Valid for 
                                              // transmission and Write is 
                                              // Enabled with AutoIncrement 
                                              // CAN Address pointing to the 
                                              // CAN_NBTR1



  ///  Configuration of the Node 1 Baud Rate:
  ///  - required baud rate = 500,000 kbaud
  ///  - real baud rate     = 500,000 kbaud
  ///  - sample point       = 83,33 %
  ///  - there are 9 time quanta before sample point
  ///  - there are 2 time quanta after sample point
  ///  - the (re)synchronization jump width is 2 time quanta

  //-----------CAN_NBTR1 = 0x00001847-------------------------------------

    CAN_DATA0 = 0x47;            // load NBTR1_SJW, BRP
    CAN_DATA1 = 0x18;            // load NBTR1_DIV8, TSEG2, TSEG1
    CAN_vWriteEN(D0_VALID+D1_VALID+ADR_INC);  // Data0, 1 are valid for 
                                              // transmission and Write is 
                                              // Enabled with Auto 
                                              // Increment(+1) CAN Address 
                                              // pointing to the CAN_NECNT1

  ///  Configuration of the Node 1 Error Counter:
  ///  - the error warning threshold value (warning level) is 96

  //-----------CAN_NECNT1 = 0x00600000-------------------------------------

    CAN_DATA2 = 0x60;            // load NECNT1_EWRNLVL register
    CAN_vWriteEN(D2_VALID+ADR_INC); // Data2 is Valid for transmission, Auto 
                                    // Increment current address(+1) and 
                                    // Write is Enabled CAN Address pointing 
                                    // to the CAN_NFCR1

  ///  Configuration of the Frame Counter:
  ///  - Frame Counter Mode: the counter is incremented upon the reception 
  ///    and transmission of frames
  ///  - frame counter: 0x0000


  //-----------CAN_NFCR1 = 0x00000000-------------------------------------

    CAN_DATA0 = 0x00;            // load NFCR1_CFCL
    CAN_DATA1 = 0x00;            // load NFCR1_CFCH
    CAN_DATA2 = 0x00;            // load NFCR1_CFCOV, CFCIE, CFMOD, CFSEL
    CAN_vWriteEN(D0_VALID+D1_VALID+D2_VALID); // Data0, 1, 2 are valid for 
                                              // transmission and Write is 
                                              // Enabled

  ///  -----------------------------------------------------------------------
  ///  Configuration of the used CAN Output Port Pins:
  ///  -----------------------------------------------------------------------
  ///  - NODE0 TXD Pin's are not used
  ///  Pin P1.3 is used as TXDC1_3 Output 

    SFR_PAGE(_pp2, noSST);       // switch to page 2
      P1_ALTSEL0      |= 0x08;    //  set AltSel0 
      P1_ALTSEL1      |= 0x08;    //  set AltSel1

    SFR_PAGE(_pp0, noSST);       // switch to page 0
      P1_DIR          |= 0x08;        //  set Direction as Output


  ///  -----------------------------------------------------------------------
  ///  Configuration of the CAN Message Object List Structure:
  ///  -----------------------------------------------------------------------

    CAN_vWriteCANAddress(CAN_PANCTR); // Addressing CAN_PANCTR

  ///  Allocate MOs for list 2:
    CAN_vSetListCommand(0x02000002);  // MO0 for list 2
    CAN_vSetListCommand(0x02010002);  // MO1 for list 2
    CAN_vSetListCommand(0x02020002);  // MO2 for list 2
    CAN_vSetListCommand(0x02030002);  // MO3 for list 2
    CAN_vSetListCommand(0x02040002);  // MO4 for list 2
    CAN_vSetListCommand(0x02050002);  // MO5 for list 2
    CAN_vSetListCommand(0x02060002);  // MO6 for list 2
    CAN_vSetListCommand(0x02070002);  // MO7 for list 2
    CAN_vSetListCommand(0x02080002);  // MO8 for list 2
    CAN_vSetListCommand(0x02090002);  // MO9 for list 2
    CAN_vSetListCommand(0x020A0002);  // MO10 for list 2
    CAN_vSetListCommand(0x020B0002);  // MO11 for list 2
    CAN_vSetListCommand(0x020C0002);  // MO12 for list 2
    CAN_vSetListCommand(0x020D0002);  // MO13 for list 2
    CAN_vSetListCommand(0x020E0002);  // MO14 for list 2
    CAN_vSetListCommand(0x020F0002);  // MO15 for list 2
    CAN_vSetListCommand(0x02100002);  // MO16 for list 2
    CAN_vSetListCommand(0x02110002);  // MO17 for list 2
    CAN_vSetListCommand(0x02120002);  // MO18 for list 2
    CAN_vSetListCommand(0x02130002);  // MO19 for list 2
    CAN_vSetListCommand(0x02140002);  // MO20 for list 2
    CAN_vSetListCommand(0x02150002);  // MO21 for list 2
    CAN_vSetListCommand(0x02160002);  // MO22 for list 2
    CAN_vSetListCommand(0x02170002);  // MO23 for list 2
    CAN_vSetListCommand(0x02180002);  // MO24 for list 2
    CAN_vSetListCommand(0x02190002);  // MO25 for list 2
    CAN_vSetListCommand(0x021A0002);  // MO26 for list 2
    CAN_vSetListCommand(0x021B0002);  // MO27 for list 2
    CAN_vSetListCommand(0x021C0002);  // MO28 for list 2
    CAN_vSetListCommand(0x021D0002);  // MO29 for list 2
    CAN_vSetListCommand(0x021E0002);  // MO30 for list 2
    CAN_vSetListCommand(0x021F0002);  // MO31 for list 2

  ///  -----------------------------------------------------------------------
  ///  Configuration of the CAN Message Objects 0 - 31:
  ///  -----------------------------------------------------------------------
  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 0:
  ///  -----------------------------------------------------------------------
  ///  - message object 0 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR0 = 0x0EA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR0); // Addressing MO0 control register

    CAN_vWriteAMData(0x0EA80000); // load MO0 control register

  //  CAN Address pointing to the CAN_MOAR0
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR0 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO0 arbitration register

  //  CAN Address pointing to the CAN_MODATAH0
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH0 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO0 data register high

  //  CAN Address pointing to the CAN_MODATAL0
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL0 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO0 data register low

  //  CAN Address pointing to the CAN_MOAMR0
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR0 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO0 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR0
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 0
  ///  - transmit interrupt node pointer: MultiCAN SRN 0

  //--------------MOIPR0 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO0 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR0
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - button pointer : MO0
  ///  - top pointer : MO15
  ///  - current select pointer : MO0
  ///  - object select pointer : MO15
  //--------------MOFGPR0 = 0x0F000F00---------------------------------------

    CAN_vWriteAMData(0x0F000F00); // load MO0 FIFO/gateway pointer register

  //  initialization of aubFIFOPtr[0]

  //  CAN Address pointing to the CAN_MOFCR0
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO BASE OBJECT
  ///  - 0 valid data bytes
  ///  - enable transmit interrupt; bit TXPND is set after successful 
  ///    transmission of a frame

  //--------------MOFCR0 = 0x00020002---------------------------------------

    CAN_vWriteAMData(0x00020002); // load MO0  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 1:
  ///  -----------------------------------------------------------------------
  ///  - message object 1 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR1 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR1); // Addressing MO1 control register

    CAN_vWriteAMData(0x0AA80000); // load MO1 control register

  //  CAN Address pointing to the CAN_MOAR1
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR1 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO1 arbitration register

  //  CAN Address pointing to the CAN_MODATAH1
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH1 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO1 data register high

  //  CAN Address pointing to the CAN_MODATAL1
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL1 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO1 data register low

  //  CAN Address pointing to the CAN_MOAMR1
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR1 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO1 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR1
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 1

  //--------------MOIPR1 = 0x00000100---------------------------------------

    CAN_vWriteAMData(0x00000100); // load MO1 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR1
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR1 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO1 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR1
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR1 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO1  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 2:
  ///  -----------------------------------------------------------------------
  ///  - message object 2 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR2 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR2); // Addressing MO2 control register

    CAN_vWriteAMData(0x0AA80000); // load MO2 control register

  //  CAN Address pointing to the CAN_MOAR2
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR2 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO2 arbitration register

  //  CAN Address pointing to the CAN_MODATAH2
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH2 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO2 data register high

  //  CAN Address pointing to the CAN_MODATAL2
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL2 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO2 data register low

  //  CAN Address pointing to the CAN_MOAMR2
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR2 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO2 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR2
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 2

  //--------------MOIPR2 = 0x00000200---------------------------------------

    CAN_vWriteAMData(0x00000200); // load MO2 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR2
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR2 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO2 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR2
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR2 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO2  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 3:
  ///  -----------------------------------------------------------------------
  ///  - message object 3 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR3 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR3); // Addressing MO3 control register

    CAN_vWriteAMData(0x0AA80000); // load MO3 control register

  //  CAN Address pointing to the CAN_MOAR3
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR3 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO3 arbitration register

  //  CAN Address pointing to the CAN_MODATAH3
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH3 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO3 data register high

  //  CAN Address pointing to the CAN_MODATAL3
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL3 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO3 data register low

  //  CAN Address pointing to the CAN_MOAMR3
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR3 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO3 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR3
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 3

  //--------------MOIPR3 = 0x00000300---------------------------------------

    CAN_vWriteAMData(0x00000300); // load MO3 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR3
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR3 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO3 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR3
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR3 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO3  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 4:
  ///  -----------------------------------------------------------------------
  ///  - message object 4 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR4 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR4); // Addressing MO4 control register

    CAN_vWriteAMData(0x0AA80000); // load MO4 control register

  //  CAN Address pointing to the CAN_MOAR4
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR4 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO4 arbitration register

  //  CAN Address pointing to the CAN_MODATAH4
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH4 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO4 data register high

  //  CAN Address pointing to the CAN_MODATAL4
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL4 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO4 data register low

  //  CAN Address pointing to the CAN_MOAMR4
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR4 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO4 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR4
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 4

  //--------------MOIPR4 = 0x00000400---------------------------------------

    CAN_vWriteAMData(0x00000400); // load MO4 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR4
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR4 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO4 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR4
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR4 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO4  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 5:
  ///  -----------------------------------------------------------------------
  ///  - message object 5 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR5 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR5); // Addressing MO5 control register

    CAN_vWriteAMData(0x0AA80000); // load MO5 control register

  //  CAN Address pointing to the CAN_MOAR5
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR5 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO5 arbitration register

  //  CAN Address pointing to the CAN_MODATAH5
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH5 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO5 data register high

  //  CAN Address pointing to the CAN_MODATAL5
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL5 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO5 data register low

  //  CAN Address pointing to the CAN_MOAMR5
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR5 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO5 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR5
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 5

  //--------------MOIPR5 = 0x00000500---------------------------------------

    CAN_vWriteAMData(0x00000500); // load MO5 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR5
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR5 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO5 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR5
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR5 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO5  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 6:
  ///  -----------------------------------------------------------------------
  ///  - message object 6 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR6 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR6); // Addressing MO6 control register

    CAN_vWriteAMData(0x0AA80000); // load MO6 control register

  //  CAN Address pointing to the CAN_MOAR6
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR6 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO6 arbitration register

  //  CAN Address pointing to the CAN_MODATAH6
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH6 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO6 data register high

  //  CAN Address pointing to the CAN_MODATAL6
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL6 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO6 data register low

  //  CAN Address pointing to the CAN_MOAMR6
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR6 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO6 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR6
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 6

  //--------------MOIPR6 = 0x00000600---------------------------------------

    CAN_vWriteAMData(0x00000600); // load MO6 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR6
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR6 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO6 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR6
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR6 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO6  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 7:
  ///  -----------------------------------------------------------------------
  ///  - message object 7 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR7 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR7); // Addressing MO7 control register

    CAN_vWriteAMData(0x0AA80000); // load MO7 control register

  //  CAN Address pointing to the CAN_MOAR7
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR7 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO7 arbitration register

  //  CAN Address pointing to the CAN_MODATAH7
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH7 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO7 data register high

  //  CAN Address pointing to the CAN_MODATAL7
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL7 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO7 data register low

  //  CAN Address pointing to the CAN_MOAMR7
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR7 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO7 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR7
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 7

  //--------------MOIPR7 = 0x00000700---------------------------------------

    CAN_vWriteAMData(0x00000700); // load MO7 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR7
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR7 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO7 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR7
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR7 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO7  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 8:
  ///  -----------------------------------------------------------------------
  ///  - message object 8 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR8 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR8); // Addressing MO8 control register

    CAN_vWriteAMData(0x0AA80000); // load MO8 control register

  //  CAN Address pointing to the CAN_MOAR8
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR8 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO8 arbitration register

  //  CAN Address pointing to the CAN_MODATAH8
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH8 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO8 data register high

  //  CAN Address pointing to the CAN_MODATAL8
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL8 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO8 data register low

  //  CAN Address pointing to the CAN_MOAMR8
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR8 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO8 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR8
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 8

  //--------------MOIPR8 = 0x00000800---------------------------------------

    CAN_vWriteAMData(0x00000800); // load MO8 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR8
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR8 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO8 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR8
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR8 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO8  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 9:
  ///  -----------------------------------------------------------------------
  ///  - message object 9 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR9 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR9); // Addressing MO9 control register

    CAN_vWriteAMData(0x0AA80000); // load MO9 control register

  //  CAN Address pointing to the CAN_MOAR9
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR9 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO9 arbitration register

  //  CAN Address pointing to the CAN_MODATAH9
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH9 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO9 data register high

  //  CAN Address pointing to the CAN_MODATAL9
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL9 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO9 data register low

  //  CAN Address pointing to the CAN_MOAMR9
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR9 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO9 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR9
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 9

  //--------------MOIPR9 = 0x00000900---------------------------------------

    CAN_vWriteAMData(0x00000900); // load MO9 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR9
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR9 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO9 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR9
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR9 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO9  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 10:
  ///  -----------------------------------------------------------------------
  ///  - message object 10 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR10 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR10); // Addressing MO10 control register

    CAN_vWriteAMData(0x0AA80000); // load MO10 control register

  //  CAN Address pointing to the CAN_MOAR10
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR10 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO10 arbitration register

  //  CAN Address pointing to the CAN_MODATAH10
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH10 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO10 data register high

  //  CAN Address pointing to the CAN_MODATAL10
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL10 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO10 data register low

  //  CAN Address pointing to the CAN_MOAMR10
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR10 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO10 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR10
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 10

  //--------------MOIPR10 = 0x00000A00---------------------------------------

    CAN_vWriteAMData(0x00000A00); // load MO10 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR10
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR10 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO10 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR10
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR10 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO10  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 11:
  ///  -----------------------------------------------------------------------
  ///  - message object 11 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR11 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR11); // Addressing MO11 control register

    CAN_vWriteAMData(0x0AA80000); // load MO11 control register

  //  CAN Address pointing to the CAN_MOAR11
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR11 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO11 arbitration register

  //  CAN Address pointing to the CAN_MODATAH11
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH11 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO11 data register high

  //  CAN Address pointing to the CAN_MODATAL11
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL11 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO11 data register low

  //  CAN Address pointing to the CAN_MOAMR11
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR11 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO11 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR11
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 11

  //--------------MOIPR11 = 0x00000B00---------------------------------------

    CAN_vWriteAMData(0x00000B00); // load MO11 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR11
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR11 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO11 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR11
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR11 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO11  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 12:
  ///  -----------------------------------------------------------------------
  ///  - message object 12 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR12 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR12); // Addressing MO12 control register

    CAN_vWriteAMData(0x0AA80000); // load MO12 control register

  //  CAN Address pointing to the CAN_MOAR12
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR12 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO12 arbitration register

  //  CAN Address pointing to the CAN_MODATAH12
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH12 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO12 data register high

  //  CAN Address pointing to the CAN_MODATAL12
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL12 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO12 data register low

  //  CAN Address pointing to the CAN_MOAMR12
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR12 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO12 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR12
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 12

  //--------------MOIPR12 = 0x00000C00---------------------------------------

    CAN_vWriteAMData(0x00000C00); // load MO12 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR12
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR12 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO12 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR12
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR12 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO12  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 13:
  ///  -----------------------------------------------------------------------
  ///  - message object 13 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR13 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR13); // Addressing MO13 control register

    CAN_vWriteAMData(0x0AA80000); // load MO13 control register

  //  CAN Address pointing to the CAN_MOAR13
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR13 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO13 arbitration register

  //  CAN Address pointing to the CAN_MODATAH13
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH13 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO13 data register high

  //  CAN Address pointing to the CAN_MODATAL13
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL13 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO13 data register low

  //  CAN Address pointing to the CAN_MOAMR13
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR13 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO13 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR13
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 13

  //--------------MOIPR13 = 0x00000D00---------------------------------------

    CAN_vWriteAMData(0x00000D00); // load MO13 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR13
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR13 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO13 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR13
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR13 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO13  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 14:
  ///  -----------------------------------------------------------------------
  ///  - message object 14 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR14 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR14); // Addressing MO14 control register

    CAN_vWriteAMData(0x0AA80000); // load MO14 control register

  //  CAN Address pointing to the CAN_MOAR14
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR14 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO14 arbitration register

  //  CAN Address pointing to the CAN_MODATAH14
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH14 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO14 data register high

  //  CAN Address pointing to the CAN_MODATAL14
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL14 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO14 data register low

  //  CAN Address pointing to the CAN_MOAMR14
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR14 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO14 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR14
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 14

  //--------------MOIPR14 = 0x00000E00---------------------------------------

    CAN_vWriteAMData(0x00000E00); // load MO14 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR14
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR14 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO14 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR14
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR14 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO14  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 15:
  ///  -----------------------------------------------------------------------
  ///  - message object 15 is valid
  ///  - message object is used as transmit object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR15 = 0x0AA80000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR15); // Addressing MO15 control register

    CAN_vWriteAMData(0x0AA80000); // load MO15 control register

  //  CAN Address pointing to the CAN_MOAR15
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x000

  //--------------MOAR15 = 0xC0000000---------------------------------------

    CAN_vWriteAMData(0xC0000000); // load MO15 arbitration register

  //  CAN Address pointing to the CAN_MODATAH15
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH15 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO15 data register high

  //  CAN Address pointing to the CAN_MODATAL15
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL15 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO15 data register low

  //  CAN Address pointing to the CAN_MOAMR15
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR15 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO15 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR15
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 15

  //--------------MOIPR15 = 0x00000F00---------------------------------------

    CAN_vWriteAMData(0x00000F00); // load MO15 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR15
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - current select pointer : MO0
  //--------------MOFGPR15 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO15 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR15
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a TRANSMIT FIFO SLAVE OBJECT connected to the base 
  ///    object 0
  ///  - 0 valid data bytes

  //--------------MOFCR15 = 0x00000003---------------------------------------

    CAN_vWriteAMData(0x00000003); // load MO15  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 16:
  ///  -----------------------------------------------------------------------
  ///  - message object 16 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR16 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR16); // Addressing MO16 control register

    CAN_vWriteAMData(0x00A00000); // load MO16 control register

  //  CAN Address pointing to the CAN_MOAR16
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR16 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO16 arbitration register

  //  CAN Address pointing to the CAN_MODATAH16
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH16 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO16 data register high

  //  CAN Address pointing to the CAN_MODATAL16
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL16 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO16 data register low

  //  CAN Address pointing to the CAN_MOAMR16
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR16 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO16 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR16
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 16
  ///  - receive interrupt node pointer: MultiCAN SRN 1

  //--------------MOIPR16 = 0x00001001---------------------------------------

    CAN_vWriteAMData(0x00001001); // load MO16 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR16
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  ///  - button pointer : MO16
  ///  - top pointer : MO31
  ///  - current select pointer : MO16
  ///  - object select pointer : MO31
  //--------------MOFGPR16 = 0x1F101F10---------------------------------------

    CAN_vWriteAMData(0x1F101F10); // load MO16 FIFO/gateway pointer register

  //  initialization of aubFIFOPtr[16]

  //  CAN Address pointing to the CAN_MOFCR16
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO BASE OBJECT
  ///  - 0 valid data bytes
  ///  - enable receive interrupt; bit RXPND is set after successful 
  ///    reception of a frame

  //--------------MOFCR16 = 0x00010001---------------------------------------

    CAN_vWriteAMData(0x00010001); // load MO16  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 17:
  ///  -----------------------------------------------------------------------
  ///  - message object 17 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR17 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR17); // Addressing MO17 control register

    CAN_vWriteAMData(0x00A00000); // load MO17 control register

  //  CAN Address pointing to the CAN_MOAR17
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR17 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO17 arbitration register

  //  CAN Address pointing to the CAN_MODATAH17
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH17 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO17 data register high

  //  CAN Address pointing to the CAN_MODATAL17
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL17 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO17 data register low

  //  CAN Address pointing to the CAN_MOAMR17
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR17 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO17 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR17
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 17

  //--------------MOIPR17 = 0x00001100---------------------------------------

    CAN_vWriteAMData(0x00001100); // load MO17 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR17
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR17 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO17 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR17
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR17 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO17  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 18:
  ///  -----------------------------------------------------------------------
  ///  - message object 18 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR18 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR18); // Addressing MO18 control register

    CAN_vWriteAMData(0x00A00000); // load MO18 control register

  //  CAN Address pointing to the CAN_MOAR18
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR18 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO18 arbitration register

  //  CAN Address pointing to the CAN_MODATAH18
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH18 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO18 data register high

  //  CAN Address pointing to the CAN_MODATAL18
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL18 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO18 data register low

  //  CAN Address pointing to the CAN_MOAMR18
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR18 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO18 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR18
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 18

  //--------------MOIPR18 = 0x00001200---------------------------------------

    CAN_vWriteAMData(0x00001200); // load MO18 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR18
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR18 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO18 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR18
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR18 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO18  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 19:
  ///  -----------------------------------------------------------------------
  ///  - message object 19 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR19 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR19); // Addressing MO19 control register

    CAN_vWriteAMData(0x00A00000); // load MO19 control register

  //  CAN Address pointing to the CAN_MOAR19
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR19 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO19 arbitration register

  //  CAN Address pointing to the CAN_MODATAH19
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH19 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO19 data register high

  //  CAN Address pointing to the CAN_MODATAL19
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL19 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO19 data register low

  //  CAN Address pointing to the CAN_MOAMR19
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR19 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO19 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR19
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 19

  //--------------MOIPR19 = 0x00001300---------------------------------------

    CAN_vWriteAMData(0x00001300); // load MO19 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR19
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR19 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO19 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR19
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR19 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO19  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 20:
  ///  -----------------------------------------------------------------------
  ///  - message object 20 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR20 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR20); // Addressing MO20 control register

    CAN_vWriteAMData(0x00A00000); // load MO20 control register

  //  CAN Address pointing to the CAN_MOAR20
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR20 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO20 arbitration register

  //  CAN Address pointing to the CAN_MODATAH20
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH20 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO20 data register high

  //  CAN Address pointing to the CAN_MODATAL20
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL20 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO20 data register low

  //  CAN Address pointing to the CAN_MOAMR20
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR20 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO20 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR20
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 20

  //--------------MOIPR20 = 0x00001400---------------------------------------

    CAN_vWriteAMData(0x00001400); // load MO20 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR20
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR20 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO20 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR20
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR20 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO20  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 21:
  ///  -----------------------------------------------------------------------
  ///  - message object 21 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR21 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR21); // Addressing MO21 control register

    CAN_vWriteAMData(0x00A00000); // load MO21 control register

  //  CAN Address pointing to the CAN_MOAR21
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR21 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO21 arbitration register

  //  CAN Address pointing to the CAN_MODATAH21
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH21 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO21 data register high

  //  CAN Address pointing to the CAN_MODATAL21
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL21 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO21 data register low

  //  CAN Address pointing to the CAN_MOAMR21
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR21 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO21 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR21
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 21

  //--------------MOIPR21 = 0x00001500---------------------------------------

    CAN_vWriteAMData(0x00001500); // load MO21 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR21
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR21 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO21 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR21
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR21 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO21  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 22:
  ///  -----------------------------------------------------------------------
  ///  - message object 22 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR22 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR22); // Addressing MO22 control register

    CAN_vWriteAMData(0x00A00000); // load MO22 control register

  //  CAN Address pointing to the CAN_MOAR22
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR22 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO22 arbitration register

  //  CAN Address pointing to the CAN_MODATAH22
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH22 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO22 data register high

  //  CAN Address pointing to the CAN_MODATAL22
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL22 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO22 data register low

  //  CAN Address pointing to the CAN_MOAMR22
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR22 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO22 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR22
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 22

  //--------------MOIPR22 = 0x00001600---------------------------------------

    CAN_vWriteAMData(0x00001600); // load MO22 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR22
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR22 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO22 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR22
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR22 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO22  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 23:
  ///  -----------------------------------------------------------------------
  ///  - message object 23 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR23 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR23); // Addressing MO23 control register

    CAN_vWriteAMData(0x00A00000); // load MO23 control register

  //  CAN Address pointing to the CAN_MOAR23
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR23 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO23 arbitration register

  //  CAN Address pointing to the CAN_MODATAH23
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH23 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO23 data register high

  //  CAN Address pointing to the CAN_MODATAL23
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL23 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO23 data register low

  //  CAN Address pointing to the CAN_MOAMR23
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR23 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO23 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR23
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 23

  //--------------MOIPR23 = 0x00001700---------------------------------------

    CAN_vWriteAMData(0x00001700); // load MO23 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR23
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR23 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO23 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR23
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR23 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO23  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 24:
  ///  -----------------------------------------------------------------------
  ///  - message object 24 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR24 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR24); // Addressing MO24 control register

    CAN_vWriteAMData(0x00A00000); // load MO24 control register

  //  CAN Address pointing to the CAN_MOAR24
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR24 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO24 arbitration register

  //  CAN Address pointing to the CAN_MODATAH24
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH24 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO24 data register high

  //  CAN Address pointing to the CAN_MODATAL24
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL24 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO24 data register low

  //  CAN Address pointing to the CAN_MOAMR24
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR24 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO24 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR24
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 24

  //--------------MOIPR24 = 0x00001800---------------------------------------

    CAN_vWriteAMData(0x00001800); // load MO24 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR24
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR24 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO24 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR24
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR24 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO24  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 25:
  ///  -----------------------------------------------------------------------
  ///  - message object 25 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR25 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR25); // Addressing MO25 control register

    CAN_vWriteAMData(0x00A00000); // load MO25 control register

  //  CAN Address pointing to the CAN_MOAR25
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR25 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO25 arbitration register

  //  CAN Address pointing to the CAN_MODATAH25
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH25 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO25 data register high

  //  CAN Address pointing to the CAN_MODATAL25
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL25 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO25 data register low

  //  CAN Address pointing to the CAN_MOAMR25
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR25 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO25 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR25
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 25

  //--------------MOIPR25 = 0x00001900---------------------------------------

    CAN_vWriteAMData(0x00001900); // load MO25 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR25
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR25 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO25 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR25
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR25 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO25  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 26:
  ///  -----------------------------------------------------------------------
  ///  - message object 26 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR26 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR26); // Addressing MO26 control register

    CAN_vWriteAMData(0x00A00000); // load MO26 control register

  //  CAN Address pointing to the CAN_MOAR26
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR26 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO26 arbitration register

  //  CAN Address pointing to the CAN_MODATAH26
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH26 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO26 data register high

  //  CAN Address pointing to the CAN_MODATAL26
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL26 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO26 data register low

  //  CAN Address pointing to the CAN_MOAMR26
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR26 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO26 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR26
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 26

  //--------------MOIPR26 = 0x00001A00---------------------------------------

    CAN_vWriteAMData(0x00001A00); // load MO26 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR26
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR26 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO26 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR26
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR26 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO26  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 27:
  ///  -----------------------------------------------------------------------
  ///  - message object 27 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR27 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR27); // Addressing MO27 control register

    CAN_vWriteAMData(0x00A00000); // load MO27 control register

  //  CAN Address pointing to the CAN_MOAR27
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR27 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO27 arbitration register

  //  CAN Address pointing to the CAN_MODATAH27
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH27 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO27 data register high

  //  CAN Address pointing to the CAN_MODATAL27
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL27 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO27 data register low

  //  CAN Address pointing to the CAN_MOAMR27
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR27 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO27 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR27
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 27

  //--------------MOIPR27 = 0x00001B00---------------------------------------

    CAN_vWriteAMData(0x00001B00); // load MO27 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR27
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR27 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO27 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR27
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR27 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO27  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 28:
  ///  -----------------------------------------------------------------------
  ///  - message object 28 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR28 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR28); // Addressing MO28 control register

    CAN_vWriteAMData(0x00A00000); // load MO28 control register

  //  CAN Address pointing to the CAN_MOAR28
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR28 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO28 arbitration register

  //  CAN Address pointing to the CAN_MODATAH28
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH28 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO28 data register high

  //  CAN Address pointing to the CAN_MODATAL28
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL28 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO28 data register low

  //  CAN Address pointing to the CAN_MOAMR28
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR28 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO28 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR28
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 28

  //--------------MOIPR28 = 0x00001C00---------------------------------------

    CAN_vWriteAMData(0x00001C00); // load MO28 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR28
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR28 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO28 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR28
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR28 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO28  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 29:
  ///  -----------------------------------------------------------------------
  ///  - message object 29 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR29 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR29); // Addressing MO29 control register

    CAN_vWriteAMData(0x00A00000); // load MO29 control register

  //  CAN Address pointing to the CAN_MOAR29
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR29 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO29 arbitration register

  //  CAN Address pointing to the CAN_MODATAH29
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH29 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO29 data register high

  //  CAN Address pointing to the CAN_MODATAL29
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL29 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO29 data register low

  //  CAN Address pointing to the CAN_MOAMR29
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR29 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO29 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR29
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 29

  //--------------MOIPR29 = 0x00001D00---------------------------------------

    CAN_vWriteAMData(0x00001D00); // load MO29 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR29
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR29 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO29 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR29
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR29 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO29  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 30:
  ///  -----------------------------------------------------------------------
  ///  - message object 30 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR30 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR30); // Addressing MO30 control register

    CAN_vWriteAMData(0x00A00000); // load MO30 control register

  //  CAN Address pointing to the CAN_MOAR30
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR30 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO30 arbitration register

  //  CAN Address pointing to the CAN_MODATAH30
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH30 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO30 data register high

  //  CAN Address pointing to the CAN_MODATAL30
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL30 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO30 data register low

  //  CAN Address pointing to the CAN_MOAMR30
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR30 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO30 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR30
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 30

  //--------------MOIPR30 = 0x00001E00---------------------------------------

    CAN_vWriteAMData(0x00001E00); // load MO30 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR30
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR30 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO30 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR30
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR30 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO30  function control register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Message Object 31:
  ///  -----------------------------------------------------------------------
  ///  - message object 31 is valid
  ///  - message object is used as receive object
  ///  - this message object is assigned to list 2 (node 1)

  //--------------MOCTR31 = 0x00A00000---------------------------------------

    CAN_vWriteCANAddress(CAN_MOCTR31); // Addressing MO31 control register

    CAN_vWriteAMData(0x00A00000); // load MO31 control register

  //  CAN Address pointing to the CAN_MOAR31
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - priority class 3; transmit acceptance filtering is based on the list 
  ///    order (like class 1)
  ///  - standard 11-bit identifier
  ///  - identifier 11-bit:      0x001

  //--------------MOAR31 = 0xC0040000---------------------------------------

    CAN_vWriteAMData(0xC0040000); // load MO31 arbitration register

  //  CAN Address pointing to the CAN_MODATAH31
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MODATAH31 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO31 data register high

  //  CAN Address pointing to the CAN_MODATAL31
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  //--------------MODATAL31 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO31 data register low

  //  CAN Address pointing to the CAN_MOAMR31
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - only accept receive frames with matching IDE bit
  ///  - acceptance mask 11-bit: 0x7FF

  //--------------CAN_MOAMR31 = 0x3FFFFFFF------------------------------------

    CAN_vWriteAMData(0x3FFFFFFF); // load MO31 acceptance mask register

  //  CAN Address pointing to the CAN_MOIPR31
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - use message pending register 0 bit position 31

  //--------------MOIPR31 = 0x00001F00---------------------------------------

    CAN_vWriteAMData(0x00001F00); // load MO31 interrupt pointer register

  //  CAN Address pointing to the CAN_MOFGPR31
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)


  //--------------MOFGPR31 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO31 FIFO/gateway pointer register

  //  CAN Address pointing to the CAN_MOFCR31
    CAN_ADCON = ADR_DEC;         // Auto Decrement the current address(-1)

  ///  - this object is a RECEIVE FIFO SLAVE OBJECT connected to the base 
  ///    object 16
  ///  - 0 valid data bytes

  //--------------MOFCR31 = 0x00000000---------------------------------------

    CAN_vWriteAMData(0x00000000); // load MO31  function control register


  ///  -----------------------------------------------------------------------
  ///  Configuration of the Interrupts:
  ///  -----------------------------------------------------------------------
  ///  - CAN interrupt node 0 is enabled
  ///  - CAN interrupt node 1 is enabled
  ///  - CAN interrupt node 2 is disabled
  ///  - CAN interrupt node 3 is disabled
  ///  - CAN interrupt node 4 is disabled
  ///  - CAN interrupt node 5 is disabled
  ///  - CAN interrupt node 6 is disabled
  ///  - CAN interrupt node 7 is disabled

  ///  MultiCAN Node 0 Interrupt enable bit is set in SHINT_vInit() function

  ///  - MultiCAN Nodex Interrupt enable bit is set in SHINT_vInit() function

  //   -----------------------------------------------------------------------
  //   Start the CAN Nodes:
  //   -----------------------------------------------------------------------


  ///  - -----------CAN_NCR1--------------------------------------------------------

    CAN_vWriteCANAddress(CAN_NCR1); // Addressing CAN_NCR1
    CAN_vReadEN();               // Read Mode is Enabled
    CAN_DATA0  &= ~0x41;         // reset INIT and CCE
    CAN_vWriteEN(D0_VALID);      // Data0 is Valid for transmission and Write 
                                 // is Enabled


  // USER CODE BEGIN (Init,3)
  TI=1; puts("CAN.C  - NODE1  initialized ........");
		
  		
  // USER CODE END

} //  End of function CAN_vInit

//****************************************************************************
// @Function      void CAN_vWriteAMData(ulong ulValue) 
//
//----------------------------------------------------------------------------
// @Description   This function writes 32-bit Data to CAN Data Register's 
//                0-3respectively. 
//                Note:
//                Write Process :
//                ->Write the address of the MultiCAN kernel register to the 
//                CAN_ADL and CAN_ADH registers.
//                use macro : CAN_vWriteCANAddress. 
//                ->Write the data to the 
//                CAN_DATA0/CAN_DATA1/CAN_DATA2/CAN_DATA3 registers.
//                ->Write the register CAN_ADCON, including setting the valid 
//                bit of the data registers and setting register bit RWEN to 
//                1.
//                ->The valid data will be written to the MultiCAN kernel 
//                only once. Register bit BSY will become 1.
//                ->When Register bit BSY becomes 0, the transmission is 
//                finished.
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    ulValue: 
//                32-bit Data
//
//----------------------------------------------------------------------------
// @Date          26.04.2007
//
//****************************************************************************

// USER CODE BEGIN (WriteAMData,1)

// USER CODE END

void CAN_vWriteAMData(ulong ulValue)
{
  un_32bit ulData;
  ulData.ulVal = ulValue;

    CAN_DATA0 = ulData.ubDB[3]; // load CAN Data Register 0
    CAN_DATA1 = ulData.ubDB[2]; // load CAN Data Register 1
    CAN_DATA2 = ulData.ubDB[1]; // load CAN Data Register 2
    CAN_DATA3 = ulData.ubDB[0]; // load CAN Data Register 3
        CAN_vWriteEN(ALL_DATA_VALID); // Writemode is Enabled
} //  End of function CAN_vWriteAMData

//****************************************************************************
// @Function      void CAN_vSetListCommand(ulong ulVal) 
//
//----------------------------------------------------------------------------
// @Description   This function write's 32-bit Data to CAN_PANCTR Register.
//                
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    ulVal: 
//                32-bit Data
//
//----------------------------------------------------------------------------
// @Date          26.04.2007
//
//****************************************************************************

// USER CODE BEGIN (SetListCommand,1)

// USER CODE END

void CAN_vSetListCommand(ulong ulVal)
{
    CAN_vWriteAMData(ulVal);  // - load Panel Control Register
    CAN_DATA1 = CAN_PANCTR_BUSY;
    while(CAN_DATA1 & CAN_PANCTR_BUSY){ // wait until Panel has finished the 
                                        // initialisation
      CAN_ADCON &= ~0x01;       
      }                         
} //  End of function CAN_vSetListCommand


// USER CODE BEGIN (CAN_General,10)

// USER CODE END

