A microcontroller is a compact integrated circuit that is designed to control or monitor a specific operation in an embedded system. In a typical microcontroller a processor, memory and input/output (I/O) peripherals are included on a single chip. It is sometimes called the embedded controller or microcontroller unit (MCU).
Microcontrollers are found in vehicles, robots, machines, mobile radio transceivers, computers, home appliances etc. Some microcontrollers work on clock pulse rate and use 4-bit expressions. Microcontrollers generally work on low power. This is because most of the devices that they control are battery operated.
Elements of a Microcontroller
A microcontroller, as it is an embedded system, has some peripherals included on a single chip. These are:
Processor/CPU
The processor/CPU is the main component responsible for the operations carried out by the controller. The processor/CPU also processes and responds to the various instructions. During this, the processor/CPU performs basic arithmetic, logic and input-output operations and data transfer operations that communicate commands to other components in the larger embedded systems.
Memory
Memory of the microcontroller is used to store data which the CPU receives and uses the same to respond to instructions for which it is programmed. The two main memory types are:
- Program memory: Program memory is the memory that stores long-term information about the instruction which CPU will carry out. Program memory is a non-volatile memory, which means that the program memory will hold information over time without the need of power source.
- Data memory: Data memory is the type of memory required for temporary data storage during the execution of instructions. Data memory is a volatile memory, which means that the data memory holds data on a temporary basis. The data memory is maintained only when the device is connected to a power source.
I/O Peripherals
The input and output devices act as the interface between the processor and the outside world. The input ports would receive information and send them to the processor in the form of binary data. The data is received by the processor and then it sends necessary instruction to output devices that will execute tasks external to microcontroller.
For a microcontroller, the processor, memory and I/O peripherals are considered defining elements, there can be other elements which are often included. Some such supporting elements are:
- Analog to digital converter (ADC): ADC is a circuit that will convert analog signals into digital signals. ADC is used to interface an analog input device like a sensor to the CPU of the microcontroller.
- Digital to Analog Converter (DAC): DAC is a circuit that will convert digital signals into analog signals. DAC is used for communication of the outgoing signals to the external analog components.
- System Bus: The system bus is the connective wire which would link all components of the microcontroller together.
- Serial Port: The serial port is one example of an I/O port that will allow the microcontroller to connect with the external components. The serial port is similar to a USB port or a parallel port. The only difference is in the way it exchanges bits.
Working of Microcontrollers
A microcontroller is chip which is a high-speed device. Microcontroller is slower as compared to a computer. So, each command is executed quickly within a microcontroller. A quartz oscillator is present in the microcontroller which is enabled by the logic control register when the supply to the microcontroller is turned on.
The parasite capacitors (it is the unwanted capacitance existing between the parts of electronic components or circuit because of their close proximity to each other) are recharged for a few seconds during the early preparation. After the voltage reaches maximum value, and the oscillator frequency stabilizes, the operation of writing bits also stabilizes.
Microcontrollers for embedded systems
The microcontrollers and microprocessors are widely used in embedded system products. The embedded products use a microcontroller or a microprocessor to do one task only, for example, a printer. The processor inside a printer performs only one task, getting data and printing it.
Some examples of embedded products using microcontrollers are:
- Home: Appliances, Intercom, Telephones, Security systems, Answering Machines, Fax machines, Home computers, TVs, Cable TV tuner, VCR, cam recorder, Remote Controls, Camera, etc.
- Office: Telephones, computers, Security systems, Fax machines, Microwave, Copier, Laser printer, colour printer, etc.
- Auto: Trip counter, Engine control, Air bag, Instrumentation, Security system, Transmission control, Entertainment, Climate control, Cellular phone, Keyless entry, etc.
The writing of bits takes place through special function registers. All these are controlled by oscillator’s clock pulse and the whole electronics begins the function. The entire process occurs in nanoseconds.
Choosing a Microcontroller
There are four major 8-bit microcontrollers. They are: Freescale’s 6811, Intel’s 8051, Zilog’s Z8, and PIC 16X by the Microchip Technology. Each of these microcontrollers has a unique set of instruction and register set. So, these are not compatible with each other. Therefore, if a program is written for one microcontroller, it will not run on any other controller. 16-bit and 32-bit microcontrollers are also available in the market.
The three criterions to choose microcontrollers are as follows:
- Meet the computing needs of the task at hand efficiently and cost effectively.
- The availability of software development tools such as compilers, assemblers, and debuggers. A code-efficient C language compiler is recommended.
- Wide availability and reliable sources of microcontrollers.
To analyze the computing needs of the microcontroller application the following need to be kept into consideration:
- Speed: Highest speed supported by the microcontroller.
- Packaging: The microcontroller comes in which type of packing like, is it a 4-pin Dip (Dual inline package) or a QFP (quad flat package), or some other packaging format. All these are important in terms of space, assembling, and prototyping the end product.
- Power consumption: It is critical for battery powered products.
- The amount of RAM and ROM on chip.
- The number of I/O pins on chip.
- The number of timers on chip.
- Ease of upgradation to high-performance or lower-consumption versions.