Skip to main content

Microcontrollers and microprocessors

Welcome to world of chip programming
Chipprogrammer is a blog for introducing programming techniques for microcontroller and microprocessor which is common for academia of different countries. This blog is created to discuss programming techniques of Microprocessors and microcontrollers like 8085 microprocessor, 8051 microcontroller, Atmel AT-MEGA 32 AVR etc.. I strongly believes that this blog will helpful for novice to professional.
A microprocessor or microcontroller is a programmable device takes number, performs arithmetic or logic operation according to the program stored in memory and produces result. But both of them have some dissimilarities as discussed below;
  • Internal Memory: A microprocessor requires an external memory for program/data storage. Instruction execution requires movement if data from the external memory to microprocessor or vice versa. A microcontroller has required on-chip memory associated with peripherals.
  • Availability of Ports:Microcontroller consist ofI/O ports so that any peripherals can be interfaced to it. Microprocessor needs interfacing the peripheral devices.
  • Clock Speed:Microcontroller s are also called embedded controllers. A microcontroller clock speed is limited only a few tens of MHz. Microcontrollers are numerous and many of them are application specific. Usually, microprocessors have good computing power and they have higher clock speed to facilitate faster computation.
  • Built in Features:Most of the microcontrollers have built in Features like Analog to Digital Converter(ADC), Timers, Serial communication ports, counters, Digital to Analog Converter(DAC), Watch Dog Timers(WDT), Real Time Clocks(RTC), Comparators, Pulse Width Modulation(PWM), etc. Almost all these applications available in new generation microcontrollers. In Microprocessors these features are not icluded due to the unavailability of Ports.
  • Stand Alone Operations:A microcontroller does not require much additional interfacing ICs for operation and it functions as a stand alone system. It requires just a clock and only a power supply. A microcontroller can be thought of a microprocessor with inbuilt peripherals. A microprocessor needs to be interfaced with associated peripherals for its operation.
  • Use:Microprocessors are primarily used for computational purpose, where as microcontrollers find wide application in devices needing real time processing or control. Application of microcontrollers are numerous, starting from domestic applications such as in washing machines, TVs, air conditioners. Microcontrollers are also used in automobiles, process control industries, cell phones, electrical drives, robotics and in space applications.

Harvard and von Neumann architectures

Every microprocessor must have memory space to store program (code) and data. While code provides instructions to the CPU, the data provides the information to be processed. The CPU uses buses (wire traces) to access the code ROM and data RAM memory spaces. The early computers used the same bus for access- ing both the code and data. Such an architecture is commonly referred to as Von Neumann (Princeton) architecture. That means for von Neumann computers, theprocess of accessing the code or data could cause them to get in each other's way and slow down the processing speed of the CPU, because each had to wait for theother to finish fetching. TO speed up the process Of program execution, some CPUs use what is called Harvard architecture. In Harvard architecture, we have separate buses for the code and data memory. See figure shown below. That means that we needfour sets of buses: (1) a set of data buses for carrying data into and out of the CPU, (2) a set of address buses for accessing the data, (3) a set of data buses for carrying code into the CPU, and (4) an address bus for accessing the code. See figure shown. This is easy to implement inside an IC chip such as a microcontroller where both ROM code and data RAM are internal (on-chip) and distances are on the micron and millimeter scale. But implementing Harvard architecture for systems such as x86 IBM PC-type computers is very expensive because the RAM and ROM that hold code and data are extemal to the CPU. Separate wire traces for data and code on the motherboard will make the board large and expensive, For example, for a Pentium microprocessor with a 64-bit data bus and a 32-bit address bus we will need about 100 wire traces on the motherboard if it is von Neumann architecture (96 for address and data, plus a few others for control signals of read andwrite and so on). But the number of wire traces will double to 200 if we use Harvard architecture. Harvard architecture will also necessitate a large number of pins coming out of the microprocessor itself. For this reason you do not see Harvard architecture implemented in the world of PCs and workstations. This is also the reason that microcontrollers such as AVR use Harvard architecture internally, but they still use von Neumann architecture if they need external memory for code and data space. The von Neumann architecture was developed at Princeton University, while the Harvard architecture was the work of Harvard University.

Microcontrollers for embedded systems

Microprocessors and microcontrollers are widely used in embedded system products. An embedded system is controlled by its own internal microprocessor (or microcontroller) as opposed to an external controller. Typically. in an embedded system, the microcontroller's ROM is burned with a purpose for specific functions needed for the system. A printer is an example Of an embedded system because the processor inside it performs one task only; namely, getting the data and printing it. Contrast this with a Pentium-based PC (or any x86 PC), which can be used for any number of applications Such as word processor, print server, bank teller terminal, video game player, network server, or Internet terminal. A PC can also load and run software for a variety Of applications. Of course. the reason a PC can perform myriad tasks is that it has RAM memory and an operating system that loads the application software into RAM and lets the CPU run it. In an embedded system, typically only one application software is burned into ROM. An x86 PC contains or is connected to various embedded products such as the keyboard, print- er, modem, disk controller, sound card, CD-ROM driver, mouse, and so on. Each one of these peripherals has a microcontroller inside it that performs only one task. For example, inside every mouse a microcontroller performs the task of finding the mouse 's position and sending it to the PC.

