CPE - 416 (1st Lecture)
CPE - 416 (1st Lecture)
TO
PIC MICROCONTROLLERS PIC16F84
Features: low cost, self-contained, 8-bit, Harvard structure, pipelined, RISC, single
accumulator with fixed reset and interrupt vectors
Various companies
§ Intel-8051
§ Atmel-AVR
§ Zilong-Z8
§ Motorola
§ etc
INTRODUCTION
Pic microcontroller assembly language programing: Like we need language to
communicate with each other. Language is a set of symbols by which we convey our
message to others. Similarly, we communicate with microcontrollers with a
language called assembly. An assembler is used to understand our instruction or
you can say our symbols which we provide to microcontroller Assembly language
program is basically a set of instructions stored in computer memory. Computer can
only understand 1’s and 0’s. Assembly language instructions are for humans only.
Computer do not understand them. So we need to converter these assembly
language instructions to binary form which is understandable for computers.
Assembly language commands are converted into one’s and zero’s by compiler.
INTRO Contd…..
A data file used for storing compiled program is called an “executive file”, i.e.
“HEX data file”. The name comes from the hexadecimal presentation of a data
file and has a suffix of “hex” as well, for example “probe.hex”. After has been
generated, the data file is loaded into the microcontroller using a programmer.
Assembly language codes can be written in any editor.
INTRO Contd…..
Circumstances that we find ourselves 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
a b o u t .
Microcontrollers versus Microprocessors
Microcontroller differs from a microprocessor in many ways. First and the most important is its
functionality. In order for a microprocessor to be used, other components such as memory, or
components for receiving and sending data must be added to it. In short that means that
microprocessor is the very heart of the computer. On the other hand, microcontroller is
designed to be all of that in one. No other external components are needed for its application
because all necessary peripherals are already built into it. Thus, we save the time and space
n e e d e d t o c o n s t r u c t d e v i c e s .
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
• CPU is stand-alone, RAM, • CPU, RAM, ROM, I/O and timer
ROM, I/O, timer are separate are all on a single chip
• designer can decide on the • fixed amount of on-chip ROM,
amount of ROM, RAM and RAM, I/O ports
I/O ports.
• for applications in which cost,
• expensive power and space are critical
• versatility
• single-purpose (control-oriented)
• general-purpose
• Low processing power
• High processing power
• Low power consumption
• High power consumption
• Instruction sets focus on • Bit-level operations
processing-intensive • Instruction sets focus on control
operations and bit-level operations
• Typically 32/64 – bit • Typically 8/16 bit
• Typically deep pipeline (5-20 • Typically single-cycle/two-stage
stages) pipeline
7
Core components of Microcontroller.
8
Memory unit
Memory is part of the microcontroller whose
f u n c t i o n i s t o s t o r e d a t a .
The easiest way to explain it is to describe it as one
big closet with lots of drawers. If
suppose we marked the drawers in such a way
that they can not be confused, any of their
contents will then be easily accessible. It is enough
to know the designation of the drawer and
so its contents will be known to us for sure.
Memory components are exactly like that.
CISC stands for Complex Instruction Set Computer while RISC stands for Reduced
Instruction Set Computer. It has already been said that PIC16F84 has a RISC
architecture, however, Since PIC16F84 is a RISC microcontroller, that means that it has a
reduced set of instructions, more precisely 35 instructions.
. (ex. Intel's and Motorola's microcontrollers have over hundred instructions) All of these
instructions are executed in one cycle except for jump and branch instructions.
CISC CISC Architecture
appliances to industrial instruments, remote sensors, electrical door locks and safety
devices. It is also ideal for smart cards as well as for battery supplied devices because
of its low consumption. EEPROM memory makes it easier to apply microcontrollers to
devices where permanent storage of various parameters is needed (codes for
transmitters, motor speed, receiver frequencies, etc.).
Low cost, low consumption, easy handling and flexibility make PIC16F84 applicable
even in areas where microcontrollers had not previously been considered (example:
timer functions, interface replacement in larger systems, coprocessor applications, etc.).
Clock / instruction cycle
Clock is microcontroller's main starter, and is
obtained from an external component called
an "oscillator". Clock from the oscillator
enters a microcontroller via OSC1 pin where
internal circuit of a microcontroller divides
the clock into four even clocks Q1, Q2, Q3,
and Q4 which do not overlap. These four
clocks make up one instruction cycle (also
called machine cycle) during which one
instruction is executed.
Pin description
The most important reset sources are a) and b). The first one occurs each time a power supply is
brought to the microcontroller and serves to bring all registers to a starting position initial state. The
second one is a product of purposeful bringing in of a logical zero to MCLR pin during normal
operation of the microcontroller. This second one is often used in program development. During a
reset, RAM memory locations are not being reset. They are unknown during a power up and are not
changed at any reset. Unlike these, SFR registers are reset to a starting position initial
state. One of the most important effects of a reset is setting a program counter (PC) to zero(0000h) ,
which enables the program to start executing from the first written instruction.
Assignment (individaul)
Briefly discuss on the following terms:
v Merit and demerit of RISC and CISC
v RISC and CISC as well as area of their applications
v Microcontrollers versus Microprocessors and area of their applications
.