embedded Archives - Electronic Guidebook https://electronicguidebook.com/tag/embedded/ A place to help you with your electronic needs Sat, 11 Jul 2020 03:17:18 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.5 https://electronicguidebook.com/wp-content/uploads/2020/02/cropped-electronicGuidebookLogoTransparent-1-32x32.png embedded Archives - Electronic Guidebook https://electronicguidebook.com/tag/embedded/ 32 32 230945861 Why a microcontroller is used in an embedded system https://electronicguidebook.com/why-a-microcontroller-is-used-in-an-embedded-system/?utm_source=rss&utm_medium=rss&utm_campaign=why-a-microcontroller-is-used-in-an-embedded-system Wed, 20 May 2020 23:44:08 +0000 https://electronicguidebook.com/?p=271 Think of the human body as an embedded system. It has inputs in the form of our 5 senses (Sight, Hearing, Touch, Taste, Smell), outputs like our fingers, hands, toes, legs and communication means like speech.  However, all these abilities that we possess are useless without one vital human anatomy, the Brain. The Brain has […]

The post Why a microcontroller is used in an embedded system appeared first on Electronic Guidebook.

]]>
Think of the human body as an embedded system.

It has inputs in the form of our 5 senses (Sight, Hearing, Touch, Taste, Smell), outputs like our fingers, hands, toes, legs and communication means like speech. 

However, all these abilities that we possess are useless without one vital human anatomy, the Brain.

The Brain has the task of processing all information it receives from inputs, as well as telling the outputs what to do, and has its own memory where it can store data.

The microcontroller is essentially the brain of an embedded system. 

So, why is a microcontroller used in an embedded system?

A microcontroller is used in an embedded system because it is tasked with processing the flow of data that comes in and goes out. It makes decisions according to code which are written by a developer. It performs operations based on data it obtains via inputs and sends data telling outputs what actions to perform. It also stores information onboard its inbuilt memory.

Just like a human body without a brain, an embedded system without a microcontroller would be redundant.

Embedded systems range in complexity, and specifications, but one thing that is certain is that at the center of it all is a microcontroller controlling all operations.

What is a Microcontroller?

A microcontroller is an Integrated Chip (IC) which includes onboard memory, programmable peripheral Inputs and Outputs, Timers, Serial Communication and many more features that I will cover below.

It is essentially a small computer on a single chip.

While computers come with an Operating System (program that tells the computer what actions to perform), Micrcontrollers do not come installed with an Operating System.

The operating system or program code needs to be written by a developer (in a programming language like C, C++, or Java) and then loaded onto the microcontroller.

Main purpose 

As we saw earlier, the main purpose of a microcontroller is to process data and perform operations based on its program code as well as information received via inputs or serial communication.

It is the main component in an embedded system.

Basic structure

The microcontroller is a very versatile device that has many features depending on the needs of an embedded system.

They range in physical size, memory, speed, and other features.

Below are the features of a common used (by me as well) microcontroller, the AT Mega 8 from the AVR family of microcontrollers produced by Microchip:

  • 8 Kbytes in-system, self programmable Flash program memory
  • 512 Bytes EEPROM
  • 1 Kbyte Internal SRAM
  • Two 8-bit Timer/Counters
  • One 16-bit Timer/Counter
  • Three PWM channels
  • Six 10-bit ADC channels
  • Two-wire serial interface
  • SPI Serial Interface
  • 3 x 8 programmable input/output ports

These are just some of the features. For a full list of features consult the AT Mega 8 datasheet

There are many other microcontrollers from the AVR family which are produced by Microchip.

Microchip isn’t the only manufacturer of microcontrollers. There are many companies that produce microcontrollers built on different architectures. 

However, they all share similar specifications and features. 

The other common microcontrollers available are the PIC, 8051, and ARM.

Difference between Microprocessor and Microcontroller?

Microcontrollers aren’t the only type of processor used in embedded systems.

Microprocessors are very similar to microcontrollers but have their differences.

Both are at the center of an embedded system and are responsible for controlling operations.

Microcontrollers can be seen as stand alone devices that contain memory, timers etc.

While microprocessors do not have their own memory and require extra memory modules to be interfaced.

For an in-depth look at the differences, check this article

What is an Embedded System?

