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
Solved! Go to Solution.
Found explanation in datapage.c