x86 PC embedded applications

Although microcontrollers are the preferred choice for many embedded systems, sometimes a microcontroller is inadequate for the task. For this reason, in recent years many manufacturers of general-purpose microprocessors such as Intel, Freescale Semiconductor (formerly Motorola), and AMD (Advanced Micro Devices, Inc.) have targeted their microprocessors for the high end of the embedded market. Intel and AMD push their x86 processors for both the embedded and desktop PC markets. In the early 1990s, Apple computer began using the PowerPC microprocessors (604, 603, 620, etc.) in place of the 680x0 for the Macintosh. In 2007 Apple switched to the x86 CPU for use in the Mac computers. The PowerPC microprocessor is a joint venture between IBM and Freescale, and is targeted for the high end of the embedded market. It must be noted that when a company targets a general-purpose microprocessor for the embedded market it optimizes the processor used for embedded systems. For this reason these processors are often called high-end embedded processors. Another chip widely used in the high end of the embedded system design is the ARM (Advanced RISC Machine) microprocessor. Very Often the terms embedded processor and microcontroller ae used inter-changeably.
One ofthe most critical needs of an embedded system is to decrease power consumption and space. This can be achieved by integrating more functions into the CPU chip. All the embedded processors based on the x86 and PowerPC 6xx have low power consumption in addition to some forms of I/O, COM port, and ROM, all on a single chip. In high-performance embedded processors. the trend is to integrate more and more functions on the CPU chip and let the designer decide which features to use. This trend is invading PC system design as well. Normally,in designing the PC motherboard we need a CPU plus a chipset containing I/O, a cache controller, aFlash ROM containing BIOS, and finally a secondary cache memory. New designs are emerging in industry. For example, many companies have a chip that contains the entire CPU and all the supporting logic and memory,except for DRAM. In other words, we have the entire computer on a single chip.
Currently, because Of Linux and Windows standardization, many embed- ded systems use x86 PCs. In many cases, using x86 PCs for the high-end embed- ded applications not only saves money but also shortens development time because a vast library of software already exists for the Linux and Windows platforms. The fact that Windows and Linux are widely used and well-understood platforms means that developing a Windows-based or Linux-based embedded product reduces the cost and shortens the development time considerably

Choosing a microcontroller

There are five major 8-bit microcontrollers. They are: Freescale Semiconductor's (formerly Motorola) 68HC08/68HCl 1, Intel's 8051, Atmel's AVR, Zilog's Z8, and PIC from Microchip Technology. Each of the above micro- controllers has a unique instruction set and register set; therefore, they are not compatible with each Other. Programs written for one will not run on the others. There are also 16-bit and 32-bit microcontrollers made by various chip makers. WIth all these different microcontrollers, what criteria do designers consider in choosing one? Three criteria in choosing microcontrollers arc as follows: (l) meeting the computing needs of the task at hand efficiently and cost effectively; (2) availability Of software and hardware development tools such as compilers, assemblers, debuggers, and emulators; and (3) wide availability and reliable sources of the microcontroller. Next, we elaborate on each Of the above criteria.
  1. The first and foremost criterion in choosing a microcontroller is that it must meet the task at hand efficiently and cost effectively. In analyzing the needs of a microcontroller-based project, we must first see whether an 8-bit, 16-bit, or 32-bit microcontroller can best handle the computing needs of the task most effectively. Among other considerations in this category are:
  • Speed. What is the highest speed that the microcontroller supports?
  • Packaging. Does it come in a DIP (dual inline package) or a QFP (quad flat package), or some other packaging format? This is important in terms of space, assembling, and prototyping the end product.
  • Power consumption. This is especially critical for battery-powered products.
  • The amount Of RAM and ROM on the chip.
  • The number of I/O pins and the timer on the chip.
  • Ease of upgrade to higher-performance or lower-power-consumption Versions.
  • Cost per unit. This is important in tenns of the final cost of the product inwhich a microcontroller is used. For example, some microcontrollers cost 50 cents per unit when purchased 100,000 units at a time.
  1. The second criterion in choosing a microcontroller is how easy it is to develop products around it. Key considerations include the availability of an assembler. a debugger, a code-efficient C language compiler, an emulator, technical support, and both in-house and outside expertise. In many cases, third-party vendor (i.e., a supplier other than the chip manufacturer) support for the chip is as good as, if not better than, support from the chip manufacturer.
  2. The third criterion in choosing a microcontroller is its ready availability in needed quantities both now and in the future. For some designers this is even more importanthan the first two criteria. Currently, of the leading 8-bit microcontrollers, the 8051 family has the largest number of diversified (multiple source) suppliers. (Supplier means a producer besides the originator of the microcontroller.) In the case Of the 8051, which was originated by Intel, many companies also currently produce the 8051.
