A microcontroller is essentially a computer on a chip. It contains a processing unit, ROM, RAM, Serial communication ports, ADCs, etc. In other words, a microcontroller is a computer but without the monitor, keyboard and mouse. They are called microcontrollers because they are small (micro) and because they control machines, gadgets, etc.
With a microcontroller you can build an ‘’intelligent’’ machine. You start by writing a program on a host computer, download the program into the microcontroller via the USB, parallel or serial port of the PC; and then disconnect the programming cable and let the program run the machine.
Microcontrollers are used in a wide array of applications including telecommunication equipment, home appliances, airplanes, data loggers, in robots where the microcontroller acts as the robot’s brain, controlling and monitoring various inputs and output devices such as light sensors, stepper and servo motors, among other devices. With a little bit of programming you can make the robot avoid objects, sweep the floor, generate various sounds to indicate a certain message e.g. low power. A microcontroller in a microwave oven monitors the control panel for user input, updates the graphical displays when necessary, and controls the timing & cooking functions, and store data as cooking time.
Basic Structure of a Microcontroller
A microcontroller usually contains:
- CPU
- RAM, ROM, EPROM, EEPROM or Flash (non-volatile software data)
- I/O ports (digital I/O ports)
- Timing circuitry/leads
- Interrupt control
- A serial port and adapter (e.g. UART, USART, SPI, I2C)
- ADC/DAC
The CPU executes the software stored in ROM and controls all the microcontroller components.
RAM is used to store temporary data (settings & values) needed during program execution.
The ROM is used to store the program and any permanent data. A designer can have a program and data permanently stored in ROM by the chip manufacturer or the ROM can be in the form of EPROM or EEPROM which can be reprogrammed by the user. Software permanently stored in ROM is termed to as firmware.
Recommended: The Ultimate Guide to Electrical Maintenance
Microcontrollers makers offer programming devices that can download compiled machine code from a PC directly to the EEPROM of the microcontroller, usually via the PC serial port and special-purpose pins on the microcontroller. These pins can be used for other purposes once the device is programmed. Also, EEPROM may also be available and used by the program to store settings and parameters generated or modified during execution. The data in EEPROM is non-volatile, which means the program can access the data when the microcontroller power is turned off and back on again.
The serial port adapter is used to provide serial communication between the microcontroller and a PC or between two microcontrollers. It is responsible for controlling the different rates of data flow common between devices. Serial port adapters found in microcontroller are the universal asynchronous receiver transmitter (UART), and universal synchronous/asynchronous receiver transmitter (USART).The serial port can be used to transmit data to and from external devices, provided these devices support the same serial communication protocol. These devices may include: external EEPROM memory ICs that might store a large block of data for the microcontroller and other microcontrollers that need to share data and coordinate control and host computer that may download a program into the microcontroller’s board EEPROM. Some microcontrollers include an interface for a universal serial bus (USB) on the chips.
The digital I/O ports allow binary data to be transferred to and from the microcontroller using external pins on the IC. These pins can be used to read the state of switches and on-off sensors, to interface to external A/D and D/A, to control digital displays, to control on-off actuators etc. The I/O ports can be also be used to transmit signals to and from other microcontrollers to coordinate various functions.
Don’t miss out on key updates, join our newsletter List
Related: Microprocessors
An interrupt system is used to interrupt a running program in order to process a special routine called routine service. This makes it possible for a microcontroller to respond to external data that requires immediate attention e.g. data conveyed by an external sensor indicating a shut down.
The A/D converter allows the microcontroller to convert an external analog voltage e.g. from a sensor to digital value that can be processed or stored by the CPU. The D/A converter allows the microcontroller to output an analog voltage to non-digital device e.g. amplifiers, analog actuators, analog displays etc.
Also read: Serial Interface
Comments
6 responses to “Basic Structure of a Microcontroller”
[…] Related: Microcontrollers […]
[…] increasing application of microcontrollers in low cost sensors and actuators has provided opportunities for adding diagnosis and configuration […]
[…] oscillator is the most appropriate frequency determining device in virtually all microprocessors, microcontrollers, PICs and CPUs; It is used to generate their clock waveforms. To generate a microprocessor clock, […]
[…] Related: Basic Structure of Microcontroller […]
[…] include electronic components and some means of computer monitoring and control. Increasingly, microcontrollers are embedded in electromechanical devices creating much more flexibility and control possibilities […]
[…] Basic Structure of a Microcontroller […]