Gast
#4549554
Hallo, ich will eine 32Bit Variable aus mehreren Werten zusammensetzen. #define A 5 #define B 10 #define C 2 #define D 20 #define E 25 Nun soll der Integer folgendermaßen aufgebaut sein: MSB 7 Bit für A 9 Bit für B 3 Bit für C 5 Bit für D 8 Bit für E LSB uint32_t variable = (((uint32_t)A << 25) | (((uint32_t)B << 16) | (((uint32_t)C << 13) | (((uint32_t)D << 8) | (uint32_t)E)))); Das ganze klappt bei mir aber nicht. Ich habe versucht ohne A und B (also nur 16Bit) uint32_t variable = ((C << 13) | ((D << 8) | E)); Das klappt... Kann mir jemand sagen, was ich falsch mache? Nutze einen 8Bit AVR...