how does an 8bit MCU handle 16bit output? How does an 8bit MCU store values higher than 8bits? I am using an attiny, on an adafruit trinket. and other 8bit MCUs. http://www.atmel.com/devices/attiny85.aspx I was doing some things with uint32_t datatypes, when it hit me, that it would seem like uint32_t would be an incompatible datatype. Even 2Byte data type like int seems peculiar. "int stores a 16-bit (2-byte) value" considering the MCU is 8bit.

I saw this link, that sounded like it would have more info, but its pages are incomplete. http://playground.arduino.cc/Code/DatatypePractices

So how does that work? How does an 8bit MCU make use of data-types over 8bits?

  • 2
    Human children are often first taught to do arithmetic with single-digit arguments, and then to do operations on multi-digit place-value numbers using rules that give a sequence of single-digit operations. Computers use very similar methods, doing multiple word-width operations to accomplish wider ones. Dec 2 '16 at 14:37
  • 2
    It's the compiler that convert the 32-bit operations into 8-bit instructions.
    – Gerben
    Dec 2 '16 at 14:43
  • Is MCU micro controller unit?
    – clankill3r
    Mar 22 '18 at 20:15

The basic answer is that the processor does math in 8-bit chunks, so it takes more instructions than it would on a 32-bit processor.

A good answer is found in EE.SE


Actually a 1-bit MCU could be used to execute code (e.g. C/C++) with N-bit numbers. Not very fast as it will require O(N) operations for addition and subtraction.

To better understand this for the 8-bit AVR MCU used in Arduino I recommend reading the Instruction Set Description Manual, AVR/GCC Wiki and assembler code listings for some sketches. This will reveal the secret(s) behind this "alien technology/magic".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.