What Is The Difference Between Microprocessor And Microcontroller?

Microprocessor Vs Microcontroller

What Is The Difference Between Microprocessor And Microcontroller?

 

In this article, we’ll discuss what’s a microprocessor and what’s a microcontroller. With some examples for each of them, differences, and typical usage and applications. Then, we’ll set-up a quick testing environment in order to see each of them in action. So, let’s get started!

 

 1.  Microprocessor And Microcontroller

Difference Between Microprocessor And Microcontroller

Nobody can till weather a miscellaneous DIP chip is a microcontroller or a microprocessor by just observing how it looks. The key distinguishing parameter is its functionality, and that’s what we’re going to briefly describe hereafter.

Microcontrollers

A Microcontroller, is a complete and fully-functioning computer on a single chip.

A typical microcontroller has a CPU, RAM, ROM, Peripherals (Counters/Timers, Comparators, ADC, DC, DMA, etc), IO Ports all on the same IC chip. The majority of modern MCUs, nowadays, come with internal oscillators which means, you can flash your code and hook-up the DC power source, et voila! Everything is up and running!

ATMEGA328 Microcontroller

ATMEGA328 Microcontroller

Microcontrollers range on the (Low-end To High-end) spectrum. Therefore, the price is proportional to the total performance and capabilities of each device. The most common factors we pay attention to while choosing a microcontroller are as follows

  • Max CPU Frequency
  • Memory Size (RAM)
  • Bus Width (8-Bit, 16-Bit, 32-Bit)
  • IO Pins Count
  • ADC (#Channels & SamplingRate)
  • DMA Channels
  • Serial Ports (UART, SPI, I2C, USB, I2S, CAN)
  • Other Peripherals (Timers, IRQ Pins, etc)

The more advanced peripherals a microcontroller has, the more you pay per unit. And the price is also proportional to the CPU performance (in DMIPS). For some applications, especially battery-powered devices, the power consumption is the number1 factor being considered, so it really depends.

There are many families that include a tremendous amount of microcontroller devices ranging from small 8-Bit tiny ones (may cost 20 cents per unit) up to 32-Bit ARM cores and DSPs. The most common ones are (8051, AVR, PIC for 8-Bit, and ARM-based MCUs for 32-Bit devices).

PIC16F628A Microcontroller Block Diagram

PIC16F628A Microcontroller Block Diagram

Microprocessors

A Microprocessor is a bare CPU on chip.

A typical microprocessor has a punch of pins coming out of the IC package which represents a CPU unit. These pins should connect to buses (Data and Address) and some of them are control signals that should be also connected to the correct logic circuits on your system’s board.

As you can see, a typical microprocessor chip can do nothing on its own. Just like the processor of your PC, can you have it running out of the motherboard? it just can’t as it has not been designed to operate as a standalone computer system, unlike the microcontroller.

Intel 8008 Microprocessor

Intel has released the first microprocessor chip ever back in the early 70s which was the 4-Bit intel 4004 MPU (Microprocessor Unit). And it has been in continuous development for these microprocessors. Small microprocessors have been widely used in microcontrollers design. While high-performance microprocessors have evolved to form our modern PCs’ processors.

The internal structure of a microprocessor chip includes the following: ALU unit, Buses Control (Data & Address), CPU Registers, Instructions Decode & Control Unit, etc as found in any CPU across the globe.

Remarkable examples of early MPUs (Microprocessors) include: Motorola 6800, Zilog Z80, Ti TMS1000, Intel 8080, IBM 801.

Z80 Microprocessor Block Diagram

Z80 Microprocessor Block Diagram

Computers Vs Microcontrollers

Last but not least, we’ll compare a typical microcontroller to a typical personal computer in terms of the internal components which happens to be the same. As we’ve stated earlier, a microcontroller is a complete computer on a single chip. Hence, a microcontroller has all the fundamental components of a common computer but with much fewer resources. Have a look into the following infographic illustration

Microprocessor Vs Microcontroller

Microcontroller Vs Personal Computer

As you might have noticed, a microcontroller has nearly the same components of a large computer but in a very limited amount for each resource of them. The CPU unit of your PC is a high-performance Processor. Whereas, the CPU unit of a small microcontroller is a Microprocessor.

At the end of the infographic, I’ve drawn an imaginary performance spectrum with non-exact figures. Just to illustrate how microprocessors range in performance. Therefore, the target application, its price, and performance change as well.

 


 2.  Microcontroller In Practice

 

A microcontroller has everything it needs in order to run user-written instructions (Code). And perform any sort of data manipulations, IO operations, or peripherals control. It has been a standard “Hello World!” example in embedded systems to have an “LED Blinking” up and running on your target microcontroller device.

In this section, we’ll blink an LED using a Microcontroller (From Ti)

  • Microcontroller: TM4C123G (ARM Cortex M4)
  • IDE: Ti CCS (Code Composer Studio)
  • Development Board: Tiva C Launchpad

The c-code mentioned below was compiled on CCS and uploaded to the Tiva C board using the USB debugger. The ARM microcontroller has everything it needs to run the code which toggles an io pin that is connected to the onboard LED on the Tiva C board. Here is the code listing which we’ll be testing

#include <stdbool.h>
#include <stdint.h>
#include "tm4c123gh6pm.h"

void PortF_Init(void);
void delay_ms(uint32_t);

int main(void)
{
  PortF_Init(); // Initialize The LED IO Pin (Output)
  while(1)
  {
    GPIO_PORTF_DATA_R |= 0x04;     // (Turn LED ON)
    delay_ms(100);                 // Wait 100ms
    GPIO_PORTF_DATA_R &= ~(0x04);  // (Turn LED OFF)
    delay_ms(100);                 // Wait 100ms
  }
}

Here is the final output for our test code (For The ARM Microcontroller)

 


 3.  Microprocessor In Practice

 

On the other hand, a microprocessor can’t do anything useful on its own. We’ve to build a complete computer system around it in order to develop any sort of application. In this experiment, we’ll build an 8-LED shifting animation by sending 1’s to the IO port (which we’ll also have to build using registers).

In this section, we’ll develop our project using a Microprocessor (From Zilog)

  • Microprocessor: Zilog Z80
  • ROM: AT28C256 Parallel EEPROM
  • RAM: NO
  • IO: 8-Bit Output Register (74HC574)
  • Buses: (Address & Data) = Punch of wires + LEDs XD
  • Clock Source: Custom 555-Timer Oscillator
  • Power: Regulated 5v DC

First of all, we have to connect all those components together. If you’re interested, here is the general schematic diagram for this test circuit.

Microprocessor Vs Microcontroller Z80 Microprocessor Test Schematic

Z80 Microprocessor Test Schematic

After connecting everything up…

Microprocessor Vs Microcontroller Z80 Microprocessor Test Board

Z80 Microprocessor On Breadboard Board [ Full Computer System ]

Here is the assembly code that I’ve written for this example. You should also notice, that you’ll have to convert this code into 0’s and 1’s and write them byte-by-byte in the ROM memory chip on your own. And, yes, this may be tough sometimes!
      LDA, 1
Loop:
      OUT (255), A
      RLC A
      JR Loop

Using the datasheet of the Z80 microprocessor, it’s a kind of straightforward process to convert the code above into binary code (0’s & 1’s) and write it to our ROM memory. You can get a proper EEPROM programmer on eBay or build a microcontroller-based programmer with an Arduino maybe or do it in the hard way with some DIP switches!

PCBgogo Ad

Here is the final output for our test code (For The Z80 Microprocessor)

Play Video On YouTube

 


Conclusion

 

A Microcontroller is a small computer on a single chip. That you can program to do any tasks you want. They are typically used for control systems, home automation, robotics, avionics, telecommunication, and everywhere else you may think of!

A Microprocessor is a CPU on a chip that can’t do anything on its own. You can build a proper computer system around any given microprocessor to have it performing any instructions (code) you want to. However, it may be more difficult to build a small control system using a bare microprocessor. Yet it’s not a cost-efficient way to go. It only pays off if you’re building a complete motherboard consisting of a microprocessor unit with some memory, buses, and peripherals. Which we can see in the personal computers market and the like.

You can learn microprocessors programming for both the fun of it! and to understand how assembly instructions run on the low-level inside a CPU. This skill may not be marketable or much profitable nowadays, but it contributes to making you more knowledgable about the internals of computer systems hardware & software as well.

 

If you find this article useful, then why not share it with your network?!

Regards ^^

Khaled M.

 

Share This Page With Your Network!

Khaled Magdy

I'm an embedded systems engineer doing both Software & Hardware. I'm an EE guy who studied Computer Engineering, But I'm also passionate about Computer Science. I love reading, writing, creating projects and Technical training. A reader by day a writer by night, it's my lifestyle. You can view my profile or follow me via contacts.

You may also like...

Leave a Reply

%d bloggers like this: