0% found this document useful (0 votes)
2 views

Microcontroller Practice Past Exam Questions

The document provides an overview of microcontroller technology, detailing its role as a compact computer on a chip essential for various electronic devices. It explains the components of a computer system, including processors, memory types, and input/output devices, as well as the evolution from microprocessors to microcontrollers. Additionally, it discusses programming languages and their relevance in developing software for microcontrollers.

Uploaded by

masterzee701
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Microcontroller Practice Past Exam Questions

The document provides an overview of microcontroller technology, detailing its role as a compact computer on a chip essential for various electronic devices. It explains the components of a computer system, including processors, memory types, and input/output devices, as well as the evolution from microprocessors to microcontrollers. Additionally, it discusses programming languages and their relevance in developing software for microcontrollers.

Uploaded by

masterzee701
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

INTRODUCTION

Microcontroller Technology GONDONGWE CN


[email protected]
Introduction
• The microcontroller is simply a computer on a chip.
• It is essential for the operation of devices such as mobile phones ,
DVD players, video cameras, and most self contained electronic
systems.
• Working sometimes with other chips, but often on its own, the
microcontroller unit (MCU) provides the key element in the vast range
of small, programmed devices which are now a commonplace.
What is a Computer?
• is a machine or device that performs processes, calculations and
operations based on instructions provided by a software or hardware
program.
• It has the ability to accept data (input), process it, and then produce
outputs.
• The hardware of a computer consists of 4 types of components:
• Processor
• Input devices
• Output devices
• Memory devices
The Processor
• Is responsible for processing all of the computational operations and
coordination of the usage of resources of a computer.
• A computer system may consist of one or multiple processors.
• A processor may perform general-purpose computations or special
purpose computations, such as graphical rendering, printing or
network processing.
The Processor
• Also called the central processing unit (CPU).
• Consists of at least the following 3 components:
• Registers
• Arithmetic Logic Unit (ALU)
• Control Unit
Registers
• is a storage location inside the CPU.
• It is used to hold data and/or a memory address during the execution
of an instruction.
• The register can provide fast access to operands for program
execution because it is close to the CPU.
• The number of registers varies from processor to processor.
Arithmetic Logic Unit (ALU)
• performs all the numerical computations and logical evaluations for
the processor.
• The ALU receives data from the memory, performs the operations,
and, if necessary, writes the result back to memory.
• Today’s supercomputers can perform trillions of operations per
second.
• The ALU and registers together are referred to as the data path of
the processor.
Control Unit
• contains the hardware instruction logic.
• The control unit decodes and monitors the execution of instructions.
• The control unit also acts as an arbiter as various portions of the
computer system compete for the resources of the CPU.
• The activities of the CPU are synchronized by the system clock.
• The clock rates of modern microprocessors have exceeded 3.0 GHz.
• The control usnit also maintains a register called the program counter
that keeps track of the address of the next instruction to be executed.
Input devices
• A computer is designed to execute programs that manipulate certain
data.
• Input devices are needed to enter the program to be executed and data
to be processed into the computer.
• Examples of input devices are keyboards, keypads, scanners, bar code
readers, sensors and so on.
Output devices
• These are devices that are used to present the processed information
by the computer.
• Examples include CRT displays, flat-panel displays, seven-segment
displays, printers, light-emitting diodes (LEDs) and so on.
Memory devices
• Programs to be executed and data to be processed must be stored in
memory devices so that the processor can readily access them.
The Microprocessor
• The advancement of semiconductor technology allows the circuitry of a
complete processor to be placed in one integrated circuit (chip).
• A microprocessor is a processor packaged in a single integrated circuit.
• Depending on the number of bits that a microprocessor can manipulate in
one operation, a microprocessor is referred to as 4-bit, 8-bit, 16-bit, 32-bit,
or 64-bit.
• This number is the word length (or data path length) of the microprocessor.
• Microprocessors and input/output devices have different characteristics and
speed .
• A microprocessor is not designed to deal with I/O devices directly, instead,
peripheral (interface) chips are needed to make up the difference between
the microprocessor and the I/O devices.
The Microprocessor Cont …
• Microprocessors have been widely used in many applications since they
were invented.
• However, there are several limitations in the initial microprocessor designs
that led to the development of microcontrollers.
• External chips are needed to hold programs and data because the early
microprocessors did not have on chip memory.
• Glue logic (such as address decoder and buffer chips) is required to interface with the
memory chips.
• Peripheral chips are needed to interface with I/O devices.
• Because of these limitations, a product designed with microprocessors
cannot be made as compact as might be desirable.
• The development of microcontrollers has not only eliminated most of these
problems but also enabled the design of many low-cost microprocessor
based products.
Microcontrollers
• Is a computer implemented on a single very large scale integration
(VLSI) circuit.
• In addition to those components contained in a microprocessor, an
MCU contains some of the following peripheral components:
• Memory , timers, Pulse-width modulation (PWM), Analog-to-digital converter
(ADC), Digital-to-analog converter (DAC), Parallel I/O interface,
Asynchronous serial communication interface (UART), Synchronous serial
communication interfaces (SPI, I 2 C, and CAN), Direct memory access (DMA)
controller, Memory component interface circuitry and software debug support
hardware.
• The functions and applications of these components is the focus of this
module.
Microcontrollers Cont …
• Since their introduction, MCUs have been used in almost every
application that requires certain amount of intelligence.
• They are used as controllers for displays, printers, keyboards, palm-
top computers and home appliances such as washing machines, and
microwave ovens.
• They are also used to control the operations of engines and machines
in factories.
• Products of this nature are often called embedded systems.
• In any circuit, the microcontroller tends to have a single dedicated
function.
Memory
• Programs and data are stored in memory in a computer system.
• Memory can be semiconductor, magnetic and/or optical.
• However we will discuss semiconductor memory only as magnetic
and optical memories are seldom used in 8-bit microcontrollers
applications.
• Semiconductor memory can be classified into two major types:
• Random-access memory (RAM)
• Read-only memory (ROM)
Random-Access Memory
• It is volatile in the sense that it cannot retain data in the absence of
power.
• It is also called read/write because it allows the processor to read from
and write into it.
• Both read and write accesses to a RAM chip roughly take the same
amount of time.
• As long as there is power, the microprocessor can write data into a
location in the RAM chip and read back the same contents later.
• Reading memory is non-destructive.
RAM Cont ….
• There are two types of RAM technology:
• Static RAM (SRAM)
• Dynamic RAM (DRAM)
• RAM is mainly used to store dynamic programs and data.
• A computer often wants to run different programs on the same
computer, and these programs usually operate on different sets of data.
• The programs and data must therefore be loaded into RAM from hard
disk or other secondary storage, and for this reason they are called
dynamic.
Read-Only Memory
• ROM is nonvolatile.
• If power is removed from ROM and then reapplied, the original data
will still be there.
• As its name implies, ROM data can only be read.
• This is not exactly true.
• Most ROM technologies require special algorithm and voltage to write
data into the chip.
• Without using the special algorithm and voltage, any attempt to write
to the ROM memory will not be successful.
ROM Cont …
• There are many different kinds of ROM technologies in use
• Masked-programmed read-only memory (MROM)
• Programmable read-only memory (PROM)
• Erasable programmable read-only memory (EPROM)
• Electrically erasable programmable read-only memory (EEPROM)
The Computer Software
• Programs are known as software.
• A program is a set of instructions that the computer can execute.
• The program is stored in the computer’s memory in the form of binary
numbers called machine instructions.
• The length of a machine instruction of a computer may be fixed or
variable.
• Fixing the instruction makes instruction decoding simpler and hence
can simplify the design of the processor.
• However it has one potential drawback, the program length may be
longer because of the inefficiency of instruction encoding.
Assembly Language
• Software development in machine language is very difficult.
• Program entering: The programmer must use the binary patterns of every machine
instruction in order to enter a machine instruction. Before the user can memorize the
binary pattern of each instruction, he/she must consult a look up table constantly.
• Program debugging: Whenever a program does not perform as expected, the
programmer will have a hard time to identify the instruction that caused the problem.
• Program maintenance: A programmer who did not write the program will have a hard
time reading the program and figuring out the program logic.
• Assembly language was invented to simplify the programming job.
• An assembly program consists of assembly instructions (mnemonic
representation of a machine instruction)
Assembly Language Cont
• With the invention of the assembly language, a programmer no longer needs to scan
through the sequence of 0s and Is in order to identify what instructions are in the
program.
• This is a significant improvement over machine language programming.
• The assembly program that the programmer enters is called source program or source
code.
• The user needs to invoke an assembler program to translate the source program into
machine language so that the computer can execute it. The output of an assembler is
also called object code.
• There are two types of assemblers: native assembler and cross assembler.
• A native assembler runs on a computer and generates the machine code to be executed
on the same computer or a different computer having the same instruction set.
• A cross assembler runs on a computer but generates machine code that will be
executed by computers that have a different instruction set.
High Level Languages
• There are a few drawbacks for assembly language programming:
• The programmer must be familiar with the hardware architecture on which the
program is to be executed.
• A program (especially a long one) written in assembly language is difficult to
understand for anyone other than the author.
• Programming productivity is not satisfactory for large programming projects
because the programmer needs to work on the program logic at a very low
level.
• For these reasons, high-level languages such as C, C++, and Java were
invented to avoid the problems of assembly language programming.
• High-level languages are close to plain English, and hence a program
written in a high-level language becomes easier to understand.
High Level Languages Cont …
• A statement in high-level language often needs to be implemented by
tens or even hundreds of assembly instructions.
• The programmer can now work on the program logic at a much higher
level, which makes the programming job much easier. A program
written in a high-level language is also called a source code, and it
requires a software program called a compiler to translate it into
machine instructions.
• A compiler compiles a program into object code.
• Just as there are cross assemblers, there are cross compilers that run
on one machine but translate programs into machine instructions to be
executed on a computer with a different instruction set.
High Level Languages Cont …
• Some high-level languages are interpreted; that is, they use an interpreter to
scan the user’s source code and perform the operations specified.
• Interpreters do not generate object code.
• Programming languages that use this approach include Basic, Lisp, and Prolog.
• High-level languages are not perfect, either.
• One of the major problems with high-level languages is that the machine code
compiled from a program written in a high-level language is much longer and
cannot run as fast as its equivalent in the assembly language.
• For this reason, many time-critical programs are still written in assembly
language.
• C language has been used extensively in MCU programming in the industry,
and most MCU software tool developers provide cross C compilers
REFERENCES
• Huang HW, 2005, PIC Microcontroller: An Introduction to Software
and Hardware Interfacing, Thomson Delmar Learning
• Bates M, 2006, Interfacing PIC Microcontrollers Embedded Design by
Interactive Simulation
• Mazidi M A, McKinlay R.D, Causey D, 2008, PIC Microcontroller
and Embedded Systems, Using Assembly and C for PIC 18
• Bates M.P, Programming 8-Bit PIC Microcontrollers in C with
Interactive Hardware Simulation, Newness Press

You might also like