Most of time this question is come to our mind that what is the Difference between a Microprocessor and Microcontroller ? Because both are used for mostly same purpose. So clear the doubt first we should know WHAT IS A MICROCONTROLLER? Two describe the difference I should mansion that these two devices are similar, but with a little bit of difference. A Microprocessor which is the heart of these devices needs a host of external devices to make it communicate with real-world. That means for a complete system would need a system to read the inputs or data from keyboard, after processing the result should write outputs to a terminal, need to store intermediate processing data into some memory, and finally it should need a place where to keep permanent information into some safe place. To make the successful system all those additional devices which are independent circuits, work in harmony with the Microprocessor, to make one system. This makes the system more flexible that means you can add more memory, change capacity of hard drives, add or remove CD-ROMs, sound cards etc and also the cost of maintanence is reduced like for a memory storage problem you just need to change the memory unit not the total system.
A microcontroller on the other hand is made up of most of these devices built exactly within the same package. Your microcontroller will therefore contain, the Microprocessor, RAM, ROM, Timers, I/O etc. all packed within one integrated circuit. This facilitates the development process, as well as reduce the requirements of external components, however this also means you cannot change, the number and type of integrated devices. The applications where a microcontroller will be used, vary. They are usually quite simple, and do not require as much processing power as a Microprocessor system needs, so the microcontrollers with varying amounts of RAM, ROM, I/O lines and timers etc have been made available. Essentially all are almost same, and they only vary in the number of resources available on them. So for a particular application you chose a microcontroller, not the one which has maximum resources, but the one which has just enough to do the job.
Thus a microcontroller is a complete, small scale computer with all the necessary devices on-board. All you need is the external hardware, which you want to drive, like sensors and motors etc.