We are living in an era where computers are everywhere. We interact with these computers every day.
Broadly computers are of two types, General purpose computer like laptop or desktop computer and the other one are embedded computer. The embedded computer has very small processing power and memory.
There are many different definitions of an embedded system. In a large system, if the system has a computational device like the processor then the system is known as an Embedded System.
An Embedded system has microcontroller or microprocessor embedded on it.
A microprocessor is a digital system which has computational capabilities. It requires an external memory. Embedded systems require a small memory but it may be possible that the system requires expendable memory. In this case, we use microprocessor in the system.
The microcontroller is the heart of any Embedded System. A microcontroller is an Integrated Circuit which has a processor, RAM, ROM, Input/Output Ports and peripheral devices integrated on a single chip. We can program this microcontroller by using our computer. The microcontrollers have smaller memory and processing power because most of the system doesn't require high computational power and memory.
The microprocessor is not going to work without memory. There are different types of memory available in a microcontroller like RAM and ROM.
Read-Only Memory is a non-volatile memory which means that the data in the memory doesn't erase if the power goes off. It is used as program memory in an Embedded System. All the programs are saved in this memory. CPU fetches the instruction saved in this memory and executes them.
Random-Access Memory is a volatile memory which means that the data is this memory is erased if the power goes off. It is used as data memory in an Embedded System.
A microprocessor is a digital device. It understands only digital data. However, the sensor converts the physical signal into analog signal and we can't process the analog signal into a digital device. An ADC is an electronic device which converts the analog signal into the digital bits so that it can be processed by a digital system like a microprocessor.
A microprocessor takes digital data and processes that data and generates digital data. The digital data is useless for the real world. It has to be converted into analog form. The DAC takes digital data and converts that data into analog form.
The microcontroller doesn't contain any DAC module. The digital data is converted into analog form by Pulse Width Modulation technique.
For interfacing input and output devices, microcontrollers have input-output ports. These ports can be used as an input port or an output port. A port contains pins. We can configure each pin separately or simultaneously.