I gave the example of the human body as an embedded system earlier. 

But, what does an electronic embedded system look like? 

What does it consist of? 

Basics of an Embedded System

The basic definition of an electronic embedded system is a system that contains a combination of hardware and software. 

Hardware includes the processing unit (microcontroller or microprocessor), inputs and outputs. 

The software which is loaded onto a microcontroller is a set of instructions that govern how the system runs.

An embedded system is designed for a specific function or functions of a self contained system or part of a larger subset of systems.

An example of an electronic embedded system is a desktop computer.

The computer has software (its operating system) which governs how it operates. This operating system is loaded onto the microprocessor.

It has hardware which include a central processing unit (CPU), inputs (keyboard, mouse, usb ports, HDMI etc) and outputs (computer screen, speakers, printers etc).

Different components of an Embedded System

We now know that an Embedded system consists of Hardware and Software.

I gave a simple example of what an embedded system consists of above. 

But, there are many more components within the Hardware and Software. 

Let’s take a quick look at what they are.

Hardware

Power Supply 

I know I said an embedded system would be redundant without a microcontroller. 

But, it would be utterly useless without a power supply. 

The power supply supplies the entire system with electricity which is needed for all parts of the embedded system to operate.

The voltage requirements of the embedded system all depends on the voltage specifications of devices being used.

The maximum voltage rating of any device should never be exceeded.

Processor

As I have discussed earlier, the processor (either a Microcontroller or Microprocessor) is a vital part of an embedded system.

It gets programmed with all instructions on how the embedded system should operate. 

It has the job of communicating with other components of the system and controlling the flow of data.

Memory

Memory is needed to store the program code (set of instructions which determines how the embedded system functions), and data like variables and constants .

There are three types of memory:

  • Random Access Memory (RAM)
  • Read Only Memory (ROM)
  • Electrically Erasable Programmable Read-Only Memory (EEPROM)

Each memory type plays a specific role when the embedded system is running.

RAM is a volatile type of memory, which means when power is removed from the system, all data in RAM is erased. It is used to store temporary data.

ROM is memory where the program code is stored.

EEPROM is a memory where variables can be stored and once power is removed, does not get erased making it non-volatile.

Microcontrollers have the advantage of having memory in-built on their chips. 

Timer/Counters

Timers and counters are needed when you need to generate a delay, count time between two specific events, and generate pulse-width-modulation (PWM).

Communication 

In order to talk with other devices in an embedded system, it will require some means of communication.

Below are some of the communication methods available:

  • UART
  • SPI
  • I2C
  • USB
  • ETHERNET
  • RS-232
  • RS-485

Input and Outputs

Inputs provide information to the embedded system from the external world.

This can be in the form of a button press, or sensors sensing changes in temperature.

Outputs allow the embedded system display information via LED screens or rotate a motor like in a car.

Software

The next ingredient that will complete our embedded system is software. 

Software is a set of instructions (program code) that can be written in a programming language.

Programming languages can range from C, C++, Java, and Python.

But, the programming language is only one part of the Software component.

Other components include:

  • Integrated Development Environment (IDE)– is a software where the developer can write code in a specific language. 
  • Compiler– converts the code that has been written in an IDE  into machine code which is then loaded onto the microcontroller

Choosing the right Microcontroller for an Embedded system

While microcontrollers are different in size, specification, and complexity, it can’t be said that one microcontroller is better than another. 

It all depends on the specifications of the embedded system. 

If your system needs to process and calculate information at high speeds, you will need to pick a microcontroller with high processing speeds.

If, however, speed is not of concern, but you need a lot of input and output ports, then you will pick a microcontroller with lower processing speeds and more input and output ports.  

So, defining the needs of your embedded system will allow you to make the right choices when picking a microcontroller. m

Example of Embedded Systems that use a Microcontroller

There are many applications where an embedded device uses a Microcontroller as the processing unit.

Below are some examples (this is just some of the common ones. There are many more):

  • Electronic Development boards (Ardunio, AVR Dragon)
  • Automobile
  • Consumer Electronics (mobile phones, Laptops, gaming systems)
  • Household appliances (washing machines, toaster, microwaves)
  • Medical
  • Aviation

The post Why a microcontroller is used in an embedded system appeared first on Electronic Guidebook.

]]>
271