At its most basic level, a microcontroller is a very small computer that can be used to handle tasks that are complex. They are programmable, erasable, flexible and can interface with many different types of devices in very useful ways. These devices make a great deal of automation technology possible.
A microcontroller contains the basic parts of a computer arranged in what are called blocks. These blocks contain the various components. Microcontrollers also contain components that allow all these different parts—processor, memory, etc.—to communicate with one another. Those devices are called buses.
Like a computer, a microcontroller is given a program, uses memory, processor and data communication to process the instructions from that program and controls peripherals via outputs that are in the form of pins. These pins also serve as the input for the device.