Tuesday, January 5, 2010

Friday, January 1, 2010

What is a MicroController?
A microcontroller is a small computer on a single IC (integrated circuit), which consists of a CPU combined with supporting components such as timers, watchdog timer, serial ports, ADC, ROM, RAM, EEPROM and I/O pins etc. A microcontroller may also referred to as MCU or µC. Program memory of an MCU will be in the form of NOR gated flash or OTP, which is often included on chip, as well as a typically small amount of RAM (in the range of bytes). Microcontrollers are designed for small or dedicated applications usually known as Embedded Applications. Thus, in contrast to the microprocessors used in personal computers and other high-performance or general purpose applications, simplicity and ease of implementation is emphasized. Some MCUs can operate at clock rate as low as 4 kHz, as this is adequate for many typical applications, enabling low power consumption (milliwatts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as an interrupt. It can deliver effective power consumption while in sleeping mode(CPU clock and most peripherals off at sleeping time)and it may be just nanowatts, making many of them well suited for long lasting battery applications. Some MCUs serve performance-critical roles, like a digital signal processor (DSP), which will usually uses higher clock speeds ( in the range of Mega Hertz) and may have increased power consumption.
Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, remote controls, office machines, appliances, power tools, and toys. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems.

Microcontrollers for control or embedded applications
Microcontrollers may be classified into those for control applications and those for embedded applications. How do these microcontrollers differ from "ordinary" microcontrollers? A microcontroller is used inside a system, such as an automobile, PC, air conditioner, video recorder, mobile telephone, TV, or electronic rice cooker (in other words, it is used embedded into a system). Practically the only people who carefully look at microcontrollers are those who actually make them and hobbyists.
Microcontrollers for control or embedded applications have functions reinforced for embedded applications or are especially designed to be easy to use with such applications.
Microcomputers can be classified into microprocessors called MPU or CPU and microcontrollers called MCU.
Data is input into a computer that processes (calculates) the data and outputs the result. A microprocessor is intended to process the data and therefore consists mainly of CPU functions. Examples of functions that constitute a computer are shown below. Recent microprocessors integrate not only CPU functions but also functions gathered at the center and surrounded by a dark cream color. Some have even functions surrounded by a light cream color, such as ports, and A/D and D/A converters. Many microprocessors, however, require the connection of an external ROM that stores instructions.
A microcontroller (MCU) has an internal ROM, so it can operate even with a single LSI by writing instructions to this internal ROM, thus allowing a more compact system to be organized.

Microcontroller Selection
The microcontrollers are primarily sorted out by number of bits they can
process. This criteria yield following categories of microcontroller:
4 bit microcontrollers Deprecated – Not used now
8 bit microcontrollers Most widely used
16 bit microcontrollers Used for application where lot of processing is required
32 bit microcontrollers Latest addition to microcontroller families
There are four major 8-bit microcontrollers. They are:
Free scale’s 6811
Intel’s 8051,
Zilog’s Z80
Microchip’s PIC 16X
Each of these microcontrollers is characterizes by a unique instruction set and
registers. That means, these microcontrollers are not compatible with each other.
Programs (set of instructions) written for one microcontroller will not run on others. With
all these different microcontrollers, what criteria do designers consider in choosing one?
Three criteria’s in choosing microcontroller are as follows:
1) Computing Needs
2) Availability of Tools
3) Availability of Microcontroller

Computing Needs:
Designer must first see whether 8-bit, 16-bit, or 32-bit microcontrollers
can best handle the computing needs of the task most effectively. Among others
considerations in this category are:
(a) Speed: What is the highest speed that the microcontroller supports?
(b) Packaging: Does it come in a 40-pin 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.
(c) Power consumption. This is especially critical for the battery-powered products.
(d) The amount of memory (RAM and ROM) on the chip.
(e) The number of I/O pins and the timer on the chip.
(f) How easy it is to upgrade to higher performance or lower power consumption
versions.
(g) Cost per unit. This is important in terms of the final cost of the product in which a
microcontroller is used. For example, there are microcontrollers that cost 50 cents per
unit when purchased 100,000 units at a time.
Availability of Tools:
The second criterion in choosing a microcontroller is how easy it is to
develop product around it. Key considerations include the availability of software
developments tools such as compilers, assemblers, and debuggers.

Availability of Microcontroller:
The third criterion in choosing a microcontroller is its wide availability and
reliable sources of the microcontroller. For some designers this is even more important
than the first two criteria.
Some of the famous microcontrollers are:
Intel 8051
Intel 8031
AT89C51
AT89S52
AT MEGA8L
AT MEGA16L
AT MEGA32L
LPC2124
LPC2138

Embedded design

A microcontroller can be considered a self-contained system with a processor, memory and peripherals and can be used with an embedded system. (Only the software needs be added.)[1] The majority of computer systems in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for computer systems. These are called embedded systems. While some embedded systems are very sophisticated, many have minimal requirements for memory and program length, with no operating system, and low software complexity. Typical input and output devices include switches, relays, solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer, and may lack human interaction devices of any kind.
Interrupts

Microcontrollers must provide real time (predictable, though not necessarily fast) response to events in the embedded system they are controlling. When certain events occur, an interrupt system can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR, or "interrupt handler"). The ISR will perform any processing required based on the source of the interrupt before returning to the original instruction sequence. Possible interrupt sources are device dependent, and often include events such as an internal timer overflow, completing an analog to digital conversion, a logic level change on an input such as from a button being pressed, and data received on a communication link. Where power consumption is important as in battery operated devices, interrupts may also wake a microcontroller from a low power sleep state where the processor is halted until required to do something by a peripheral event.
Programs

Microcontroller programs must fit in the available on-chip program memory, since it would be costly to provide a system with external, expandable, memory. Compilers and assembler are used to turn high-level language and assembler language codes into a compact machine code for storage in the microcontroller's memory. Depending on the device, the program memory may be permanent, read-only memory that can only be programmed at the factory, or program memory may be field-alterable flash or erasable read-only memory.
Other microcontroller features

Since embedded processors are usually used to control devices, they sometimes need to accept input from the device they are controlling. This is the purpose of the analog to digital converter. Since processors are built to interpret and process digital data, i.e. 1s and 0s, they won't be able to do anything with the analog signals that may be being sent to it by a device. So the analog to digital converter is used to convert the incoming data into a form that the processor can recognize. There is also a digital to analog converter that allows the processor to send data to the device it is controlling.

In addition to the converters, many embedded microprocessors include a variety of timers as well. One of the most common types of timers is the Programmable Interval Timer (PIT). A PIT just counts down from some value to zero. Once it reaches zero, it sends an interrupt to the processor indicating that it has finished counting. This is useful for devices such as thermostats, which periodically test the temperature around them to see if they need to turn the air conditioner on, the heater on, etc.

Time Processing Unit (TPU) is a sophisticated timer. In addition to counting down, the TPU can detect input events, generate output events, and perform other useful operations.

A dedicated Pulse Width Modulation (PWM) block makes it possible for the CPU to control power converters, resistive loads, motors, etc., without using lots of CPU resources in tight timer loops.

Universal Asynchronous Receiver/Transmitter (UART) block makes it possible to receive and transmit data over a serial line with very little load on the CPU.

For those wanting Ethernet one can use an external chip like Crystal Semiconductor CS8900A, Realtek RTL8019, or Microchip ENC 28J60. All of them allow easy interfacing with low pin count.