Hi,
This Code:
typedef union
{
unsigned int Word;
struct {
unsigned char High;
unsigned char Low;
} Byte;
} WordByteType;
WordByteType Checksum;
main()
{
if (RX_Buffer == ~Checksum.Byte.Low) RXstate++;
}
gives Code:
mov a, 0
cpl a
mov [(??_BootLoader^0+2)], a
mov a, [(_Checksum+1)^0]
cpl a
mov [(??_BootLoader^0+3)], a
mov a, reg[46]
cmp a, [(??_BootLoader^0+3)]
jnz l34
mov a, [(??_BootLoader^0+2)]
jnz l34
So the 'Checksum.Byte.Low' is interpreted as an integer. I guess this should be interpreted as a byte.
Casting 'Checksum.Byte.Low' to a byte will give the right results. Code:
if (RX_Buffer == (unsigned char) ~Checksum.Byte.Low) RXstate++;
Regards, Rolf