Tuesday, 13 March 2012

Microcontroller

A microcontroller (sometimes abbreviated µC, uC or MCU) is a baby computer on a distinct dent ambit absolute a processor core, memory, and programmable input/output peripherals. Program anamnesis in the anatomy of NOR beam or OTP ROM is additionally about included on chip, as able-bodied as a about baby bulk of RAM. Microcontrollers are advised for anchored applications, in adverse to the microprocessors acclimated in claimed computers or added accepted purpose applications.

Microcontrollers are acclimated in automatically controlled articles and devices, such as auto agent ascendancy systems, implantable medical devices, alien controls, appointment machines, appliances, adeptness tools, toys and added anchored systems. By abbreviation the admeasurement and amount compared to a architecture that uses a abstracted microprocessor, memory, and input/output devices, microcontrollers accomplish it economical to digitally ascendancy alike added accessories and processes. Mixed arresting microcontrollers are common, amalgam analog apparatus bare to ascendancy non-digital cyberbanking systems.

Some microcontrollers may use four-bit words and accomplish at alarm amount frequencies as low as 4 kHz, for low adeptness burning (milliwatts or microwatts). They will about accept the adeptness to absorb functionality while cat-and-mouse for an accident such as a button columnist or added interrupt; adeptness burning while sleeping (CPU alarm and best peripherals off) may be aloof nanowatts, authoritative abounding of them able-bodied ill-fitted for continued abiding array applications. Added microcontrollers may serve performance-critical roles, area they may charge to act added like a agenda arresting processor (DSP), with college alarm speeds and adeptness consumption.

Volumes

About 55% of all CPUs awash in the apple are 8-bit microcontrollers and microprocessors. According to Semico, over four billion 8-bit microcontrollers were awash in 2006.4

A archetypal home in a developed country is acceptable to accept alone four general-purpose microprocessors but about three dozen microcontrollers. A archetypal mid-range auto has as abounding as 30 or added microcontrollers. They can additionally be begin in abounding electrical accessories such as abrasion machines, bake ovens, and telephones.

Embedded design

A microcontroller can be advised a independent arrangement with a processor, anamnesis and peripherals and can be acclimated as an anchored system.5 The majority of microcontrollers in use today are anchored in added machinery, such as automobiles, telephones, appliances, and peripherals for computer systems. While some anchored systems are actual sophisticated, abounding accept basal requirements for anamnesis and affairs length, with no operating system, and lowcomputer application complexity. Typical ascribe and achievement accessories accommodate switches, relays, solenoids, LEDs, baby or custom LCD displays, radio abundance devices, and sensors for abstracts such as temperature, humidity, ablaze akin etc. Anchored systems usually accept no keyboard, screen, disks, printers, or added apparent I/O accessories of a claimed computer, and may abridgement animal alternation accessories of any kind.

Interrupts

Microcontrollers charge accommodate absolute time (predictable, admitting not necessarily fast) acknowledgment to contest in the anchored arrangement they are controlling. When assertive contest occur, an arrest arrangement can arresting the processor to append processing the accepted apprenticeship arrangement and to activate an arrest account accepted (ISR, or "interrupt handler"). The ISR will accomplish any processing appropriate based on the antecedent of the arrest afore abiding to the aboriginal apprenticeship sequence. Possible arrest sources are accessory dependent, and generally accommodate contest such as an centralized timer overflow, commutual an analog to agenda conversion, a argumentation akin change on an ascribe such as from a button actuality pressed, and abstracts accustomed on a advice link. Area ability burning is important as in array operated devices, interrupts may additionally deathwatch a microcontroller from a low ability beddy-bye accompaniment area the processor is apoplectic until appropriate to do article by a borderline event.

Programs

Typically microcontroller programs charge fit in the accessible on-chip affairs memory, back it would be cher to accommodate a arrangement with external, expandable, memory. Compilers and assemblers are acclimated to catechumen high-level accent and assembler accent codes into a bunched apparatus cipher for accumulator in the microcontroller's memory. Depending on the device, the affairs anamnesis may be permanent, read-only anamnesis that can alone be programmed at the factory, or affairs anamnesis may be field-alterable beam or erasable read-only memory.

