How about:
Code:unsigned char x[3]; // unsigned char is a 8-bit value on 8051 x[0] = 0x02; x[1] = 0xFF; x[2] = 0xFF; unsigned long i = 0; for (int index = 0; index < 3; index++) { i <<= 8; i |= x[index]; } // or unsigned long i = x[0]; i = i << 8; i = i | x[1]; i = i << 8; i = i | x[2];




Reply With Quote