element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Blog Is a 32 bit or 8 bit MCU better for your application Part 2? Processing, Interrupts and Pointers
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: txbeech
  • Date Created: 15 Oct 2015 10:16 PM Date Created
  • Views 928 views
  • Likes 1 like
  • Comments 2 comments
  • 32bit
  • 8-bit
  • 8051
  • microcontrollers
  • 8bit
  • embedded
  • microcontroller
  • 32-bit
  • mcu
  • iot
  • arm
  • power
  • Architecture
Related
Recommended

Is a 32 bit or 8 bit MCU better for your application Part 2? Processing, Interrupts and Pointers

txbeech
txbeech
15 Oct 2015

For the second installment in the 32 vs 8 bit MCU series I will get a little more technical here and talk about processing power, interrupt latency, pointer efficiency and pointer ease of use.

The two architectures that I am very familiar with are the 8051 on the 8 bit and ARM on the 32 bit.  Because of this, the comparisons I make will be based on those architectures.  There are many others out there like PIC with its modified Harvard architecture as well as other RISCs but my breathe of knowledge on those lacks a bit so I will focus on the 8051 and the ARM architectures.

 

Processing

When people think of 32 bit vs 8 bit most automatically assume that the 32 is going to out process or be much faster than the 8 bit.  While generally that may be true 8 bit 8051s excel at what they were made to do, handle 8 bit data….  The code and memory size will be smaller for a program which shifts and alters 8 bit data on an 8051 than on an ARM.  A smaller program uses less memory and allows the designer to use an even smaller chip lending many advantages to the 8 bit.  However, when moving 16 bit data the efficiency of the 32 bit begins to differentiate itself.  When it comes to 32 bit data and math the 32 bit outshines the 8 bit because it can do 32 bit addition/subtraction in 1 instruction while it takes the 8 bit 4 instructions.  This makes the 32 bit better suited for a large data streaming role.  However, the 32 bit core isn’t always better at this data pass through especially in the simple cases.  For example if it is a simple SPI-UART bridge then a 32 bit MCU sits in idle for long periods of time and on top of that the entire application is small at < 8kb flash.  This makes the 8 bit the right choice in this simple example and many USB – SPI/I2C/etc devices which simply pass through peripherals are repurposed 8 bit MCUs like the Cp210x family.

To illustrate the point of 8, 16 and 32 bit data efficiency I compiled the function below on a 32 bit ARM core and an 8 bit 8051 MCU with varying sizes of uint8_t, uint16_t and uint32_t.

 

uint32_t funcB(uint32_t testA, uint32_t testB){

  return  (testA * testB)/(testA - testB)

} 

 

| data type | 32bit(-o3) | 8bit  |

| uint8_t     |         20   |   13  | bytes

| uint16_t   |         20   |   20  | bytes

| uint32_t   |         16   |   52  | bytes

 

As the data size/type used increased the 8051 begins to require more and more code size to deal with it and eventually surpassing the size of the ARM function. The 16-bit case is dead even for this example however the 32 bit used less instructions and therefore has the edge here. Also, it’s important to know that this comparison is only valid when compiling the ARM code with optimization. Un-optimized code is several times larger.  This can also be dependent on the compiler and the level of coding being done.

 

image

 

Interrupt Speed

The latency involved in interrupts and function calls are vastly different between the two.  The 8 bit is going to be faster at performing interrupts as well as communicating with 8 bit peripherals. The 8051 core has an advantage in ISR service times and latency. But this only comes into play on entry and exit so as the ISR gets larger the benefit will die out.  The ARM interrupt controller will automatically save around 4 registers depending on the type of core.  If the interrupt service routine(ISR) doesn’t need all four or five of these registers then those cycles are wasted.  So for the smaller ISRs the 8051 will be faster to execute.  Again the theme is, the bigger the system the less edge the 8 bit will have.  Also you must consider what the ISR is doing.  If it is performing 32 bit math or something to that degree it will take the 8 bit longer and the faster ISR entry/exit will be negated.


Pointers

image

 

When using pointers with an 8051 device, it is more efficient to specify which data segment the pointer is pointing to, for example XDATA.  Generic pointers exist but are slower and use more memory.  If you have an application which utilizes pointers especially in data transfer then the 8051 may start to lag behind the ARM core in terms of efficiency.  This is because the ARM has a unified memory and a pointer on the ARM core can point to anywhere and transfer without the need to copy the data to another segment.  Also using memory specified pointers on the 8051 can be tough to understand and can be taxing on the developer thus lending the advantage to ARM if your application heavily utilizes pointers.  It is all a game of tradeoffs and knowing what you application needs can help you better weigh the options.

  • Sign in to reply

Top Comments

  • michaelkellett
    michaelkellett over 9 years ago +1
    I know Silabs have 8051s to sell but you really are flogging a dead horse. Most of your 8:32 comparisons here are almost always irrelevant in real applications.. In the real world it's not the size of…
  • COMPACT
    COMPACT over 9 years ago

    Sometimes DMA is the way to go to reduce interrupt latencies for particular applications!

     

    "It depends!"

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelkellett
    michaelkellett over 9 years ago

    I know Silabs have 8051s to sell but you really are flogging a dead horse.

     

    Most of your 8:32 comparisons here are almost always irrelevant in real applications..

     

    In the real world it's not the size of code on a micro that matters but the cost of the code -  and that includes to cost to write it, test it, maintain it, and the cost of the memory on the chip. ARM M0 parts do every well in these areas and tend to offer much more RAM and FLASH for the money than 8051 (or other 8 bit) parts. In low volume (< 1k per year, often more) applications the cost of the chip is way less than the other costs of the code. Writing code for 32 bit parts is much cheaper than for 8051s or PICs.

     

    Your assertions re. interrupt speeds are not convincing - ARM cores offer much more sophisticated interrupt support than 8051s and frequently much faster clocking (it's the time to respond usefully that matters - not the number of cycles). I'd need to see some benchmark evidence to support the "8 bit is faster" claim.

     

    Now why don't Silabs put the nice peripherals from their 8051 range onto a chip with an ARM Mx core and then we would have the best of both worlds.

     

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube