20
\$\begingroup\$

As a general engineering hobbyist, I am learning more about the world of microcontrollers each and every day. Once thing I don't quite understand though is the significance of the bit version of a microcontroller.

I have been using the ATmega8 for several months, and it seems to work great for my purposes. I know how things like clock speed, memory, number of IO pins, types of communications buses, etc. differentiate one micrcontroller from another. But I don't quite understand the significance of, say, 8-bit vs. 16-bit vs. 32-bit. I do understand that a higher bit version allows the device to store larger numbers, but again, how does this impact my decision? If I am designing a product, under which hypothetical scenario would I decide that an 8-bit processor simply won't do, and that I need something higher.

Is there any reason to believe that a theoretical 32-bit variant of the ATmega8 (all other things equal) would be superior to an 8-bit version (if such a device was possible)?

I may be speaking nonsense, but I guess that's a result of my confusion.

\$\endgroup\$
24
\$\begingroup\$

It's not the width of number it can store, it's the width it can work with in a single operation. Customarily (but not necessarily) this also has a degree of correlation to the width of native memory addressing, and thus the amount of storage which can be easily mapped without ugly workarounds such as segmentation or bank switching.

Today's 32-bit cores are superior to 8-designs in most respects (flexibility, flat memory model, and of course performance), with the major exceptions being legacy systems, applications with extreme volume and price pressure (otherwise pricing tends to correlate better with on chip memory size than with core width), and side effects of process/density. The later can provide things like 5v operation, or possibly in some cases greater radiation hardness or a simplicity advantage if trying to prove the CPU design itself to be free of logic errors. One final process/age side effect of value to many hobbyists is that 8-bit cores in DIP packages are common, while 32-bit devices in such packages are rarer (though they do exist).

\$\endgroup\$
  • 3
    \$\begingroup\$ The width it can handle in a single operation can be important when synchronizing asynchronous parts of the program. If you need to atomically read a 16bit value on an 8bit micro, you probably need to disable interrupts first which you might want to avoid to keep ISR response time low. \$\endgroup\$ – ndim Jan 21 '13 at 10:49
  • \$\begingroup\$ Another trait where some 8-bit micros can be superior to the ARM (the most popular 32-bit architecture) is with I/O bit twiddling. A PIC 18Fxx (8-bit) can set or clear any bit in I/O space with a single instruction, regardless of what any registers hold, whereas an ARM generally requires a multi-step process. ARM chips can run more instructions per second than currently-available PIC chips (some small 100MHz PIC-compatible chips used to be available from Scenix, but I think they're discontinued) but even available PICs can still do some kinds of bit-banging faster. \$\endgroup\$ – supercat Jan 21 '13 at 16:01
  • 1
    \$\begingroup\$ While less universal, some ARM devices do have things such as GPIOx_BSRR/GPIOx_BRR registers which can be written to in order to set or clear individual GPIO bits. \$\endgroup\$ – Chris Stratton Jan 21 '13 at 16:49
8
\$\begingroup\$

The bit value is the data bus or data pipe size, meaning that a 8 bit MCU can (for the most part) only work with values from 0 to 255 each clock cycle. Think of it as the processor has 8 digital lines in parallel. And a 16-bit has 16 lines, and 32-bit has 32 lines. So, for each clock cycle, it reads these data lines, and the more lines the higher the value you can work with per clock cycle.

8 bit = \$2^8\$ = \$256\$

16 bit = \$2^{16}\$ = \$65,536\$

32 bit = \$2^{32}\$ = \$4,294,967,296\$

Larger data buses also allows the processor to access larger memory addresses.

This makes a big difference during mathematical operations. A 16-bit number gives you a lot more precision than 8-bit numbers. 16-bit microcontrollers are also more efficient in processing math operations on numbers that are longer than 8 bits. A 16-bit microcontroller can automatically operate on two 16-bit numbers, like the common definition of an integer. But when you are using an 8-bit microcontroller, the process is not as straightforward. The functions implemented to operate on such numbers will take additional cycles. Depending on how processing intensive your application is and how many calculations you do, this may affect the performance of the circuit.

Difference Between 8 bit and 16 bit Microcontroller

\$\endgroup\$

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.