Pete Smith

Noobie ? - C3400: Cannot initialize object (destination too small)

Discussion created by Pete Smith on Oct 30, 2009
Latest reply on Nov 3, 2009 by Pete Smith

Hey guys,

 

I am relatively new to program so please forgive me if this is a dumb question. I am using a mc9s12dg128 uP. I have a basic handle on using the A to D inputs and simple IO. I have run into some issues now that I have tried to use the A to D registers via interrupt. I am getting a compile error of "C3400: Cannot initialize object (destination too small)"

 

This is my interrupt table:

**************************************************************************

 

#include "constants.h"
#include "types.h"
#include "external.h"
#include "globals.h"                                  

extern void near _Startup(void);       /* Startup routine */                                


#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
__interrupt void UnimplementedISR(void)
{
   /* Unimplemented ISRs trap.*/
}

typedef void (*near tIsrFunc)(void);
const tIsrFunc _vect[] @0xFF80 = {     /* Interrupt table */
        UnimplementedISR,                 /* vector 0x40 */
        UnimplementedISR,                 /* vector 0x3F */
        UnimplementedISR,                 /* vector 0x3E */
        UnimplementedISR,                 /* vector  0x3D */
        UnimplementedISR,                 /* vector 0x3C */
        UnimplementedISR,                 /* vector 0x3B */
        UnimplementedISR,                 /* vector 0x3A */
        UnimplementedISR,                 /* vector 0x39 */
        UnimplementedISR,                 /* vector 0x38 */
        UnimplementedISR,                 /* vector 0x37 */
        UnimplementedISR,                 /* vector 0x36 (PWM Emergency Shutdown) */
        UnimplementedISR,                 /* vector 0x35 (Port P Interrupt) */
        UnimplementedISR,                 /* vector 0x34 (CAN4 Transmit) */
        UnimplementedISR,                 /* vector 0x33 (CAN4 Receive)  */
        UnimplementedISR,                 /* vector 0x32 (CAN4 Errors)   */
        UnimplementedISR,                 /* vector 0x31 (CAN4 Wake-Up)  */
        UnimplementedISR,                 /* vector 0x30 (Reserved) */
        UnimplementedISR,                 /* vector 0x2F (BF General)         */
        UnimplementedISR,                 /* vector 0x2E (BF Synchronization) */
        UnimplementedISR,                 /* vector 0x2D (BF Receive)         */
        UnimplementedISR,                 /* vector 0x2C (BF Receive FIFO Not Empty) */
        UnimplementedISR,                 /* vector 0x2B (CAN1 Transmit) */
        UnimplementedISR,                 /* vector 0x2A (CAN1 Receive)  */
        UnimplementedISR,                 /* vector 0x29 (CAN1 Errors)   */
        UnimplementedISR,                 /* vector 0x28 (CAN1 Wake-Up)  */
        UnimplementedISR,                 /* vector 0x27 (CAN0 Transmit) */
        UnimplementedISR,                 /* vector 0x26 (CAN0 Receive)  */
        UnimplementedISR,                 /* vector 0x25 (CAN0 Errors)   */
        UnimplementedISR,                 /* vector 0x24 (CAN0 Wake-Up)  */
        UnimplementedISR,                 /* vector 0x23 (FLASH) */
        UnimplementedISR,                 /* vector 0x22 (EEPROM) */
        UnimplementedISR,                 /* vector 0x21 (Reserved) */
        UnimplementedISR,                 /* vector 0x20 (SPI1) */
        UnimplementedISR,                 /* vector 0x1F (IIC Bus) */
        UnimplementedISR,                 /* vector 0x1D (BDLC) */
        UnimplementedISR,                 /* vector 0x1C (CRG PLL Lock) */
        UnimplementedISR,                 /* vector 0x1B (Pulse Accumulator B Overflow) */
        UnimplementedISR,                 /* vector 0x1A (Modulus Down Counter Underflow) */
        UnimplementedISR,                 /* vector 0x19 (PORT H) */
        UnimplementedISR,                 /* vector 0x18 (PORT J) */
        _AD1Conversion,                    /* vector 0x17 (ATD1) */
        _AD0Conversion,                    /* vector 0x16 (ATD0) */
        UnimplementedISR,                 /* vector 0x15 (SCI1) */
        UnimplementedISR,                 /* vector 0x14 (SCI0) */
        UnimplementedISR,                 /* vector 0x13 (SPI0) */
        UnimplementedISR,                 /* vector 0x12 (Pulse Accumulator Input Edge)  */
        UnimplementedISR,                 /* vector 0x11 (Pulse Accumulator A Overflow)  */
        UnimplementedISR,                 /* vector 0x10 (TOF, timer overflow interrupt) */
        UnimplementedISR,                 /* vector 0x0F (C7I, timer interrupt channel 7)  */
        UnimplementedISR,                 /* vector 0x0E (C6I, timer interrupt channel 6)  */
        UnimplementedISR,                 /* vector 0x0D (C5I, timer interrupt channel 5)  */
        UnimplementedISR,                 /* vector 0x0C (C4I, timer interrupt channel 4)  */
        UnimplementedISR,                 /* vector 0x0B (C3I, timer interrupt channel 3)  */
        UnimplementedISR,                 /* vector 0x0A (C2I, timer interrupt channel 2)  */
        UnimplementedISR,                 /* vector 0x09 (C1I, timer interrupt channel 1)  */
        UnimplementedISR,                 /* vector 0x08 (C0I, timer interrupt channel 0)  */
        UnimplementedISR,                 /* vector 0x07 (RTIE - Real-Time Interrupt) */
        UnimplementedISR,                 /* vector 0x06 (IRQ)  */
        UnimplementedISR,                 /* vector 0x05 (XIRQ - External Interrupt) */
        UnimplementedISR,                 /* vector 0x04 (SWI - Software Interrupt)  */
        UnimplementedISR,                 /* vector 0x03 (Unimplemented Opcode Trap) */
        UnimplementedISR,                 /* vector 0x02 (COP Watchdog Reset)        */
        UnimplementedISR,                 /* vector 0x01 (Clock Monitor Reset)       */
        _Startup                          /* vector 0x00 (Power-On/Staru-Up RESET)   */
   };

