I have the fllowing bit of code on an Xmega:

TD1 = TsyncS1 - TsyncM1; TD2 = TsyncM2 - TsyncS2; TDelay = (TD1 + TD2) / 2; TDiff = TDelay - TD1;

I have a break point on the line just below what is shown. I get the following values:

TD1 0xe422e02f int32_t{data}@0x2fdd ([R28]+1) TD2 0xe62f010e int32_t{data}@0x2fe1 ([R28]+5) TDelay 0x2a2f0000 int32_t{data}@0x2fe5 ([R28]+9) TDiff 0x081eec2f int32_t{data}@0x2fe9 ([R28]+13) TsyncS1 0x000b1d40 uint32_t{data}@0x29d8 TsyncM1 0x000b4032 uint32_t{data}@0x29d4 TsyncM2 0x000b407e uint32_t{data}@0x29b7 TsyncS2 0x00093d68 uint32_t{data}@0x29b3

What puzzles me is the value of TDelay. My calculations give me 0xCA51E13D (-900,603,587) but as can be sen above the program gets a result of 0x2a2f0000 which is a positive number.

Am I just missing something here or am I doing something wrong?

:(