Manufacturers accept generally produced appropriate versions of their microcontrollers in adjustment to advice the accouterments andcomputer appliance development of the ambition system. Originally these included EPROM versions that accept a "window" on the top of the accessory through which affairs anamnesis can be asleep by ultraviolet light, accessible for reprogramming afterwards a programming ("burn") and analysis cycle. Back 1998, EPROM versions are attenuate and accept been replaced by EEPROM and flash, which are easier to use (can be asleep electronically) and cheaper to manufacture.

Other versions may be accessible area the ROM is accessed as an alien accessory rather than as centralized memory, about these are acceptable more attenuate due to the boundless availability of bargain microcontroller programmers.

The use of field-programmable accessories on a microcontroller may acquiesce acreage amend of the firmware or admittance backward branch revisions to articles that accept been accumulated but not yet shipped. Programmable anamnesis additionally reduces the advance time appropriate for deployment of a fresh product.

Where hundreds of bags of identical accessories are required, appliance genitalia programmed at the time of accomplish can be an economical option. These "mask programmed" genitalia accept the affairs laid bottomward in the aforementioned way as the argumentation of the chip, at the aforementioned time.

A customizable microcontroller incorporates a block of agenda argumentation that can be alone in adjustment to accommodate added processing capability, peripherals and interfaces that are acclimatized to the requirements of the application. For example, the AT91CAP from Atmel has a block of argumentation that can be customized during architect according to user requirements.

Other microcontroller features

Microcontrollers usually accommodate from several to dozens of accepted purpose input/output pins (GPIO). GPIO pins arecomputer application configurable to either an ascribe or an achievement state. When GPIO pins are configured to an ascribe state, they are generally acclimated to apprehend sensors or alien signals. Configured to the achievement state, GPIO pins can drive alien accessories such as LEDs or motors.

Many anchored systems charge to apprehend sensors that aftermath analog signals. This is the purpose of the analog-to-digital advocate (ADC). Since processors are congenital to adapt and action agenda data, i.e. 1s and 0s, they are not able to do annihilation with the analog signals that may be beatific to it by a device. So the analog to agenda advocate is acclimated to catechumen the admission abstracts into a anatomy that the processor can recognize. A beneath accepted affection on some microcontrollers is a digital-to-analog advocate (DAC) that allows the processor to achievement analog signals or voltage levels.

In accession to the converters, abounding anchored microprocessors accommodate a array of timers as well. One of the best accepted types of timers is the Programmable Interval Timer (PIT). A PIT may either calculation bottomward from some amount to zero, or up to the accommodation of the calculation register, overflowing to zero. Once it alcove zero, it sends an arrest to the processor advertence that it has accomplished counting. This is advantageous for accessories such as thermostats, which periodically analysis the temperature about them to see if they charge to about-face the air conditioner on, the boiler on, etc.

A committed Pulse Width Modulation (PWM) block makes it accessible for the CPU to ascendancy ability converters, arresting loads, motors, etc., after application lots of CPU assets in bound timer loops.

Universal Asynchronous Receiver/Transmitter (UART) block makes it accessible to accept and address abstracts over a consecutive band with actual little amount on the CPU. Committed on-chip accouterments additionally generally includes capabilities to acquaint with added accessories (chips) in agenda formats such as I²C and Consecutive Peripheral Interface (SPI).

Higher integration

Micro-controllers may not apparatus an alien abode or abstracts bus as they accommodate RAM and non-volatile anamnesis on the aforementioned dent as the CPU. Application beneath pins, the dent can be placed in a abundant smaller, cheaper package.

Integrating the anamnesis and added peripherals on a distinct dent and testing them as a assemblage increases the bulk of that chip, but generally after-effects in decreased net bulk of the anchored arrangement as a whole. Even if the bulk of a CPU that has dent peripherals is hardly added than the bulk of a CPU and alien peripherals, accepting beneath chips about allows a abate and cheaper ambit board, and reduces the activity appropriate to accumulate and analysis the ambit board.

A micro-controller is a distinct dent circuit, frequently with the afterward features:

axial processing assemblage - alignment from baby and simple 4-bit processors to circuitous 32- or 64-bit processors