****************************************************************************

 

 

 

Here are the interrupt functions I want to call:

**************************************************************************

 

 __interrupt void _AD0Conversion(void){

    extern uint channel[AD_CHAN][AD_SIZE];
    static byte index=0;
    
    channel[CHANNEL_0_0][index] = ATD0DR0;            
    channel[CHANNEL_0_1][index] = ATD0DR1;    
    channel[CHANNEL_0_2][index] = ATD0DR2;    
    channel[CHANNEL_0_3][index] = ATD0DR3;    
    channel[CHANNEL_0_4][index] = ATD0DR4;                        
    channel[CHANNEL_0_5][index] = ATD0DR5;
    channel[CHANNEL_0_6][index] = ATD0DR6;    
    channel[CHANNEL_0_7][index] = ATD0DR7;        

    if (++index >= AD_SIZE) {
                index = 0;
        }
    }

 

 

 __interrupt void _AD1Conversion(void){

    extern uint channel[AD_CHAN][AD_SIZE];
    static byte index=0;
    
    channel[CHANNEL_1_0][index] = ATD0DR0;            
    channel[CHANNEL_1_1][index] = ATD0DR1;    
    channel[CHANNEL_1_2][index] = ATD0DR2;    
    channel[CHANNEL_1_3][index] = ATD0DR3;    
    channel[CHANNEL_1_4][index] = ATD0DR4;                        
    channel[CHANNEL_1_5][index] = ATD0DR5;
    channel[CHANNEL_1_6][index] = ATD0DR6;    
    channel[CHANNEL_1_7][index] = ATD0DR7;        

    if (++index >= AD_SIZE) {
                index = 0;
        }
    }

****************************************************************************

 

 Any idea or tips?

 

Thanks,

Pete

 

 

 

 

Message Edited by PeteS on 2009-10-30 03:32 AM

Outcomes