Embedded Microprocessor Lecture 2
Embedded Microprocessor Lecture 2
Machine Language
• An instruction is a binary pattern entered through
an input device in memory to command the
microprocessor to perform the specific function.
• Example: 0011 1100 corresponds to increment
the number in the register called the accumulator,
and it is usually entered as 3C (hexadecimal code
for convenience).
• The monitor program of the system translates
these keys into their equivalent binary pattern.
Assembly Language
• Entering the instructions using hexadecimal is quite
easier than entering the binary combinations.
• Manufacturer defines a symbolic code for the
instructions and these codes are called mnemonics
(The word mnemonics is based on Greek word
meaning mindful; that is, a memory aid).
• The mnemonic for each instruction is usually a group
of letters that suggest the operation performed. 0011
1100 translates to 3C in hexadecimal (OPCODE) and its
mnemonic is INR A.
• INR stands for increment register and A is short for
accumulator.
8085 Assembly Language Program
• The 8085 microprocessor is an 8-bit processor
available as a 40-pin IC package and uses +5 V power.
• It can run at a maximum frequency of 3 MHz.
• Its data bus width is 8-bit and address bus width is
16-bit, thus it can address 2^16 = 64 KB of memory.
• 8-bit general purpose µp
• Capable of addressing 64 k of memory
• Has 40 pins
• Requires +5 v power supply
• Can operate with 3 MHz clock
General-purpose registers (user accessible)
• B, C, D, E, H, and L, are 8 bit registers which can be
combined to form 16-bit register pairs.
• B and C registers can be combined to form the BC
register pair,
• D and E registers can be combined to form the DE
register pair, and
• H and L registers can be combined to form the HL
register pair.
• These register pairs are commonly used to store
memory addresses and other data.
Program counter
• 16-bit register that contains the memory address of
the next instruction to be executed.
• The program counter is incremented after each
instruction is executed, which allows the
microprocessor to execute instructions in sequence.
• Not much use in programming but as an indicator to
user only.
• For Example: Suppose current value of Program
Counter : [PC] = 4000H
• (It means that next executing instruction is at location
4000H.After fetching, program Counter (PC) always
increments by +1 for fetching of next instruction.
Stack Pointer
• 16-bit register that is used to manage the
stack.
• The stack is a section of memory that is used
to store data temporarily, such as subroutine
addresses and other data.
• The stack pointer is used to keep track of the
top of the stack.
Temporary Register:
• It is an 8-bit register that holds data values
during arithmetic and logical operations.
Instruction register and decoder:
• It is an 8-bit register that holds the instruction
code that is being decoded. The instruction is
fetched from the memory.
Flags register
• 8-bit register that contains status flags that indicate the result of
an arithmetic or logical operation.
• stores either 0 or 1 depending upon which value is stored in the
accumulator.
• Flag Register contains 8-bit out of which 5-bits are important and
the rest of 3-bits are “don’t Care conditions”.
• These flags include the carry flag, zero flag, sign flag, and parity
flag.
• The carry flag is set when an arithmetic operation generates a
carry, the zero flag is set when the result of an arithmetic or
logical operation is zero, the sign flag is set when the result of an
arithmetic or logical operation is negative, and the parity flag is set
when the result of an arithmetic or logical operation has an even
number of 1 bits.
• Flag register is a status register and it is used to check the status
of the current operation which is being carried out by ALU.
ALU
• It is used to perform mathematical operations
like addition, multiplication, subtraction,
division, decrement, increment, etc. Different
operations are carried out in ALU: Logical
operations, Bit-Shifting Operations, and
Arithmetic Operations.
Timing and control unit
• The timing and control unit comes under the
CPU section, and it controls the flow of data
from the CPU to other devices.
• It is also used to control the operations
performed by the microprocessor and the
devices connected to it.
• There are certain timing and control signals
like Control signals, DMA Signals, RESET
signals and Status signals.
Interrupt control
• Whenever a microprocessor is executing the main
program and if suddenly an interrupt occurs, the
microprocessor shifts the control from the main
program to process the incoming request.
• After the request is completed, the control goes back
to the main program.
• There are 5 interrupt signals in 8085
microprocessors: INTR, TRAP, RST 7.5, RST 6.5, and
RST 5.5.
• Priorities of Interrupts: TRAP > RST 7.5 > RST 6.5 > RST
5.5 > INTR
The flow of an Instruction Cycle in
8085 Architecture
• Execution starts with Program Counter. It starts program
execution with the next address field. it fetches an instruction
from the memory location pointed by Program Counter.
• For address fetching from the memory, multiplexed address/data
bus acts as an address bus
– after fetching instruction this address bus will now acts as a data bus
and extract data from the specified memory location
– send this data on an 8-bit internal bus.
– For multiplexed address/data bus Address Latch Enable(ALE) Pin is used.
If ALE = 1 (Multiplexed bus is Address Bus otherwise it acts as Data
Bus).
• After data fetching data will go into the Instruction Register it will
store data fetched from memory and now data is ready for
decoding so for this Instruction decoder register is used.
• After that timing and control signal circuit comes into the picture. It sends
control signals all over the microprocessor to tell the microprocessor
whether the given instruction is for READ/WRITE and whether it is for
MEMORY/I-O Device activity.
• Hence according to timing and control signal pins, logical and arithmetic
operations are performed and according to that data fetching from the
different registers is done by a microprocessor, and mathematical
operation is carried out by ALU. And according to operations Flag register
changes dynamically.
• With the help of Serial I/O data pin(SID or SOD Pins) we can send or
receive input/output to external devices .in this way execution cycle is
carried out.
• While execution is going on if there is any interrupt detected then it will
stop execution of the current process and Invoke Interrupt Service
Routine (ISR) Function. Which will stop the current execution and do
execution of the current occurred interrupt after that normal execution
will be performed.