Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- vom stoca in variabila val care este pe 16 biti, fara semn
- valoarea hexazecimala 0x1234. Deoarece Arduino este little-endian
- va stoca cel ma putin semnificativ octet la adresa mai mica in
- timp ce byteul mai semnificativ va fi stocat la adresa mai mare.
- Acest cod demonstreaza ca Arduino = little-endian
- " A big-endian system stores the most significant
- byte of a word at the smallest memory address and
- the least significant byte at the largest. A little-endian
- system, in contrast, stores the least-significant byte
- at the smallest address."
- Sursa: https://en.wikipedia.org/wiki/Endianness
- */
- void setup()
- {
- Serial.begin(9600);
- uint16_t val = 0x1234;
- uint8_t* p = (uint8_t *)&val;
- Serial.println(*p, HEX);
- p++;
- Serial.println(*p, HEX);
- }
- void loop()
- {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement