Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
Transcript of Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
-
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
1/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
TOC Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7
Architecture and programming of 8051 MCU's
Chapter1: Introduction to Microcontrollers
1.1 What are microcontrollers and what are they used for?
1.2 What is what in microcontroller?
Introduction
It was electricity in the beginning....The people were happy because they did not know that it was all around them and could be utilized.
That was good. Then Faraday came and a s tone has started to roll slowly...
The first machines using a new s ort of energy appeared soon. A long time has pas sed s ince then and just when the people finally got
used to them and stopped paying attention to what a new generation of specialists were doing, someone came to an idea that electrons
could be a very convenient toy being closed in a glass pipe. It was just a good idea a t first, but there was no return. Electonics was born
and the s tone kept on rolling down the hill faster and faster...
A new science - new s pecialis ts. Blue coats were replaced with white ones and people who knew something about electronics appeared
on the stage. While the rest of humanity were passively watching in disbelief what was going on, the plotters split in two groups - s oftware-
oriented and hardware-oriented. Somewhat younger than their teachers, very enthusiastic and full of ideas, both of them kept on working
but separate ways. While the first group was developing cons tantly and gradually, the hardware-oriented people, driven by success , threw
caution to the wind and invented transistors.
Up till that moment, the things could be more or less kept under control, but a broad publicity was not aware ofwhat was going on, which
soon led to a fatal mistake! Being naive in belief that cheap tricks could s low down technology development and development of the world
and retrieve the good all days, mass market opened its doors for the products of Electronics Industry, thus clos ing a m agic circle. A rapid
drop in prices made these components available for a great variety of people. The stone was falling freely...
The first integrated circuits and processors appeared s oon, which caused computers and other products of electronics to drop down in
price even more. They could be bought everywhere. Another circle was closed! Ordinary people got hold of com puters and computer era
has begun...
While this drama was going on, hobbyists and professionals , also split in two groups and protected by anonymity, were working hard on
Featured Development Tools
Easy8051 v6 Development
System
The Easy8051 v6 is compatible w ith 14-,
16-, 20-, 28-, 40-pin PLCC44 and PLCC32
MCUs. It comes w ith an AT89S8253. The
board has a USB 2.0 programmer and
many peripherals such as COG, port
expander, MENU and 4x4 keypads etc.
[more info]
mikroProg for 8051
mikroProg for 8051 is supported w ith
mikroC, mikroBasic and
mikroPascal compilers for 8051. You
may also use mikroProg for 8051 as a
Login | Cart (0)
Products Solutions Store Distributors Libstock Contact Us Enter keywords
http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/products/view/267/architecture-and-programming-of-8051-mcu-s/http://www.mikroe.com/chapters/view/64/chapter-1-introduction-to-microcontrollers/http://www.mikroe.com/chapters/view/65/chapter-2-8051-microcontroller-architecture/http://www.mikroe.com/chapters/view/66/chapter-3-the-8051-instruction-set/http://www.mikroe.com/chapters/view/67/chapter-4-at89s8253-microcontroller/http://www.mikroe.com/chapters/view/68/chapter-5-assembly-language/http://www.mikroe.com/chapters/view/69/chapter-6-examples/http://www.mikroe.com/chapters/view/70/chapter-7-development-systems/http://www.mikroe.com/easy8051/http://www.mikroe.com/http://www.mikroe.com/store/http://www.mikroe.com/distributors/http://www.libstock.com/http://www.mikroe.com/visitor_contacts/http://www.mikroe.com/http://www.mikroe.com/store/http://www.mikroe.com/distributors/http://www.libstock.com/http://www.mikroe.com/visitor_contacts/http://www.mikroe.com/mikroprog/8051/http://www.mikroe.com/mikroprog/8051/http://www.mikroe.com/mikroprog/8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.mikroe.com/products/view/267/architecture-and-programming-of-8051-mcu-s/http://www.mikroe.com/chapters/view/64/chapter-1-introduction-to-microcontrollers/http://www.mikroe.com/chapters/view/65/chapter-2-8051-microcontroller-architecture/http://www.mikroe.com/chapters/view/66/chapter-3-the-8051-instruction-set/http://www.mikroe.com/chapters/view/67/chapter-4-at89s8253-microcontroller/http://www.mikroe.com/chapters/view/68/chapter-5-assembly-language/http://www.mikroe.com/chapters/view/69/chapter-6-examples/http://www.mikroe.com/chapters/view/70/chapter-7-development-systems/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/easy8051/http://www.mikroe.com/mikroprog/8051/http://www.mikroe.com/mikroprog/8051/http://www.mikroe.com/users/login/http://www.mikroe.com/carts/mini/http://www.mikroe.com/http://www.mikroe.com/store/http://www.mikroe.com/distributors/http://www.libstock.com/http://www.mikroe.com/visitor_contacts/ -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
2/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
their projects. Then, someone s uddenly put a question: Why should not we make a universal component? A cheap, universal integrated
circuit that could be program med and used in any field of electronics, device or wherever needed? Technology has been developed
enough as well as the market. Why not? So it happened, body and spirit were united and the first integrated circuit was des igned and
called the MICROCONTROLLER.
1.1 What are microcontrollers and what are they used for?
Like all good things, this powerful component is bas ically very simple. It is m ade by mixing tested and high- quality "ingredients"
(components) as per following receipt:
On the basis of these rules, numerous types of m icrocontrollers were des igned and they quickly became m an's invisible companion. Their
incredible sim plicity and flexibility conquered us a long time ago and if you try to invent something about them, you should know that you
are probably late, someone before you has e ither done it or at least has tried to do it.
The following things have had a crucial influence on development and success of the microcontrollers:
Powerful and carefully chosen electronics embedded in the microcontrollers can independetly or via input/output
devices (switches, push buttons, sensors, LCD displays, relays etc.), control various processes and devices such as
industrial automation, electric current, temperature, engine performance etc.
Very low prices enable them to be embedded in such devices in which, until recent time it was not worthwhile to
embed anything. Thanks to that, the world is overwhelmed today with cheap automatic devices and various smart
appliences.
Prior knowledge is hardly needed for programming. It is sufficient to have a PC (software in use is not demanding at all
and is easy to learn) and a simple device (called the programmer) used for loading raedy-to-use programs into the
microcontroller.
So, if you are infected with a virus called electronics, there is nothing left for you to do but to learn how to us e and control its power.
How does the microcontroller operate?
Even though there is a large num ber of different types of m icrocontrollers and even more programs created for their use only, all of them
have many things in comm on. Thus, if you learn to handle one of them you will be able to handle them all. A typical scenario on the basis of
which it all functions is as follows:
Featured Compilers
standalone programming tool. [more info]
mikroBasic PRO for 8051
The 8051 core combined with modern
modules is popular in the past. With
mikroBasic you can quickly develop
your projects. [more info]
1. The simplest computer processor is used as the "brain" of the future system.
2. Depending on the taste of the manufacturer, a bit of memory, a few A/D converters, timers, input/output lines etc.
are added
3. All that is placed in some of the standard packages.
4. A simple software able to control it all and which everyone can easi ly learn about has been developed.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.mikroe.com/mikroprog/8051/http://www.mikroe.com/mikrobasic/8051/http://www.mikroe.com/mikrobasic/8051/http://www.mikroe.com/mikrobasic/8051/ -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
3/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
1. Power supply is turned off and everything is st illthe program is loaded into the microcontroller, nothing indicates
what is about to come
2. Power supply is turned on and everything starts to happen at high speed! The control logic unit keeps everything
under control. It disables all other circuits except quartz crystal to operate. While the preparations are in progress,
the first milliseconds go by.
3. Power supply voltage reaches its maximum and oscillator frequency becomes stable. SFRs are being filled with
bits reflecting the state of all circuits within the microcontroller. All pins are configured as inputs. The overall
electronis starts operation in rhythm with pulse sequence. From now on the time is measured in micro and
nanoseconds.
4. Program Counter is set to zero. Instruction from that address is sent to instruction decoder which recognizes it,
after which it is executed with immediate effect.
5. The value of the Program Counter is incremented by 1 and the whole process is repeated...several million times
per second.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
4/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
1.2 What is what in the microcontroller?
As you can see, all the operations within the m icrocontrol ler are perform ed at high s peed and quite s imply, but the microcontrolle r itself
would not be s o useful if there are not special circuits which m ake it complete. In continuation, we are going to call your attention to them.
Read Only Memory (ROM)
Read Only Memory (ROM) is a type of memory used to permanently save the program being executed. The size of the program that can be
written depends on the s ize of this mem ory. ROM can be built in the m icrocontroller or added as an external chip, which depends on the
type of the microcontroller. Both options have some disadvantages. If ROM is added as an external chip, the microcontroller is cheaper and
the program can be cons iderably longer. At the same time, a number of available pins is reduced as the m icrocontroller uses its own
input/output ports for connection to the chip. The internal ROM is us ually smaller and more expensive, but leaves m ore pins available for
connecting to peripheral environment. The size of ROM ranges from 512B to 64KB.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
5/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Random Access Memory (RAM)
Random Access Memory (RAM) is a type of memory used for temporary storing data and intermediate results created and used during the
operation of the microcontrollers. The content of this m emory is cleared once the power supply is o ff. For example, if the program
performes an addition, it is neces sary to have a regis ter standing for what in everyday life is called the sum . For that purpose, one of the
registers in RAM is called the "sum" and used for storing results of addition. The size of RAM goes up to a few KBs.
Electrically Erasable Programmable ROM (EEPROM)
The EEPROM is a special type of mem ory not contained in all m icrocontrollers. Its contents m ay be changed during program execution
(sim ilar to RAM ), but remains permanently saved even after the loss of power (sim ilar to ROM). It is often used to store values, created and
used during operation (such as calibration values, codes , values to count up to etc.), which mus t be saved after turning the power supply
off. A disadvantage of this memory is that the process of programming is relatively slow. It is m easured in m iliseconds.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
6/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Special Function Registers (SFR)
Special function registers are part of RAM mem ory. Their purpose is predefined by the manufacturer and cannot be changed therefore.
Since their bits are physically connected to particular circuits within the microcontroller, such as A/D converter, serial com munication
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
7/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
module etc., any change of their s tate directly affects the operation of the m icrocontroller or s ome of the circuits. For example, writing zero
or one to the SFR controlling an input/output port causes the appropriate port pin to be configured as input or output. In other words, each
bit of this register controls the function of one single pin.
Program Counter
Program Counter is an engine running the program and points to the m emory address containing the next instruction to execute. After each
instruction execution, the value of the counter is increm ented by 1. For this reas on, the program executes only one instruction at a time jus t
as it is written. Howeverthe value of the program counter can be changed at any moment, which causes a jump to a new m emory
location. This is how subroutines and branch ins tructions are executed. After jumping, the counter resumes even and monotonous
automatic counting +1, +1, +1
Central Processor Unit (CPU)
As its nam e suggests, this i s a uni t which monitors and controls all proces ses within the m icrocontrol ler and the us er cannot affect its
work. It consists of several smaller s ubunits, of which the most im portant are:
Instruction decoderis a part of the electronics which recognizes program instructions and runs other circuits on the
basis of that. The abilities of this circuit are expressed in the "instruction set" which is different for each microcontroller
family.
Arithmetical Logical Unit (ALU) performs all mathematical and logical operations upon data.Accumulatoris an SFR closely related to the operation of ALU. It is a kind of working desk used for storing all data
upon which some operations should be executed (addition, shift etc .). It also stores the results ready for use in further
processing. One of the SFRs, called the Status Register, is closely related to the accumulator, showing at any given
time the "status" of a number stored in the accumulator (the number is greater or less than zero etc.).
A bit is jus t a word invented to confuse novices at electronics. Joking as ide, this word in practice indicates whether the voltage is pres ent
on a conductor or not. If it is present, the approprite pin is s et to logic one (1), i.e. the bits value is 1. Otherwise, if the voltage is 0 V, the
appropriate pin is cleared (0), i.e. the bits value is 0. It is more complicated in theory where a bit is referred to as a b inary digit, but even in
this case, its value can be either 0 or 1.
Input/output ports (I/O Ports)
In order to make the microcontroller useful, it is neces sary to connect it to peripheral devices. Each microcontroller has one or more
registers (called a port) connected to the microcontroller pins.
Why do we call them input/output ports?
Because it is poss ible to change a pin function
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
8/14
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
according to the user's needs. These regis ters
are the only registers in the m icrocontroller the
state of which can be checked by voltmeter!
Oscillator
Even pulses gene rated by the oscillator enable harmonic and synchronous
operation of all circuits within the microcontroller. It is usually configured as to us e
quartz-crystal or ceramics resonator for frequency stabilization. It can als o operate
without elements for frequency stabilization (like RC oscillator). It is im portant to say
that program ins tructions are not executed at the rate imposed by the oscillator itself,
but several times s lower. It happens because each ins truction is executed in several
steps. For som e microcontrollers, the same number of cycles is needed to execute
any instruction, while it's different for other microcontrollers. Accordingly, if the
system uses quartz crystal with a frequency of 20MHz, the execution time of an
instruction is not expected 50nS, but 200, 400 or even 800 nS, depending on the type
of the m icrocontroller!
Timers/Counters
Most programs us e these m iniature electronic "stopwatches" in their operation. These are comm only 8- or 16-bit SFRs the contents of
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
9/14
df d mi b PRO i Are you a developer? Try out the HTML to PDF API
which is automatically incremented by each coming puls e. Once the register is com pletely loaded, an interrupt is generated!
If these registers us e an internal quartz oscillator as a clock source, then it is poss ible to measure the time between two events (if the
register value is T1 at the moment measurement has started, and T2 at the moment it has finished, then the elapsed time is equal to the
result of subtraction T2-T1 ). If the registers us e pulses coming from external source, then such a timer is turned into a counter.
This is only a simple explanation of the operation itself. Its somehow more com plicated in practice.
A registeror a memory cell is an electronic circuit which can mem orize the state of one byte. Besides 8 bits available to the user, each
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
10/14
df di b PRO i Are you a developer? Try out the HTML to PDF API
register has als o a number of address ing bits. It is im portant to remember that:
All registers of ROM as well as those of RAM referred to as general-purpose registers are mutually equal and
nameless. During programming, each of them can be assigned a name, which makes the whole operation much
easier.
All SFRs are assigned names which are different for different types of the microcontrollers and each of them has a
special function as their name suggests.
Watchdog timer
The Watchdog Timer is a timer connected to a com pletely separate RC oscillator within the microcontroller.
If the watchdog timer is enabled, every time it counts up to the program end, the microcontroller reset occurs and program execution starts
from the first instruction. The point is to prevent this from happening by using a special command. The whole idea is based on the fact that
every program is executed in several longer or s horter loops.
If instructions res etting the watchdog timer are set at the appropriate program locations, bes ides commands being regularly executed,
then the operation of the watchdog tim er will not affect the program execution.
If for any reason (us ually electrical noise in industry), the program counter "gets s tuck" at some m emory location from which there is no
return, the watchdog will not be cleared, so the regis ters value being constantly incremented will reach the m aximum et voila! Reset
occurs!
Power Supply Circuit
There are two things worth attention concerning the m icrocontroller power supply circuit:
Brown out is a potentially dangerous s tate which occurs
at the momen t the microcontroller is being turned off or
when power s upply voltage drops to the lowes t level due
to electric noise. As the m icrocontroller consis ts of
several circuits which have different operating voltage
levels, this can cause its out of control performance. In
order to prevent it, the microcontroller usually has a
circuit for brown out reset built-in. This circuit
imm ediately resets the whole electronics when the
voltage level drops below the lower limit.
Reset pin is us ually referred to as Master Clear Reset
(MCLR) and s erves for external reset of the
microcontroller by applying logic zero (0) or one (1)
depending on the type of the m icrocontroller. In case the
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
11/14
df di b PRO i A d l ? T t th HTML t PDF API
brown out is not built in the microcontroller, a simple
external circuit for brown out reset can be connected to
this pin.
Serial communication
Parallel connections between the
microcontroller and peripherals established
over I/O ports are the ideal solution for s horter
distances up to several meters. However, in
other cases, when it is necess ary to establish
communication between two devices on longer
distances it is obviously not possible to use
parallel connections. Then, serial
communication is the best solution.
Today, most m icrocontrollers have s everal
different systems for serial com munication built in as a standard equipment. Which of them will be used depends on m any factors of
which the most important are:
How many devices the microcontroller has to exchange data with?How fast the data exchange has to be?
What is the distance between devices?
Is it necessary to send and receive data simultaneously?
One of the most important things concerning serial communication is the Protocol which should be strictly observed. It is a s et of rules
which must be applied in order that devices can correctly interpret data they mutually exchange. Fortunately, the microcontrollers
automatically take care of this, so the work of the programmer/user is reduced to a sim ple write (data to be sent) and read (received data).
A byte consists of 8 bits grouped together. If a bit is a digit then it is logical that bytes are numbers. All mathematical operations can be
performed upon them, jus t like upon common decimal num bers, which is carried out in the ALU. It is im portant to remem ber that byte
digits are not of equal significance. The largest value has the leftmost bit called the mos t significant bit (MSB). The rightmos t bit has the
least value and is therefore called the leas t significant bit (LSB). Since 8 digits (zeros and ones) of one byte can be com bined in 256
different ways, the larges t decimal num ber which can be represented by one byte is 255 (one combination represents zero).
Program
Unlike other integrated circuits which only need to be connected to other components and turn the power supply on, the microcontrollers
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
12/14df di b PRO i A d l ? T t th HTML t PDF API
need to be programm ed first. This is a s o called "bitter pill" and the main reason why hardware-oriented electronics engineers stay away
from microcontrollers. It is a trap causing huge los ses because the process of programm ing the microcontroller is basically very sim ple.
In order to write a program for the microcontroller, several "low-level" programming languages can be us ed such as Assembly, C and
Basic (and their versions as well). Writing program procedure consists of simple writing instructions in the order in which they should be
executed. There are also m any programs running in Windows environment used to facilitate the work providing additional visual tools.
This book describes the use of Assem bly because it is the simplest language with the fastest execution allowing entire control on what is
going on in the circuit.
Interrupt - electronics is usually more faster than physical processes it should k eep under control. This is why the microcontroller spends
most of its time waiting for something to happen or execute. In other words, when some event takes place, the microcontroller does
something. In order to prevent the microcontroller from spending most of its time endlessly checking for logic state on input pins and
registers, an interrupt is generated. It is the signal which informs the central processor that something attention worthy has happened. As its
name suggests, it interrupts regular program execution. It can be generated b y different sources so when it occurs, the microcontroller
imm ediately stops operation and checks for the cause. If it is needed to perform som e operations, a current state of the program counter is
pushed onto the Stack and the appropriate program is executed. It's the so called interrupt routine.
Stackis a part of RAM used for storing the current state of the program counter (address) when an interrupt occurs. In this way, after a
subroutine or an interrupt execution, the microcontroller knows from where to continue regular program execution. This address is cleared
after returning to the program because there is no need to save it any longer, and one location of the stack is automatically availale for
further use. In addition, the stack can consist of several levels. This enab les subroutines nesting, i.e. calling one subroutine from another.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
13/14df di b PRO i
Are you a developer? Try out the HTML to PDF API
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
7/29/2019 Www Mikroe Com Chapters View 64 Chapter 1 Introduction to Mi
14/14Are you a developer? Try out the HTML to PDF API
table of contents | next chapter
MikroElektronika Embedded Solutions Follow us on
PIC Solution
PIC Development Boards
PIC Compilers
PIC Programm ers/Debuggers
PIC Kits
PIC Books
AVR Solution
AVR Development Boards
AVR Compilers
AVR Programmers/Debuggers
AVR Kits
dsPIC Solution
dsPIC Development Boards
dsPIC Compilers
dsPIC Programmers/Debuggers
dsPIC Kits
dsPIC Books
ARM Solution
ARM Development Boards
ARM Com pilers
ARM Programmers/Debuggers
ARM Kits
PIC32 Solution
PIC32 Developmen t Boards
PIC32 Compilers
PIC32 Programmers/Debuggers
PIC32 Kits
8051 Solution
8051 Development Boards
8051 Com pilers
8051 Programmers/Debuggers
8051 Books
8051 Kits
Add-on boards
Click Boards
mikromedia shields
Comm unication boards
Storage boards
Real Time C lock boards
Display boards
Measurement boards
Audio & Voice boards
Power Supply boards
GPS boards
GSM/GPRS boards
Additional Software
Visual TFT
Visual GLCD
Package Manager
GLCD Font Creator
Support Forum mikroBUS Lets make Press Legal Information Product Archive About Us
Copyright 1998 - 2013. MikroElektronika. All rights reserved. All trade and/or serv ices marks mentioned are the property of their respective owners.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.mikroe.com%2fchapters%2fview%2f64%2fchapter-1-introduction-to-microcontrollers%2f&id=ma-130201202043-60a226cehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.mikroe.com/products/view/267/architecture-and-programming-of-8051-mcu-s/http://www.mikroe.com/chapters/view/65/chapter-2-8051-microcontroller-architecture/http://www.mikroe.com/pic/http://www.mikroe.com/pic/development-boards/http://www.mikroe.com/pic/compilers/http://www.mikroe.com/pic/programmers-debuggers/http://www.mikroe.com/pic/kits/http://www.mikroe.com/pic/books/http://www.mikroe.com/avr/http://www.mikroe.com/avr/development-boards/http://www.mikroe.com/avr/compilers/http://www.mikroe.com/avr/programmers-debuggers/http://www.mikroe.com/avr/kits/http://www.mikroe.com/dspic/http://www.mikroe.com/dspic/development-boards/http://www.mikroe.com/dspic/compilers/http://www.mikroe.com/dspic/programmers-debuggers/http://www.mikroe.com/dspic/kits/http://www.mikroe.com/dspic/books/http://www.mikroe.com/arm/http://www.mikroe.com/arm/development-boards/http://www.mikroe.com/arm/compilers/http://www.mikroe.com/arm/programmers-debuggers/http://www.mikroe.com/arm/kits/http://www.mikroe.com/pic32/http://www.mikroe.com/pic32/development-boards/http://www.mikroe.com/pic32/compilers/http://www.mikroe.com/pic32/programmers-debuggers/http://www.mikroe.com/pic32/kits/http://www.mikroe.com/8051/http://www.mikroe.com/8051/development-boards/http://www.mikroe.com/8051/compilers/http://www.mikroe.com/8051/programmers-debuggers/http://www.mikroe.com/8051/books/http://www.mikroe.com/8051/kits/http://www.mikroe.com/add-on-boards/http://www.mikroe.com/click/http://www.mikroe.com/mikromedia/shields/http://www.mikroe.com/add-on-boards/communication/http://www.mikroe.com/add-on-boards/storage/http://www.mikroe.com/add-on-boards/rtc/http://www.mikroe.com/add-on-boards/display/http://www.mikroe.com/add-on-boards/measurement/http://www.mikroe.com/add-on-boards/audio-voice/http://www.mikroe.com/add-on-boards/power-supply/http://www.mikroe.com/add-on-boards/gps/http://www.mikroe.com/add-on-boards/gsm-gprs/http://www.mikroe.com/additional-software/http://www.mikroe.com/visualtft/http://www.mikroe.com/visualglcd/http://www.mikroe.com/package-manager/http://www.mikroe.com/glcd-font-creator/http://www.mikroe.com/esupport/http://www.mikroe.com/forum/http://www.mikroe.com/mikrobus/http://www.mikroe.com/make_projects/http://www.mikroe.com/about/press/http://www.mikroe.com/legal/http://www.mikroe.com/categories/view/46/product-archive/http://www.mikroe.com/about/