Microprocessor Part2

download Microprocessor Part2

of 84

  • date post

    06-Jul-2018
  • Category

    Documents

  • view

    217
  • download

    0

Embed Size (px)

Transcript of Microprocessor Part2

  • 8/17/2019 Microprocessor Part2

    1/84

    University of Technology Electrical Eng. Department Microprocessor Engineering & Microcontroller

    Lecture Six Introduction to Microcontroller

    Ass is t.Prof . Dr. Hadeel Nasrat

    Page 1 of 14

    INTRODUCTION TO MICROCONTROLLERE

    What i s a Microcontro ller? • A microcontroller (sometimes abbreviated µC, uC or MCU ) is a small computer

    on a single integrated circuit containing a processor core, memory, and

    programmable input/output peripherals.

    Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose

    applications. Microcontrollers may be:

    Embedded’ inside some other device (often a consumer product) so

    that they can control the features or actions of the product. Another

    name for a microcontroller is therefore an ‘embedded controller’.

    Dedicated to one task and run one speci c program. The program is

    stored in ROM and generally does not change.

    A low-power device. A battery-operated microcontroller might consume

    as littleas50 milliwatts.

    • A Microcontroller may take an input from the device it is controlling and controls

    the device by sending signals to deferent components in the device.

    • A microcontroller is often small and low cost. The components may be chosen to minimize size and to be as in expensive as possible.

    • The actual processor used to implement a microcontroller can vary widely. In many

    products, such as microwave ovens, the demand on the CPU is fairly low and price is an

    important consideration. In these cases, manufacturers turn to dedicated microcontroller

    chips – devices that were originally designed to be low-cost, small, low-power,

    embedded CPUs. The Motorola 6811 and Intel 8051 are both good examples of such

    chips.

    http://en.wikipedia.org/wiki/Integrated_circuit http://en.wikipedia.org/wiki/Input/output http://en.wikipedia.org/wiki/Microprocessor http://en.wikipedia.org/wiki/Personal_computer http://en.wikipedia.org/wiki/Personal_computer http://en.wikipedia.org/wiki/Microprocessor http://en.wikipedia.org/wiki/Input/output http://en.wikipedia.org/wiki/Integrated_circuit

  • 8/17/2019 Microprocessor Part2

    2/84

    University of Technology Electrical Eng. Department Microprocessor Engineering & Microcontroller

    Lecture Six Introduction to Microcontroller

    Ass is t.Prof . Dr. Hadeel Nasrat

    Page 2 of 14

    Development/Classification of microcontrollers

    Microcontrollers have gone through a silent evolution (invisible). The

    evolution can be rightly termed as silent as the impact or application of a

    microcontroller is not well known to a common user, although microcontroller

    technology has undergone significant change since early 1970's. Development

    of some popular microcontrollers is given as follows.

    Intel 4004 4 bit (2300 PMOS trans, 108 kHz) 1971

    Intel 8048 8 bit 1976

    Intel 8031 8 bit (ROM-less) .

    Intel 8051 8 bit (Mask ROM) 1980

    Microchip PIC16C64 8 bit 1985

    Motorola 68HC11 8 bit (on chip ADC) .

    Intel 80C196 16 bit 1982

    Atmel AT89C51 8 bit (Flash memory) .

    Microchip PIC 16F877 8 bit (Flash memory + ADC) .

    Microcontrollers Vs Microprocessors

    1. A microprocessor requires an external memory for program/data storage. Instruction execution requires movement of data from the external memory to

    the microprocessor or vice versa. Usually, microprocessors have good

    computing power and they have higher clock speed to facilitate faster

    computation.

    2. A microcontroller has required on-chip memory with associated peripherals. A

    microcontroller can be thought of a microprocessor with inbuilt peripherals.

  • 8/17/2019 Microprocessor Part2

    3/84

    University of Technology Electrical Eng. Department Microprocessor Engineering & Microcontroller

    Lecture Six Introduction to Microcontroller

    Ass is t.Prof . Dr. Hadeel Nasrat

    Page 3 of 14

    3. A microcontroller does not require much additional interfacing ICs for

    operation and it functions as a stand alone system. The operation of a

    microcontroller is multipurpose, just like a Swiss knife.

    4. Microcontrollers are also called embedded controllers. A microcontroller clock

    speed is limited only to a few tens of MHz. Microcontrollers are numerous and

    many of them are application specific.

    Choosing a Microcontroller

    Three criteria in Choosing a Microcontroller

    meeting the computing needs of the task efficiently and cost effectively

    speed, the amount of ROM and RAM, the number of I/O ports and

    timers, size, packaging, power consumption

    easy to upgrade

    cost per unit

    availability of software development tools

    assemblers, debuggers, C compilers, emulator, simulator, technical

    support

    wide availability and reliable sources of the microcontrollers

  • 8/17/2019 Microprocessor Part2

    4/84

    University of Technology Electrical Eng. Department Microprocessor Engineering & Microcontroller

    Lecture Six Introduction to Microcontroller

    Ass is t.Prof . Dr. Hadeel Nasrat

    Page 4 of 14

    Internal Structure of a Microcontroller

    F i g

    . 1 :

    M i c r o c o n

    t r o

    l l e r

    A r c h

    i t e c

    t u r e

    b l o c

    k d i a g r a m

  • 8/17/2019 Microprocessor Part2

    5/84

  • 8/17/2019 Microprocessor Part2

    6/84

    University of Technology Electrical Eng. Department Microprocessor Engineering & Microcontroller

    Lecture Six Introduction to Microcontroller

    Ass is t.Prof . Dr. Hadeel Nasrat

    Page 6 of 14

    calibration values, codes, values to count up to etc.), which must be saved after

    turning the power supply off. A disadvantage of this memory is that the process of

    programming is relatively slow. It is measured in miliseconds.

    Special Function Registers (SFR)

    Special function registers are part of RAM memory. 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 communication module etc., any change of their state directly

    affects the operation of the microcontroller or some 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.

  • 8/17/2019 Microprocessor Part2

    7/84

    University of Technology Electrical Eng. Department Microprocessor Engineering & Microcontroller

    Lecture Six Introduction to Microcontroller

    Ass is t.Prof . Dr. Hadeel Nasrat

    Page 7 of 14

    Program Counter

    Program Counter is an engine running the program and points to the memory

    address containing the next instruction to execute. After each instruction execution,

    the value of the counter is incremented by 1. For this reason, the program executes

    only one instruction at a time just as it is written. However…the value of the program

    counter can be changed at any moment, which causes a “jump” to a new memory

    location. This is how subroutines and branch instructions are executed. After

    jumping, the counter resumes even and monotonous automatic counting +1, +1, +1…

    A regi st er or a memory cell is an electronic circuit which can memorize the state of

    one byte. Besides 8 bits available to the user, each register has also a number of

    addressing bits. It is important 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.

    Central Processor Unit (CPU) As its name suggests, this is a unit which monitors and controls all processes

    within the microcontroller and the user cannot affect its work. It consists of several

    smaller subunits, of which the most important are:

    • Instruction decoder is 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.

  • 8/17/2019 Microprocessor Part2

    8/84

    University of Technology Electrical Eng. Department Microprocessor Engineering & Microcontroller

    Lecture Six Introduction to Microcontroller

    Ass is t.Prof . Dr. Hadeel Nasrat

    Page 8 of 14

    • Ar ithmeti cal Logical Uni t (ALU) performs all mathematical and logical

    operations upon data.