AnsweredAssumed Answered

Structure Array Missing Values

Question asked by Ray Hall on Jul 12, 2018
Latest reply on Jul 16, 2018 by Edward Karpicz

Hello,

 

I am not sure this is the correct place to post this.

 

I am using the S12XE and when I transfer the values in a structure to a PC program I find many of the frame[4]  values are 0x00.

 

The structure uses a array of structures. Here is the structure,

 

-----------  File  cal.h  ------------------

 

typedef struct CanBusSettings {
       uint8_t startChar; // $ Start character
         uint8_t PacketHi;
       uint8_t PacketLo;
         uint8_t PacketID;
         uint8_t freq;
         uint8_t busEnabled;
         uint8_t readCanData;
         uint16_t readID;
         struct FrameSettings {
              uint8_t enabled;
             uint8_t rate;
             uint16_t id;
            uint8_t byteOrder;
            uint8_t data[8];
         }frame[4];             
       uint16_t crcCnt;
}CAN_Bus;

 

-----------  File cal.c -----------------

 

CAN_Bus can  = {
    
        0x24,    // $ Start character
        0x10,    // Packet Size Hi
        0x00,    // Packet Size Lo
        0x08,    // Packet ID
        0x01,    // Freq       500 kbit
        0x01,    // busEnabled
        0x01,    // readCanData
        0x0064,  // readID 100
        
        0x00,    // frame 0 enabled
        0x03,    // frame 0 rate
        0x03E8,  // frame 0 id (1000)
        0x00,    // frame  0 byte order
        {1,0,0,0,0,0,0,0}, // frame 0 data
        0x00,    // frame 1 enabled
        0x03,    // frame 1 rate
        0x03E9,  //frame 1 id (1001)
        0x00,    // frame 1 byte order
        {0,1,0,0,0,0,0,0}, // frame 1 data        
        0x00,    // frame 2 enabled
        0x03,    // frame 2 rate
        0x03EA,  // frame 2 id (1002)
        0x00,    // frame 2 byte order
        {0,0,1,0,0,0,0,0}, // frame 2 data        
        0x00,    // frame 3 enabled
        0x03,    // frame 3 rate
        0x03EB,   // frame 3 id (1003)
        0x00,    // frame 3 byte order
        {0,0,0,1,0,0,0,0}, // frame 3 data  
                          
        0,       // crcCnt
        
};

 

The frame[4] struct will only have the values for frame[0]; The rest are 0x00;

 

I have included my test program. I am not capable of using the debugger to see if the values are in memory. This is why I need help to show the problem is not CodeWarrior or the S12XE memory.

 

Ray.

Attachments

Outcomes