airy anamnesis (RAM) for abstracts storage

ROM, EPROM, EEPROM or Flash anamnesis for affairs and operating constant storage

detached ascribe and achievement bits, acceptance ascendancy or apprehension of the argumentation accompaniment of an alone amalgamation pin

consecutive input/output such as consecutive ports (UARTs)

added consecutive communications interfaces like I²C, Consecutive Borderline Interface and Controller Area Network for arrangement interconnect

peripherals such as timers, accident counters, PWM generators, and watchdog

alarm architect - generally an oscillator for a quartz timing crystal, resonator or RC circuit

abounding accommodate analog-to-digital converters, some accommodate digital-to-analog converters

in-circuit programming and debugging support

This affiliation acutely reduces the cardinal of chips and the bulk of base and ambit lath amplitude that would be bare to aftermath agnate systems application abstracted chips. Furthermore, on low pin calculation accessories in particular, anniversary pin may interface to several centralized peripherals, with the pin action called by software. This allows a allotment to be acclimated in a added array of applications than if pins had committed functions. Micro-controllers accept accepted to be awful accepted in anchored systems back their addition in the 1970s.

Some microcontrollers use a Harvard architecture: abstracted anamnesis buses for instructions and data, acceptance accesses to booty abode concurrently. Area a Harvard architectonics is used, apprenticeship words for the processor may be a altered bit admeasurement than the breadth of centralized anamnesis and registers; for example: 12-bit instructions acclimated with 8-bit abstracts registers.

The accommodation of which borderline to accommodate is generally difficult. The microcontroller vendors generally barter operating frequencies and arrangement architecture adaptability adjoin time-to-market requirements from their barter and all-embracing lower arrangement cost. Manufacturers accept to antithesis the charge to abbreviate the dent admeasurement adjoin added functionality.

Microcontroller architectures alter widely. Some designs accommodate general-purpose chip cores, with one or added ROM, RAM, or I/O functions dent assimilate the package. Added designs are purpose congenital for ascendancy applications. A micro-controller apprenticeship set usually has abounding instructions advised for bit-wise operations to accomplish ascendancy programs added compact.6 For example, a accepted purpose processor ability crave several instructions to analysis a bit in a annals and annex if the bit is set, area a micro-controller could accept a distinct apprenticeship to accommodate that commonly-required function.

Microcontrollers about do not accept a algebraic coprocessor, so amphibian point addition is performed by software.

Programming environments

Microcontrollers were originally programmed alone in accumulation language, but assorted high-level programming languages are now additionally in accepted use to ambition microcontrollers. These languages are either advised distinctively for the purpose, or versions of accepted purpose languages such as the C programming language. Compilers for accepted purpose languages will about accept some restrictions as able-bodied as enhancements to more good abutment the different characteristics of microcontrollers. Some microcontrollers accept environments to aid developing assertive types of applications. Microcontroller vendors generally accomplish accoutrement advisedly accessible to accomplish it easier to accept their hardware.

Many microcontrollers are so arbitrary that they finer crave their own non-standard dialects of C, such as SDCC for the 8051, which anticipate application accepted accoutrement (such as cipher libraries or changeless assay tools) alike for cipher different to accouterments features. Interpreters are generally acclimated to adumbrate such low akin quirks.

Interpreter firmware is additionally accessible for some microcontrollers. For example, BASIC on the aboriginal microcontrollers Intel 8052;7 BASIC and FORTH on the Zilog Z88 as able-bodied as some avant-garde devices. About these interpreters abutment alternate programming.

Simulators are accessible for some microcontrollers. These acquiesce a developer to assay what the behavior of the microcontroller and their affairs should be if they were application the absolute part. A actor will appearance the centralized processor accompaniment and additionally that of the outputs, as able-bodied as acceptance ascribe signals to be generated. While on the one duke best simulators will be bound from actuality clumsy to simulate abundant added accouterments in a system, they can exercise altitude that may contrarily be adamantine to carbon at will in the concrete implementation, and can be the quickest way to alter and assay problems.

Recent microcontrollers are generally chip with on-chip alter chip that back accessed by an in-circuit adversary via JTAG, acquiesce debugging of the firmware with a debugger.