Notice that Freescale Semiconductor (Motorola), Atmel, Zilog, and Microchip Technology have all dedicated massive resources to ensure wide and timely availability of their products because their products are stable, mature, and Single sourced. In recent years, companies have begun to sell Field-Programmable Gate Array (FPGA) and Application-Specific Integrated Circuit (ASIC) libraries for the different microcontrollers.
There is rare chances for occurring errors and omissions in this blog, since I am not simulated every program and there is chances for misprint. If you find out any errors, you just comment under that post. I will check that. Your feedback is inevitable for me. Lot of works cited to create this blog. So if any copyright is violated, please inform me. I will take actions to remove those materials from this blog.

Comments

  1. Thank you so much for your response....

    ReplyDelete
  2. Hello, an amazing Information dude. Thanks for sharing this nice information with us. Signal Processing

    ReplyDelete
  3. learn MicroProcessors and MicroControllers online at virtulearn
    MicroProcessors and MicroControllersOnline Videos

    ReplyDelete
  4. the Given explanation for Microprocessors and Micro controllers is very qualitative , Now get access to Ekeeda's Online Engineering Courses of Microcontroller in Microprocessor

    ReplyDelete
  5. Very eye-catching post. Thanks and keep it up.
    Learn Microprocessors and Microcontrollers with Our Adaptable Online Videos and Course Materials

    ReplyDelete
  6. Thanks for sharing the article. I really love my computer and always buy a quality and branded Computer Parts UK . What do you think about this?

    ReplyDelete
  7. Share great information about your blog , Blog really helpful for us .
    attack mcu chip memory

    ReplyDelete
  8. I like your blog! Someone I share your links at this Microcontroller components site. You're doing a great job!

    ReplyDelete
  9. The best Article that I have never seen before with useful content and very informative.Thanks for sharing info. Microcontrolador de braço clone

    ReplyDelete

Post a Comment

Popular posts from this blog

8051 Simple Programs

Sum of 8-bit Numbers Stored in Memory Here  we will discuss about 8051 programs but we can't discuss about all of the 8051 instructions. For programming 8051 we should know about assembler directives as well as instruction set. Click  here to download Atmel c51 user guide that will discuss about 8051(c51 family microcontroller) instruction set, assembler directives, c51 cross assembler from Atmel.  Program ORG 00H MOV R0,#50H   ; get memory location in memory pointer R0 MOV R1,#51H   ; get memory location on memory pointer register R1 MOV A,@R0       ; get content of memory location 50H to accumulator ADD A,@R1        ; add content of A with content of memory location 51H and store result in A MOV R0,#52H    ; get 52H to memory pointer R0 MOV@R0,A         ; copy content of A to memory location 52H END Add 16-bit Numbers Program ORG 00H MOV DPTR,#2040H   ; get 2040H into DPTR MOV A,#2BH              ; get lower byte of second 16-bit number on accumulator MO

Introduction to 8051 embedded C

For 8051 we need to include the file reg51.h. This file contains the all the definitions of 8051 registers. With this information C compiler produces hex file that can be downloaded into the ROM of the microcontroller. It is important to note that the size of the hex file produced by the assembly language is much larger than the hex file produced by C compiler. Apart from this fact, there is many reasons for writing programs in C instead of assembly: ●It is much easier and less time consuming to write programs in C assembly. ●C is more flexible; it is easier to modify and update. ●Programming in C allows to use code available in function libraries. ●Program written inC for one microcontroller is portable to other microcontrollers with little or no modifications. Data Types in 8051 Embedded C The table shown below lists the data types that are available in typical C51 compiler. The gives information about the size of the data variable and it's value range. Data type

Even and Odd Memory Banks

The 8086 microprocessor uses a 20-bit address to access memory. With 20-bit address the processor can generate 2 20 = 1 Mega address. The basic memory word size of the memories used in the 8086 system is 8-bit or 1-byte (i.e., in one memory location an 8-bit binary information can be stored). Hence, the physical memory space of the 8086 is 1Mb (1 Mega-byte). For the programmer, the 8086 memory address space is a sequence of one mega-byte in which one location stores an 8-bit binary code/data and two consecutive locations store 16-bit binary code/data. But physically (i.e., in the hardware), the 1Mb memory space is divided into two banks of 512kb (512kb + 512kb = 1Mb). The two memory banks are called Even (or Lower) bank and Odd (or Upper) bank. The organization of even and odd memory banks in the 8086-based system is shown in Figure. The 8086-based system will have two sets of memory IC's. One set for even bank and another set for odd bank. The data lines D 0 -D 7 are conne