Introduction of Microcontroller History of Microcontroller Microcontrollers Versus Microprocessors Constructions of Microcontroller Microcontroller Applications
Introduction of Microcontroller History of Microcontroller Microcontrollers Versus Microprocessors Constructions of Microcontroller Microcontroller Applications
Introduction of Microcontroller History of Microcontroller Microcontrollers Versus Microprocessors Constructions of Microcontroller Microcontroller Applications
History of microcontroller
Microcontrollers versus Microprocessors
Constructions of Microcontroller
Microcontroller Applications
Microcontroller
Circumstances that find the users in today in the field of microcontrollers had their
beginnings in the development of technology of integrated circuits. This
development has made it possible to store hundreds of thousands of transistors into
one chip. That was a prerequisite for production of microprocessors, and the first
computers were made by adding external peripherals such as memory, input-output
lines, timers and other. Further increasing of the volume of the package resulted in
creation of integrated circuits. These integrated circuits contained both processor
and peripherals. That is how the first chip containing a microcomputer, or what
would later be known as a microcontroller came about .
6
Microcontroller
Personal computers (PCs) are used to process high levels of data at high speed, and
incorporate microprocessor devices. These devices can be considered a ‘cousin’ of
the microcontroller devices, but are optimized to manipulating high volumes of
data and to provide the facilities for several tasks or windows to operate at any one
time.
2.2: History
7
Microcontroller
8
Microcontroller
–Interrupt system is an important feature, as microcontrollers have to respond
to control oriented devices in real time. E.g., opening of microwave oven’s
door cause an interrupt to stop the operation. (Most microprocessors can also
implement powerful interrupt schemes, but external components are usually
needed).
• Microprocessors are most commonly used as the CPU in microcomputer systems.
Microcontrollers are used in small, minimum component designs performing
control-oriented activities.
• Microprocessor instruction sets are _processing intensive_, implying powerful
addressing modes with instructions catering to large volumes of data. Their
instructions operate on nibbles, bytes, etc. Microcontrollers have instruction
sets catering to the control of inputs and outputs. Their instructions operate
also on a single bit. E.g., a motor may be turned ON and OFF by a 1-bit
output port
2.4.1:Memory unit
9
Microcontroller
Fig (2.1) Example of simplified model of a memory unit. For a specific input we get a
corresponding output .line R/W determines whether we are reading from or writing to memory.
Memory components are exactly like that. For a certain input get the contents of a
certain addressed memory location and that's all. Two new concepts are brought to:
addressing and memory location. Memory consists of all memory locations, and
addressing is nothing but selecting one of them. This means that we need to select
the desired memory location on one hand, and on the other hand need to wait for
the contents of that location. Beside reading from a memory location, memory
must also provide for writing onto it. This is done by supplying an additional line
called control line. So will designate this line as R/W (read/write).
10
Microcontroller
should occur. The size of program memory is 1024 locations with 14 bits width
where locations zero and four are reserved for reset and interrupt vector.
Let add 3 more memory locations to a specific block that will have a built in
capability to multiply, divide, subtract, and move its contents from one memory
location onto another. The part which have been just added in is called "central
processing unit" (CPU). Its memory locations are called registers.
Fig (2.2) Example of simplified central processing unit with three registers.
Registers are therefore memory locations whose role is to help with performing
various mathematical operations or any other operations with data wherever data
can be found. Look at the current situation. There are two independent entities
(memory and CPU) which are interconnected, and thus any exchange of data is
hindered, as well as its functionality. If, for example, adding the contents of two
memory locations and return the result again back to memory, that means need a
connection between memory and CPU. Simply stated, must have some "way"
through data goes from one block to another .
11
Microcontroller
2.4.3: Bus
Fig (2-3) Connecting memory and central unit using busses in order to gain on functionality
As far as functionality, the situation has improved, but a new problem has also
appeared: we have a unit that's capable of working by itself, but which does not
have any contact with the outside world, or with us! In order to remove this
deficiency, let's add a block which contains several memory locations whose one
end is connected to the data bus, and the other has connection with the output lines
on the microcontroller which can be seen as pins on the electronic component.
12
Microcontroller
Those locations are called "ports". There are several types of ports : input, output
or bidirectional ports. When working with ports, first of all it is necessary to
choose which port That to be need to work with, and then to send data to, or take it
from the port.
Fig (2-4) Example of simplified input-output unit that provides communication with external
world.
When working with it the port acts like a memory location. Something is simply
being written into or read from it, and it could be noticed on the pins of the
microcontroller.
PORTB/ has 8 pins joined to it. The appropriate register for direction of data is
TRISB at address 86h. Setting a bit in TRISB register defines the corresponding port
pin as an input pin, and resetting a bit in TRISB register defines the corresponding port
13
Microcontroller
pin as the output pin.
PORTA/ has 5 pins joined to it. The corresponding register for data direction is
TRISA at address 85h. Like with port B, setting a bit in TRISA register defines also
the corresponding port pin as an input pin, and clearing a bit in TRISA register defines
the corresponding port pin as an output pin.
14
Microcontroller
2.4.6: Watchdog
Fig(2-6)
Of course, when this happens with a computer, simple to reset it and it will keep
working. However, there is no reset button we can push on the microcontroller and
thus solve problem. To overcome this obstacle, just need to introduce one more
block called watchdog. This block is in fact another free-run counter where our
program needs to write a zero in every time it executes correctly. In case that
program gets "stuck", zero will not be written in, and counter alone will reset the
microcontroller upon achieving its maximum value. This will result in executing
the program again, and correctly this time around.
As the peripheral signals usually are substantially different from the ones that
microcontroller can understand (zero and one), they have to be converted into a
pattern which can be comprehended by a microcontroller. This task is performed
15
Microcontroller
by a block for analog to digital conversion or by an ADC. This block is responsible
for converting an information about some analog value to a binary number and for
follow it through to a CPU block so that CPU block can further process it [3].
16
Microcontroller
For a real application, a microcontroller alone is not enough. Beside a
microcontroller, we need a program that would be executed, and a few more
elements which make up a interface logic towards the elements of regulation [1].
17