Friday 13 June 2014

Basics of Microcontrollers

A microcontroller is a small computer on a single IC containing a processor core, memory, and programmable input/output peripherals.


Like all good things, this powerful component is basically very simple. It is made by mixing tested and high- quality "ingredients" (components) as per following receipt:


  1. The simplest computer processor is used as the "brain" of the future system.
  2. Depending on the taste of the manufacturer, a bit of memory, a few A/D convertors,               timers,input/output lines are added.
  3. All that is placed in some of the standard packages.
  4. A simple software able to control it all and which everyone can easily learn about                                                 has been developed.
On the basis of these rules, numerous types of microcontrollers were designed and they quickly became man's invisible companion. Their incredible simplicity and flexibility conquered us a long time ago and if you try to invent something about them, you should know that you are probably late, someone before you has either done it or at least has tried to do it.
There are different families of microcontrollers availaible like AVR , ARM, PIC etc

Block diagram of a micro controller


Difference between microcontroller and microprocessor :-

Microprocessor is an IC which has only the CPU inside them i.e. only the processing powers such as Intel’s Pentium 1,2,3,4, core 2 duo, i3, i5 etc. These microprocessors don’t have RAM, ROM, and other peripheral on the chip. A system designer has to add them externally to make them functional. Application of microprocessor includes Desktop PC’s, Laptops, notepads etc.

Intel Microprocessors

But this is not the case with Microcontrollers. Microcontroller has a CPU, in addition with a fixed amount of RAM, ROM and other peripherals all embedded on a single chip. At times it is also termed as a mini computer or a computer on a single chip. Today different manufacturers produce microcontrollers with a wide range of features available in different versions. Some manufacturers are ATMEL, Microchip, TI, Freescale, Philips, Motorola etc.


Types of Instruction sets for microcontrollers:


1. RISC :-


RISC, or Reduced Instruction Set Computer. is a type of microprocessor instruction set that utilizes a small, highly-optimized set of instructions, rather than a more specialized set of instructions often found in other types of architectures.

The first RISC projects came from IBM, Stanford, and UC-Berkeley in the late 70s and early 80s. The IBM 801, Stanford MIPS, and Berkeley RISC 1 and 2 were all designed with a similar philosophy which has become known as RISC. Certain design features have been characteristic of most RISC processors:
  • One cycle execution time: RISC processors have a CPI (clock per instruction) of one cycle. This is due to the optimization of each instruction on the CPU and a simple technique. 
  • Pipelining: A techique that allows for simultaneous execution of parts, or stages, of instructions to more efficiently process instructions;
  • Large number of registers: The RISC design philosophy generally incorporates a larger number of registers to prevent in large amounts of interactions with memory


2. CISC :-


The primary goal of CISC instruction set is to complete a task in as few lines of assembly as possible. This is achieved by building processor hardware that is capable of understanding and executing a series of operations. For this particular task, a CISC processor would come prepared with a specific instruction (we'll call it "MULT"). When executed, this instruction loads the two values into separate registers, multiplies the operands in the execution unit, and then stores the product in the appropriate register. Thus, the entire task of multiplying two numbers can be completed with one instruction:
MULT 2:3, 5:2
MULT is what is known as a "complex instruction." It operates directly on the computer's memory banks and does not require the programmer to explicitly call any loading or storing functions. It closely resembles a command in a higher level language. For instance, if we let "a" represent the value of 2:3 and "b" represent the value of 5:2, then this command is identical to the C statement "a = a * b."

One of the primary advantages of this system is that the compiler has to do very little work to translate a high-level language statement into assembly. Because the length of the code is relatively short, very little RAM is required to store instructions. The emphasis is put on building complex instructions directly into the hardware

CISC systems date to the early 1960s and the early development of computers. IBM created a range of computers based around a set of standards called System/360. This was the first CISC machine. Earlier computers expected programmers to issue low-level instructions to the computer. 


Microcontroller Architectures  :-


The microcontrollers are availaible in different architectures. These different architectures are :

1. Harward:

Harward Architecture block diagram
The term originated from the Harvard Mark 1 relay-based computer, which stored instructions on punched tape and data in relay latches.
Harvard Architecture: The Harvard architecture uses physically separate memories for their instructions and data, requiring dedicated buses for each of them. Instructions and operands can therefore be fetched simultaneously.
Different program and data bus widths are possible, allowing program and data memory to be better optimized to the architectural requirements. E.g.: If the instruction format requires 14 bits then program bus and memory can be made 14-bit wide, while the data bus and data memory remain 8-bit wide.


2.Von Neumann

The von Neumann architecture is a design model for a stored-program digital computer that uses a processing unit and a single separate storage structure to hold both instructions and data. It is named after mathematician and early computer scientist John von Neumann. Such a computer implements a universal Turing machine, and the common "referential model" of specifying sequential architectures, in contrast with parallel architectures.

The von Neumann architecture is a design model for a stored-program digital computer that uses a processing unit and a single separate storage structure to hold both instructions and data. It is named after mathematician and early computer scientist John von Neumann. Such a computer implements a universal Turing machine, and the common "referential model" of specifying sequential architectures, in contrast with parallel architectures.

Block Diagram of Von neumann architecture

One shared memory for instructions (program) and data with one data bus and one address bus between processor and memory. Instructions and data have to be fetched in sequential order (known as the Von Neuman Bottleneck), limiting the operation bandwidth. Its design is simpler than that of the Harvard architecture. It is mostly used to interface to external memory.


IMPORTANT NOTE : There is no relationship (e.g., RISC = Harvard / CISC = von Neumann). You can build either of them either way. ThePowerPC, SPARC, and ARM are RISC and von Neumann. Seymour Cray's machines were RISC (although the term had not yet been invented when he designed most of them) and von Neumann. I don't believe the Harvard Mark I was RISC as it had some rather complex instructions (e.g., interpolate value from function tape) and it was clearly Harvard.


In the next topic we will be discussing about the basic working of sensors with their circuits explained.
Comments and views will be appreciated.

No comments:

Post a Comment