Try this: uint32_t ds =3D(( ( uint32_t)'D')<<24)| (((uint32_t)'C')<<16)| (((uint32_t)'B')<<8)| ((uint32_t)('A')); What is probably happening is that the compiler is using 16 bit math. There are some rules about how the compiler determines the width of the arguments and what math width is used. I think the term you may want to search for is coersion. Personally, I prefer constructs like: uint32_t ds; ds=3D'D'; ds<<=3D8; ds|=3D'C'; ds<<=3D8; ds|=3D'B'; ds<<=3D8; ds|=3D'A'; Most decent compilers will optimize the code so that the above options have a similar construct. I also have just replaced the shifts with multiplies since multiplying by 256ul, 65536ul and similar is the same as a left shift. The compilers I use typically know this and the multiplication by a 2^x constant will be replaced by a shift. In addition, by stating that the multiplication constant is a 32 bit integer, it will usually use the correct math. On Aug 11, 2018 5:17 AM, "Justin Richards" wrote: Probably best posed in an arduino forum but hoping someone could pick an obvious mistake, steer me in the right direction or suggest a better way. I have generally avoided the << and >> operators but I thought they would be ideal to pack a 32bit variable with commands. So trying this uint32_t ds =3D ('D'<<24)|('C'<<16) |('B'<<8)|('A'); when compiled for an ESP8266 target in arduino IDE and printed gives 0x44434241 as expected. when the target is UNO it produces 0x4241 Doing this uint32_t ds =3D 'D'; ds =3D (ds << 8)| 'C'; ds =3D (ds << 8)| 'B'; ds =3D (ds << 8)| 'A'; for either target works ok. I have tried type casting (not sure that is the right phrase) like uint32_t ds =3D uint32_t('D'<<24)|uint32_t('C'<<16) |uint32_t('B'<<8)|uint32_t('A'); But no joy for the uno target. The final goal is to construct SPI commands with a esp8266 master with a UNO slave. The following compiles and works fine for the esp8266 target but has the issues mentioned above for the UNO target. #define UNO1_ADDR uint32_t(uint32_t('U')|uint32_t('1'<<8)) //Address UNO1 #define cmdREADPIN uint32_t(UNO1_ADDR | uint32_t('R'<<16)) #define cmdWRITEPIN uint32_t((UNO1_ADDR | uint32_t('W'<<16)) #define cmdREADPIN1 uint32_t(cmdREADPIN | uint32_t('1'<<24)) #define cmdREADPIN2 uint32_t(cmdREADPIN | uint32_t('2'<<24)) #define cmdREADPIN3 uint32_t(cmdREADPIN | uint32_t('3'<<24)) Any tips? Justin --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .