GPAGE question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPAGE question

Jump to solution
880 Views
crane
Contributor III

Hi,

 

I'm trying to migrate some code from S12C to S12XDT256. I have a memory read function that  takes a pointer to far pointer as argument, loads a and transmits a series of CAN messages with four bytes of data together with the address of the first byte in each message.

 

 

// Read consecutive bytes from memory on same pagestatic void ReadMem( dword *far *ppFarAddress, word len ){  _CANSTR CanTxMsg;  CanTxMsg.Byte.Idr0 = READ_MEM_ECHO_MSG;    while (len != 0)  {    *(dword *far *)&CanTxMsg.Array[CAN_DB0] = *ppFarAddress;  // copy address    *(dword *)&CanTxMsg.Array[CAN_DB3] = **ppFarAddress;      // copy 4 bytes data    if (len > 3)    // full msg?    {      CanTxMsg.Byte.Dlc.U8 = 7;      len -= 4;     // remaining bytes      *ppFarAddress += 1;         // point to next address    }    else                          // last msg   {     CanTxMsg.Byte.Dlc.U8 = len + 3;     len = 0;     // done   }   CanSendMsg( &CanTxMsg );   KickDog();   DelayXus(8000);    // 8 ms intermission between transmissions.  }}

 

Problem:

This code works fine in the S12C, but in S12XDT256, I can see from the assembly listing that GPAGE gets involved, which as far as I can tell is read only in bit 7. Anyways the messages are not transmitting the expected data, but the address reads ok. Guess I don't understand the concept of GPAGE.

 

Any help appreciated, thanks.

 

Håkan

Labels (1)
Tags (1)
0 Kudos
1 Solution
490 Views
crane
Contributor III

Found explanation in datapage.c

View solution in original post

0 Kudos
1 Reply
491 Views
crane
Contributor III

Found explanation in datapage.c

0 Kudos