SlideShare a Scribd company logo
1 of 148
Download to read offline
MT2301
EMBEDDED SYSTEMS AND PROGRAMMING
Dr. K. Kannan, M.E., M.E., Ph.D.,
Professor & Head,
Department of Mechatronics Engineering
Preamble
• To familiarize the architecture and
fundamental units of microcontroller.
• To understand the microcontroller
programming methodology
• To acquire the interfacing skills
• To exchange data using various
communication protocols.
Unit I – Introduction to Microcontroller (9)
• Fundamentals, Functions of ALU
• Microprocessor, Microcontrollers, CISC and
RISC, Types Microcontroller
• 8051 Family, Architecture, Features and
Specifications
• Memory Organization
• Instruction Sets and Addressing Modes.
Unit II – Programming and Communication (9)
Fundamentals of Assembly Language Programming
Instruction to Assembler, Compiler and IDE
C Programming for 8051 Microcontroller
Basic Arithmetic and Logical Programming
Timer and Counter, Interrupts
Interfacing and Programming of Serial Communication, I2C, SPI
and CAN of 8051 Microcontroller
Bluetooth and WI-FI interfacing of 8051 Microcontroller.
Unit III – ARM Processor (9)
• Introduction ARM 7 Processor
• Internal Architecture
• Modes of Operations
• Register Set, Instruction Sets
• ARM Thumb, Thumb State Registers
• Pipelining
• Basic programming of ARM 7 - Applications.
Unit IV – PIC Microcontroller (9)
• Architecture
• Instruction set, Addressing modes
• Timers, Interrupt logic
• CCP modules
• ADC
Unit V – Real Time Operating System (9)
• Real time operating systems Architecture
• Tasks and Task states - Tasks and Data
• Semaphore and shared data
• Message queues, mail boxes and pipes,
• Encapsulating semaphores and queues
• Interrupt routines in an RTOS Environment.
Learning Resources
Text Books
1. David E. Simon, An embedded software primer, Addison – Wesley,
Indian Edition Reprint,2009.
2. Kenneth J. Aylala, The 8051 Microcontroller, the Architecture and
Programming Applications, 2003.
Reference Books
1. Muhammad Ali Mazidi and Janice Gillispic Mazdi, The 8051
Microcontroller and Embedded Systems, Pearson Education, 2006.
2. James W. Stewart, The 8051 Microcontroller Hardware, Software and
Interfacing, Regents Prentice Hall, 2003.
Outcome
CO. No. Course Outcome K-Level
CO1
Explain the various functional units of microcontroller, processors
and system-on-chip based on the features and specifications.
K2
CO2
Recognize the role of each functional units in microcontroller,
processors and system-on-chip based on the features and
specifications.
K2
CO3 Explain the architecture and Instruction set in ARM Processor K2
CO4
Explain the architecture and fundamental operating concepts
behind PIC Microcontroller
K2
CO5
Summarize the basics of Real time operating system and its
applications.
K2
Unit I –
INTRODUCTION TO MICROCONTROLLER
Fundamentals - Functions of ALU -
Microprocessor - Microcontrollers – CISC
and RISC – Types Microcontroller - 8051
Family - Architecture - Features and
Specifications - Memory Organization -
Instruction Sets – Addressing Modes.
Microprocessor
The microprocessor
is a programmable
device that takes in
numbers, performs
on them arithmetic
or logical operations
according to the
program stored in
memory and then
produces other
numbers as a result.
Microprocessor
Microcontroller
A microcontroller is a
compact integrated circuit
designed to govern a
specific operation in
an embedded system. A
typical microcontroller
includes a processor,
memory and input/output
(I/O) peripherals on a
single chip.
Microprocessor Vs Microcontroller
Microprocessor Vs Microcontroller
Microprocessor Vs Microcontroller
CISC
• A complex instruction set computer (CISC) is a
microprocessor instruction set architecture (ISA)
in which each instruction can execute several
low-level operations, such as a load from
memory, an arithmetic operation, and a memory
store, all in a single instruction.
Main Idea of CISC
• Hardware is always faster than software, therefore
a powerful instruction set may be made to provide
the programmers with assembly instructions to do
a lot with short programs.
• So the primary goal of the CISC is to complete a
task in few lines of assembly instruction as
possible.
 Memory in those days was expensive
• bigger program->more storage->more money
Hence needed to reduce the number of instructions per program
 Number of instructions are reduced by having multiple
operations within a single instruction
 Multiple operations lead to many different kinds of
instructions that access memory
• In turn making instruction length variable and fetch-decode
execute time unpredictable – making it more complex
• Thus hardware handles the complexity
Main Idea of CISC
 Use microcode
• Used a simplified microcode instruction set to control the
data path logic. This type of implementation is known as a
micro programmed implementation.
 Build rich instruction sets
• Consequences of using a micro programmed design is that
designers could build more functionality into each
instruction.
 Build high-level instruction sets
• The logical next step was to build instruction sets which
map directly from high-level languages
Main Idea of CISC
Characteristics of a CISC design
• Register to register, register to memory, and memory to
register commands.
• Uses Multiple addressing modes.
• Variable length instructions where the length often varies
according to the addressing mode
• Instructions which require multiple clock cycles to execute.
CISC Vs. RISC
General purpose registers
Arithmetic Logical Unit
Main memory
Memory (1,1) .. (6,4) = 24 locations
Registers: A,B,C,D,E,F
Execution unit : arithmetic ( + -* ÷)
Multiplication
 Let's say we want to find
the product of two
numbers - one stored in
location 2:3 and another
stored in location 5:2 - and
then store the product
back in the location 2:3.
 i.e.,
M(2,3)< - M(5,2)*M(2,3)
2,3
5,2
CISC Approach
For this particular task, a CISC
 processor would come prepared with a specific instruction (we'll call it "MULT").
MULT A,B When executed, this instruction
 loads the two values into separate registers,
 multiplies the operands in the execution unit, and then
 stores the product in the appropriate register. Thus, the entire task of multiplying
two numbers can be completed with one instruction
 MULT is what is known as a "complex instruction."
 It operates directly on the computer's memory banks and does not require the
programmer to explicitly call any loading or storing functions.
 It closely resembles a command in a higher level language, identical to the C
statement “a = a * b.”
RISC Approach
• RISC processors only use simple instructions that can be
executed within one clock cycle.
• The "MULT" command described above could be divided
into three separate commands:
LOAD A, 2:3
LOAD B, 5:2
PROD A, B ("PROD,"finds the product of two operands )
STORE 2:3, A ("STORE,“ moves data from a register to
the memory banks)
(LOAD, which moves data from the memory bank
to a register)
CISC RISC
 Primary goal is to complete a task in
as few lines of assembly as possible
 Emphasis on hardware
 Includes multi-clock,
complex instructions
 Memory-to-memory:
"LOAD" and "STORE"
incorporated in instructions
 Difficult to apply pipelining.
 Small code sizes,
high cycles per second
 Primary goal is to speedup
individual instruction
 Emphasis on software
 Single-clock,
reduced instruction only
 Register to register:
"LOAD" and "STORE”
are independent instructions
 Easy to apply pipelining.
 Low cycles per second,
large code sizes
The Performance Equation
• The following equation is commonly used for expressing a
computer's performance ability:
Cisc
Risc
The CISC approach attempts to minimize the number of instructions
per program, sacrificing the number of cycles per instruction.
RISC does the opposite, reducing the cycles per instruction at the
cost of the number of instructions per program.
Which one is better?
• There is still considerable controversy among experts about which
architecture is better.
Some say that RISC is cheaper and faster and therefore the
architecture of the future.
Others note that by making the hardware simpler, RISC puts a greater
burden on the software. Software needs to become more complex.
Software developers need to write more lines for the same tasks.
No Big Difference Now
• RISC and CISC architectures are becoming more and more alike.
• Many of today's RISC chips support just as many instructions as
yesterday's CISC chips. The PowerPC 601, for example, supports more
instructions than the Pentium. Yet the 601 is considered a RISC chip,
while the Pentium is definitely CISC.
• Further more today's CISC chips use many techniques formerly
associated with RISC chips
• So simply said: RISC and CISC are growing to each other
Types of Microcontrollers
4 Bit Microcontrollers:
Types of Microcontrollers
8 Bit Microcontrollers:
Types of Microcontrollers
16 Bit Microcontrollers:
Types of Microcontrollers
32 Bit Microcontrollers: Intel 80960
8051 Family
Intel MCS-51
8051 Family
8051 Family
Features of 8051
• 4KB bytes on-chip program memory (ROM) and 128 bytes
on-chip data memory (RAM)
• Four register banks
• 8-bit bidirectional data bus and 16-bit unidirectional address
bus
• 32 general purpose registers, each of 8-bit
• 16 bit Timers (usually 2)
• Three internal and two external Interrupts
• Four 8-bit ports
• 16-bit program counter and data pointer
• It has 21 special function register.
• 1 Microsecond instruction cycle with 12 MHz Crystal.
• Multi mode high speed programmable full duplex serial port
• It has 111 instructions, 64 instructions are single cycle.
Pins and Signals of 8051
8051 Block Diagram
8051 Programming Model
8051 Internal RAM
8051 Oscillator & Clock
8051 PSW Register
Special Function Registers
Special Function Registers
Bit Addressing Register
Data Pointer
Stack Pointer
I/O Port Registers
Control Registers
PCON Register
TCON Register
SCON Register
Timer Mode Register
The Gatex bit is used to operate the Timerx with respect to the INTx pin or regardless of the INTx
pin.
GATE1 = 1 ==> Timer1 is operated only if INT1 is SET.
GATE1 = 0 ==> Timer1 is operates irrespective of INT1 pin.
GATE0 = 1 ==> Timer0 is operated only if INT0 is SET.
GATE0 = 0 ==> Timer0 is operates irrespective of INT0 pin.
The C/Tx bit is used selects the source of pulses for the Timer to count.
C/T1 = 1 ==> Timer1 counts pulses from Pin T1 (P3.5) (Counter Mode)
C/T1 = 0 ==> Timer1 counts pulses from internal oscillator (Timer Mode)
C/T0 = 1 ==> Timer0 counts pulses from Pin T0 (P3.4) (Counter Mode)
C/T0 = 0 ==> Timer0 counts pulses from internal oscillator (Timer Mode)
Interrupt Registers
Timer Registers
Serial Buffer Register
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Memory Interfacing
Port 0
Port 1
Port 2
Port 3
Instruction Set
• An instruction is an order or command given
to a processor by a computer program. All
commands are known as instruction set and set
of instructions is known as program.
• 8051 have in total 111 instructions, i.e. 111
different words available for program writing.
Instruction Format
• Where first part describes WHAT should be done,
while other explains HOW to do it.
• The latter part can be a data (binary number) or
the address at which the data is stored.
• Depending upon the number of bytes required to
represent 1 instruction completely.
Types of Instructions
Instructions are divided into 3 types
1. One/single byte instruction.
2. Two/double byte instruction.
3. Three/triple byte instruction.
Types of Instructions
1. One/single byte instructions :
• If operand is not given in the instruction or there
is no digits present with instruction, the
instructions can be completely represented in
one byte opcode.
• OPCODE 8 bit
Types of Instructions
2. Two/double byte instruction:
– If 8 bit number is given as operand in the
instruction, the such instructions can be
completed represented in two bytes.
– First byte OPCODE
– Second byte 8 bit data or I/O port
Types of Instructions
3. Three/triple byte instruction:
• If 16 bit number is given as operand in the
instructions than such instructions can be
completely represented in three bytes 16 bit
number specified may be data or address.
Types of Instructions
1. First byte will be instruction code.
2. Second byte will be 8 LSB’s of 16 bit number.
3. Third byte will be 8 MSB’s of 16 bit number.
• First byte OPCODE.
• Second byte 8 LSB’s of data/address.
• Third byte 8 MSB’S of data/address.
Addressing Modes
• Addressing modes specifies where the data
(operand) is. They specify the source or
destination of data (operand) in several
different ways, depending upon the situation.
• Addressing modes are used to know where the
operand located is.
Addressing Modes
• There are 5 types of addressing modes:
1. Register addressing.
2. Direct addressing.
3. Register indirect addressing.
4. Immediate addressing.
5. Index addressing.
Register Addressing Mode
• In register addressing mode, the source and/or
destination is a register.
• In this case, data is placed in any of the 8
registers(R0-R7). In instructions, it is specified
with letter Rn (where N indicates 0 to 7).
Register Addressing Mode
• For example,
1. ADD A, Rn (This is general instruction).
2. ADD A, R5 (This instruction will add the
contents of register R5 with the accumulator
contents).
Register Addressing Mode
Register Addressing Mode
Direct Addressing Mode
• In direct addressing mode, the address of
memory location containing data to be read is
specified in instruction.
• In this case, address of the data is given with
the instruction itself.
Direct Addressing Mode
• For example,
MOV A, 25H
(This instruction will read/move the data from
internal RAM address 25H and store it in the
accumulator).
Register Indirect Addressing Mode
• In register indirect addressing mode, the
contents of the designated register are used as
a pointer to memory.
• In this case, data is placed in memory, but
address of memory location is not given
directly with instruction.
Register Indirect Addressing Mode
• For example,
MOV A,@R0 This instruction moves the data
from the register whose address is in the R0
register into the accumulator.
Immediate Addressing Mode
• In immediate addressing mode, the data is
given with the instruction itself.
• In this case, the data to be stored in memory
immediately follows the opcode.
Immediate Addressing Mode
For example,
MOV A, #25H (This instruction will move the
data 25H to accumulator).
Immediate Addressing Mode
Addressing Mode
Indexed Addressing Mode
• Offset (from accumulator) is added to the base
index register( DPTR OR Program Counter) to
form the effective address of the memory
location.
• In this case, this mode is made for reading
tables in the program memory.
Indexed Addressing Mode
For example,
MOVC A, @ A + DPTR ( This instruction
moves the data from the memory to accumulator;
whose address is computed by adding the
contents of accumulator and DPTR)
Indexed Addressing Mode
Types Of Instructions
1. Data transfer instructions.
2. Arithmetic instructions.
3. Logical instructions.
4. Logical instructions with bits.
5. Branch instructions.
Data Transfer Instructions
• These instructions move the content of one
register to another one.
• Data can be transferred to stack with the help
of PUSH and POP instructions.
Data Transfer Instructions
MNEMONIC DESCRIPTION BYTES
MOV A, Rn (A) (Rn) 1
MOV A, Rx (A) (Rx) 2
MOV A, @Ri (A) (Ri) 1
Data Transfer Instructions
MOV A, #X (A) Data 2
MOV Rn, A (Rn) (A) 1
MOV Rn, Rx (Rn) (Rx) 2
Data Transfer Instructions
MOV @ Ri, A (Ri) (A) 1
MOV @ Ri, Rx (Ri) (Rx) 2
MOV @ Ri, #X (Ri) Data 2
Arithmetic Instructions
• These instructions perform several basic
operations. After execution, the result is stored
in the first operand.
• 8 bit addition, subtraction, multiplication,
increment-decrement instructions can be
performed.
Arithmetic Instructions
MNEMONICS DESCRIPTION BYTE
ADD A, Rn A = A + Rn 1
ADD A, Rx A = A + Rx 2
ADD A, @ Ri A = A + Ri 1
Arithmetic Instructions
ADD A, # X A = A + Byte 2
ADDC A, Rn A = A + Rn + C 1
ADDC A , Rx A = A + Rx + C 2
Arithmetic Instructions
ADDC A, @ Ri A = A + Ri + C 1
ADDC A, # X A = A + Byte + C 2
SUBB A, Rn A = A – Rn – 1 1
Arithmetic Instructions
SUBB A, Rx A = A – Rx – 1 2
SUBB A, @ Ri A = A – Ri – 1 1
SUBB A, # X A = A – Byte – 1 2
Arithmetic Instructions
INC A A = A + 1 1
INC Rn Rn = Rn + 1 1
INC Rx Rx = Rx + 1 2
Arithmetic Instructions
INC @ Ri Ri = Ri + 1 1
DEC A A = A – 1 1
DEC Rn Rn = Rn – 1 1
Arithmetic Instructions
DEC Rx Rx = Rx – 1 2
DEC @ Ri Ri = Ri – 1 1
INC DPTR DPTR = DPTR + 1 1
Arithmetic Instructions
MUL AB B:A = A * B 1
DIV AB A = [A/B] 1
Arithmetic Instructions
Logical Instructions
These instructions perform logical operations
between two register contents on bit by bit basis.
After execution, the result is stored in the first
operand.
Logical Instructions
MNEMONIC DESCRIPTION BYTE
ANL A, Rn (A) (A) ^ (Rn) 1
ANL A, Rx (A) (A) ^ (Rx) 2
ANL A,@ Ri (A) (A) ^ (Ri) 1
Logical Instructions
ANL A, # X (A) (8 bit data) ^ (A) 2
ANL Rx, A (Rx) (A) ^ (Rx) 2
ANL Rx,# X (Rx) (8 bit data) ^ (Rx) 3
Logical Instructions
ORL A, Rn (A) (A) + (Rn) 1
ORL A, Rx (A) (A) + (Rx) 2
ORL A, @ Ri (A) (A) + (Ri) 2
Logical Instructions
RR A (An) (An + 1) 1
(A7) (A0)
RRC A (An) (An + 1) 1
(A7) ( C )
( C ) (A0)
Logical Instructions On Bits
MNEMONIC DESCRIPTION BYTE
CLR C ( C = 0 ) 1
CLR bit clear directly addressed bit 2
SETB C ( C = 1 ) 1
Logical Instructions On Bits
SETB bit Set directly 2
addressed bit
CPL C (1 = 0, 0 = 1) 1
CPL bit Complement directly 2
addressed bit
Program Flow Control Instructions
In this group, instructions are related to the flow
of the program, these are used to control the
operation like, JUMP and CALL instructions.
Some instructions are used to introduce delay in
the program, to the halt program.
Thank You

More Related Content

Similar to Unit I_MT2301.pdf

Question 1. please describe an embedded system in less than 100 word.pdf
Question 1. please describe an embedded system in less than 100 word.pdfQuestion 1. please describe an embedded system in less than 100 word.pdf
Question 1. please describe an embedded system in less than 100 word.pdfarmcomputers
 
Microprocessor and Microcontroller Based Systems.ppt
Microprocessor and Microcontroller Based Systems.pptMicroprocessor and Microcontroller Based Systems.ppt
Microprocessor and Microcontroller Based Systems.pptTALHARIAZ46
 
RISC Vs CISC Computer architecture and design
RISC Vs CISC Computer architecture and designRISC Vs CISC Computer architecture and design
RISC Vs CISC Computer architecture and designyousefzahdeh
 
risc_and_cisc.ppt
risc_and_cisc.pptrisc_and_cisc.ppt
risc_and_cisc.pptRuhul Amin
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontrollersnehapvs
 
MergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptxMergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptxbhaveshagrawal35
 
CS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdf
CS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdfCS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdf
CS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdfAsst.prof M.Gokilavani
 
Advanced Processor Power Point Presentation
Advanced Processor  Power Point  PresentationAdvanced Processor  Power Point  Presentation
Advanced Processor Power Point PresentationPrashantYadav931011
 
CSE675_01_Introduction.ppt
CSE675_01_Introduction.pptCSE675_01_Introduction.ppt
CSE675_01_Introduction.pptAshokRachapalli1
 
software engineering CSE675_01_Introduction.ppt
software engineering CSE675_01_Introduction.pptsoftware engineering CSE675_01_Introduction.ppt
software engineering CSE675_01_Introduction.pptSomnathMule5
 
CSE675_01_Introduction.ppt
CSE675_01_Introduction.pptCSE675_01_Introduction.ppt
CSE675_01_Introduction.pptAshokRachapalli1
 
Computer architecture
Computer architectureComputer architecture
Computer architectureAbash shah
 
Micro controller and dsp processor
Micro controller and dsp processorMicro controller and dsp processor
Micro controller and dsp processorShubhamMishra485
 
Necessity of 32-Bit Controllers
Necessity of 32-Bit ControllersNecessity of 32-Bit Controllers
Necessity of 32-Bit Controllersmohanav
 

Similar to Unit I_MT2301.pdf (20)

Question 1. please describe an embedded system in less than 100 word.pdf
Question 1. please describe an embedded system in less than 100 word.pdfQuestion 1. please describe an embedded system in less than 100 word.pdf
Question 1. please describe an embedded system in less than 100 word.pdf
 
Microprocessor and Microcontroller Based Systems.ppt
Microprocessor and Microcontroller Based Systems.pptMicroprocessor and Microcontroller Based Systems.ppt
Microprocessor and Microcontroller Based Systems.ppt
 
R&amp;c
R&amp;cR&amp;c
R&amp;c
 
Processors selection
Processors selectionProcessors selection
Processors selection
 
RISC Vs CISC Computer architecture and design
RISC Vs CISC Computer architecture and designRISC Vs CISC Computer architecture and design
RISC Vs CISC Computer architecture and design
 
risc_and_cisc.ppt
risc_and_cisc.pptrisc_and_cisc.ppt
risc_and_cisc.ppt
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
esunit1.pptx
esunit1.pptxesunit1.pptx
esunit1.pptx
 
MergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptxMergeResult_2023_04_02_05_26_56.pptx
MergeResult_2023_04_02_05_26_56.pptx
 
CS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdf
CS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdfCS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdf
CS304PC:Computer Organization and Architecture UNIT V_merged_merged.pdf
 
Advanced Processor Power Point Presentation
Advanced Processor  Power Point  PresentationAdvanced Processor  Power Point  Presentation
Advanced Processor Power Point Presentation
 
CSE675_01_Introduction.ppt
CSE675_01_Introduction.pptCSE675_01_Introduction.ppt
CSE675_01_Introduction.ppt
 
Hg3612911294
Hg3612911294Hg3612911294
Hg3612911294
 
software engineering CSE675_01_Introduction.ppt
software engineering CSE675_01_Introduction.pptsoftware engineering CSE675_01_Introduction.ppt
software engineering CSE675_01_Introduction.ppt
 
CSE675_01_Introduction.ppt
CSE675_01_Introduction.pptCSE675_01_Introduction.ppt
CSE675_01_Introduction.ppt
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
Micro controller and dsp processor
Micro controller and dsp processorMicro controller and dsp processor
Micro controller and dsp processor
 
Ijetr042175
Ijetr042175Ijetr042175
Ijetr042175
 
Necessity of 32-Bit Controllers
Necessity of 32-Bit ControllersNecessity of 32-Bit Controllers
Necessity of 32-Bit Controllers
 
Architectures
ArchitecturesArchitectures
Architectures
 

More from Kannan Kanagaraj

More from Kannan Kanagaraj (11)

MT2301_Unit II.pdf
MT2301_Unit II.pdfMT2301_Unit II.pdf
MT2301_Unit II.pdf
 
Digital Electronics – Unit V.pdf
Digital Electronics – Unit V.pdfDigital Electronics – Unit V.pdf
Digital Electronics – Unit V.pdf
 
Digital Electronics – Unit IV.pdf
Digital Electronics – Unit IV.pdfDigital Electronics – Unit IV.pdf
Digital Electronics – Unit IV.pdf
 
Digital Electronics – Unit III.pdf
Digital Electronics – Unit III.pdfDigital Electronics – Unit III.pdf
Digital Electronics – Unit III.pdf
 
Digital Electronics-Unit II.pdf
Digital Electronics-Unit II.pdfDigital Electronics-Unit II.pdf
Digital Electronics-Unit II.pdf
 
Digital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdfDigital Electronics – Unit I.pdf
Digital Electronics – Unit I.pdf
 
AE8751 - Unit V.pdf
AE8751 - Unit V.pdfAE8751 - Unit V.pdf
AE8751 - Unit V.pdf
 
AE8751 - UnitIV.pdf
AE8751 - UnitIV.pdfAE8751 - UnitIV.pdf
AE8751 - UnitIV.pdf
 
AE8751 - Unit III.pdf
AE8751 - Unit III.pdfAE8751 - Unit III.pdf
AE8751 - Unit III.pdf
 
AE8751 - Unit II.pdf
AE8751 - Unit II.pdfAE8751 - Unit II.pdf
AE8751 - Unit II.pdf
 
AE8751-UnitI.pdf
AE8751-UnitI.pdfAE8751-UnitI.pdf
AE8751-UnitI.pdf
 

Recently uploaded

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 

Recently uploaded (20)

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 

Unit I_MT2301.pdf

  • 1. MT2301 EMBEDDED SYSTEMS AND PROGRAMMING Dr. K. Kannan, M.E., M.E., Ph.D., Professor & Head, Department of Mechatronics Engineering
  • 2. Preamble • To familiarize the architecture and fundamental units of microcontroller. • To understand the microcontroller programming methodology • To acquire the interfacing skills • To exchange data using various communication protocols.
  • 3. Unit I – Introduction to Microcontroller (9) • Fundamentals, Functions of ALU • Microprocessor, Microcontrollers, CISC and RISC, Types Microcontroller • 8051 Family, Architecture, Features and Specifications • Memory Organization • Instruction Sets and Addressing Modes.
  • 4. Unit II – Programming and Communication (9) Fundamentals of Assembly Language Programming Instruction to Assembler, Compiler and IDE C Programming for 8051 Microcontroller Basic Arithmetic and Logical Programming Timer and Counter, Interrupts Interfacing and Programming of Serial Communication, I2C, SPI and CAN of 8051 Microcontroller Bluetooth and WI-FI interfacing of 8051 Microcontroller.
  • 5. Unit III – ARM Processor (9) • Introduction ARM 7 Processor • Internal Architecture • Modes of Operations • Register Set, Instruction Sets • ARM Thumb, Thumb State Registers • Pipelining • Basic programming of ARM 7 - Applications.
  • 6. Unit IV – PIC Microcontroller (9) • Architecture • Instruction set, Addressing modes • Timers, Interrupt logic • CCP modules • ADC
  • 7. Unit V – Real Time Operating System (9) • Real time operating systems Architecture • Tasks and Task states - Tasks and Data • Semaphore and shared data • Message queues, mail boxes and pipes, • Encapsulating semaphores and queues • Interrupt routines in an RTOS Environment.
  • 8. Learning Resources Text Books 1. David E. Simon, An embedded software primer, Addison – Wesley, Indian Edition Reprint,2009. 2. Kenneth J. Aylala, The 8051 Microcontroller, the Architecture and Programming Applications, 2003. Reference Books 1. Muhammad Ali Mazidi and Janice Gillispic Mazdi, The 8051 Microcontroller and Embedded Systems, Pearson Education, 2006. 2. James W. Stewart, The 8051 Microcontroller Hardware, Software and Interfacing, Regents Prentice Hall, 2003.
  • 9. Outcome CO. No. Course Outcome K-Level CO1 Explain the various functional units of microcontroller, processors and system-on-chip based on the features and specifications. K2 CO2 Recognize the role of each functional units in microcontroller, processors and system-on-chip based on the features and specifications. K2 CO3 Explain the architecture and Instruction set in ARM Processor K2 CO4 Explain the architecture and fundamental operating concepts behind PIC Microcontroller K2 CO5 Summarize the basics of Real time operating system and its applications. K2
  • 10. Unit I – INTRODUCTION TO MICROCONTROLLER Fundamentals - Functions of ALU - Microprocessor - Microcontrollers – CISC and RISC – Types Microcontroller - 8051 Family - Architecture - Features and Specifications - Memory Organization - Instruction Sets – Addressing Modes.
  • 11. Microprocessor The microprocessor is a programmable device that takes in numbers, performs on them arithmetic or logical operations according to the program stored in memory and then produces other numbers as a result.
  • 13. Microcontroller A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip.
  • 17. CISC • A complex instruction set computer (CISC) is a microprocessor instruction set architecture (ISA) in which each instruction can execute several low-level operations, such as a load from memory, an arithmetic operation, and a memory store, all in a single instruction.
  • 18. Main Idea of CISC • Hardware is always faster than software, therefore a powerful instruction set may be made to provide the programmers with assembly instructions to do a lot with short programs. • So the primary goal of the CISC is to complete a task in few lines of assembly instruction as possible.
  • 19.  Memory in those days was expensive • bigger program->more storage->more money Hence needed to reduce the number of instructions per program  Number of instructions are reduced by having multiple operations within a single instruction  Multiple operations lead to many different kinds of instructions that access memory • In turn making instruction length variable and fetch-decode execute time unpredictable – making it more complex • Thus hardware handles the complexity Main Idea of CISC
  • 20.  Use microcode • Used a simplified microcode instruction set to control the data path logic. This type of implementation is known as a micro programmed implementation.  Build rich instruction sets • Consequences of using a micro programmed design is that designers could build more functionality into each instruction.  Build high-level instruction sets • The logical next step was to build instruction sets which map directly from high-level languages Main Idea of CISC
  • 21. Characteristics of a CISC design • Register to register, register to memory, and memory to register commands. • Uses Multiple addressing modes. • Variable length instructions where the length often varies according to the addressing mode • Instructions which require multiple clock cycles to execute.
  • 22. CISC Vs. RISC General purpose registers Arithmetic Logical Unit Main memory Memory (1,1) .. (6,4) = 24 locations Registers: A,B,C,D,E,F Execution unit : arithmetic ( + -* ÷)
  • 23. Multiplication  Let's say we want to find the product of two numbers - one stored in location 2:3 and another stored in location 5:2 - and then store the product back in the location 2:3.  i.e., M(2,3)< - M(5,2)*M(2,3) 2,3 5,2
  • 24. CISC Approach For this particular task, a CISC  processor would come prepared with a specific instruction (we'll call it "MULT"). MULT A,B When executed, this instruction  loads the two values into separate registers,  multiplies the operands in the execution unit, and then  stores the product in the appropriate register. Thus, the entire task of multiplying two numbers can be completed with one instruction  MULT is what is known as a "complex instruction."  It operates directly on the computer's memory banks and does not require the programmer to explicitly call any loading or storing functions.  It closely resembles a command in a higher level language, identical to the C statement “a = a * b.”
  • 25. RISC Approach • RISC processors only use simple instructions that can be executed within one clock cycle. • The "MULT" command described above could be divided into three separate commands: LOAD A, 2:3 LOAD B, 5:2 PROD A, B ("PROD,"finds the product of two operands ) STORE 2:3, A ("STORE,“ moves data from a register to the memory banks) (LOAD, which moves data from the memory bank to a register)
  • 26. CISC RISC  Primary goal is to complete a task in as few lines of assembly as possible  Emphasis on hardware  Includes multi-clock, complex instructions  Memory-to-memory: "LOAD" and "STORE" incorporated in instructions  Difficult to apply pipelining.  Small code sizes, high cycles per second  Primary goal is to speedup individual instruction  Emphasis on software  Single-clock, reduced instruction only  Register to register: "LOAD" and "STORE” are independent instructions  Easy to apply pipelining.  Low cycles per second, large code sizes
  • 27. The Performance Equation • The following equation is commonly used for expressing a computer's performance ability: Cisc Risc The CISC approach attempts to minimize the number of instructions per program, sacrificing the number of cycles per instruction. RISC does the opposite, reducing the cycles per instruction at the cost of the number of instructions per program.
  • 28. Which one is better? • There is still considerable controversy among experts about which architecture is better. Some say that RISC is cheaper and faster and therefore the architecture of the future. Others note that by making the hardware simpler, RISC puts a greater burden on the software. Software needs to become more complex. Software developers need to write more lines for the same tasks.
  • 29. No Big Difference Now • RISC and CISC architectures are becoming more and more alike. • Many of today's RISC chips support just as many instructions as yesterday's CISC chips. The PowerPC 601, for example, supports more instructions than the Pentium. Yet the 601 is considered a RISC chip, while the Pentium is definitely CISC. • Further more today's CISC chips use many techniques formerly associated with RISC chips • So simply said: RISC and CISC are growing to each other
  • 30. Types of Microcontrollers 4 Bit Microcontrollers:
  • 31. Types of Microcontrollers 8 Bit Microcontrollers:
  • 32. Types of Microcontrollers 16 Bit Microcontrollers:
  • 33. Types of Microcontrollers 32 Bit Microcontrollers: Intel 80960
  • 37. Features of 8051 • 4KB bytes on-chip program memory (ROM) and 128 bytes on-chip data memory (RAM) • Four register banks • 8-bit bidirectional data bus and 16-bit unidirectional address bus • 32 general purpose registers, each of 8-bit • 16 bit Timers (usually 2) • Three internal and two external Interrupts • Four 8-bit ports • 16-bit program counter and data pointer • It has 21 special function register. • 1 Microsecond instruction cycle with 12 MHz Crystal. • Multi mode high speed programmable full duplex serial port • It has 111 instructions, 64 instructions are single cycle.
  • 38. Pins and Signals of 8051
  • 54. Timer Mode Register The Gatex bit is used to operate the Timerx with respect to the INTx pin or regardless of the INTx pin. GATE1 = 1 ==> Timer1 is operated only if INT1 is SET. GATE1 = 0 ==> Timer1 is operates irrespective of INT1 pin. GATE0 = 1 ==> Timer0 is operated only if INT0 is SET. GATE0 = 0 ==> Timer0 is operates irrespective of INT0 pin. The C/Tx bit is used selects the source of pulses for the Timer to count. C/T1 = 1 ==> Timer1 counts pulses from Pin T1 (P3.5) (Counter Mode) C/T1 = 0 ==> Timer1 counts pulses from internal oscillator (Timer Mode) C/T0 = 1 ==> Timer0 counts pulses from Pin T0 (P3.4) (Counter Mode) C/T0 = 0 ==> Timer0 counts pulses from internal oscillator (Timer Mode)
  • 100. Port 3
  • 101. Instruction Set • An instruction is an order or command given to a processor by a computer program. All commands are known as instruction set and set of instructions is known as program. • 8051 have in total 111 instructions, i.e. 111 different words available for program writing.
  • 102. Instruction Format • Where first part describes WHAT should be done, while other explains HOW to do it. • The latter part can be a data (binary number) or the address at which the data is stored. • Depending upon the number of bytes required to represent 1 instruction completely.
  • 103. Types of Instructions Instructions are divided into 3 types 1. One/single byte instruction. 2. Two/double byte instruction. 3. Three/triple byte instruction.
  • 104. Types of Instructions 1. One/single byte instructions : • If operand is not given in the instruction or there is no digits present with instruction, the instructions can be completely represented in one byte opcode. • OPCODE 8 bit
  • 105. Types of Instructions 2. Two/double byte instruction: – If 8 bit number is given as operand in the instruction, the such instructions can be completed represented in two bytes. – First byte OPCODE – Second byte 8 bit data or I/O port
  • 106. Types of Instructions 3. Three/triple byte instruction: • If 16 bit number is given as operand in the instructions than such instructions can be completely represented in three bytes 16 bit number specified may be data or address.
  • 107. Types of Instructions 1. First byte will be instruction code. 2. Second byte will be 8 LSB’s of 16 bit number. 3. Third byte will be 8 MSB’s of 16 bit number. • First byte OPCODE. • Second byte 8 LSB’s of data/address. • Third byte 8 MSB’S of data/address.
  • 108. Addressing Modes • Addressing modes specifies where the data (operand) is. They specify the source or destination of data (operand) in several different ways, depending upon the situation. • Addressing modes are used to know where the operand located is.
  • 109. Addressing Modes • There are 5 types of addressing modes: 1. Register addressing. 2. Direct addressing. 3. Register indirect addressing. 4. Immediate addressing. 5. Index addressing.
  • 110. Register Addressing Mode • In register addressing mode, the source and/or destination is a register. • In this case, data is placed in any of the 8 registers(R0-R7). In instructions, it is specified with letter Rn (where N indicates 0 to 7).
  • 111. Register Addressing Mode • For example, 1. ADD A, Rn (This is general instruction). 2. ADD A, R5 (This instruction will add the contents of register R5 with the accumulator contents).
  • 114. Direct Addressing Mode • In direct addressing mode, the address of memory location containing data to be read is specified in instruction. • In this case, address of the data is given with the instruction itself.
  • 115. Direct Addressing Mode • For example, MOV A, 25H (This instruction will read/move the data from internal RAM address 25H and store it in the accumulator).
  • 116. Register Indirect Addressing Mode • In register indirect addressing mode, the contents of the designated register are used as a pointer to memory. • In this case, data is placed in memory, but address of memory location is not given directly with instruction.
  • 117. Register Indirect Addressing Mode • For example, MOV A,@R0 This instruction moves the data from the register whose address is in the R0 register into the accumulator.
  • 118. Immediate Addressing Mode • In immediate addressing mode, the data is given with the instruction itself. • In this case, the data to be stored in memory immediately follows the opcode.
  • 119. Immediate Addressing Mode For example, MOV A, #25H (This instruction will move the data 25H to accumulator).
  • 122. Indexed Addressing Mode • Offset (from accumulator) is added to the base index register( DPTR OR Program Counter) to form the effective address of the memory location. • In this case, this mode is made for reading tables in the program memory.
  • 123. Indexed Addressing Mode For example, MOVC A, @ A + DPTR ( This instruction moves the data from the memory to accumulator; whose address is computed by adding the contents of accumulator and DPTR)
  • 125. Types Of Instructions 1. Data transfer instructions. 2. Arithmetic instructions. 3. Logical instructions. 4. Logical instructions with bits. 5. Branch instructions.
  • 126. Data Transfer Instructions • These instructions move the content of one register to another one. • Data can be transferred to stack with the help of PUSH and POP instructions.
  • 127. Data Transfer Instructions MNEMONIC DESCRIPTION BYTES MOV A, Rn (A) (Rn) 1 MOV A, Rx (A) (Rx) 2 MOV A, @Ri (A) (Ri) 1
  • 128. Data Transfer Instructions MOV A, #X (A) Data 2 MOV Rn, A (Rn) (A) 1 MOV Rn, Rx (Rn) (Rx) 2
  • 129. Data Transfer Instructions MOV @ Ri, A (Ri) (A) 1 MOV @ Ri, Rx (Ri) (Rx) 2 MOV @ Ri, #X (Ri) Data 2
  • 130. Arithmetic Instructions • These instructions perform several basic operations. After execution, the result is stored in the first operand. • 8 bit addition, subtraction, multiplication, increment-decrement instructions can be performed.
  • 131. Arithmetic Instructions MNEMONICS DESCRIPTION BYTE ADD A, Rn A = A + Rn 1 ADD A, Rx A = A + Rx 2 ADD A, @ Ri A = A + Ri 1
  • 132. Arithmetic Instructions ADD A, # X A = A + Byte 2 ADDC A, Rn A = A + Rn + C 1 ADDC A , Rx A = A + Rx + C 2
  • 133. Arithmetic Instructions ADDC A, @ Ri A = A + Ri + C 1 ADDC A, # X A = A + Byte + C 2 SUBB A, Rn A = A – Rn – 1 1
  • 134. Arithmetic Instructions SUBB A, Rx A = A – Rx – 1 2 SUBB A, @ Ri A = A – Ri – 1 1 SUBB A, # X A = A – Byte – 1 2
  • 135. Arithmetic Instructions INC A A = A + 1 1 INC Rn Rn = Rn + 1 1 INC Rx Rx = Rx + 1 2
  • 136. Arithmetic Instructions INC @ Ri Ri = Ri + 1 1 DEC A A = A – 1 1 DEC Rn Rn = Rn – 1 1
  • 137. Arithmetic Instructions DEC Rx Rx = Rx – 1 2 DEC @ Ri Ri = Ri – 1 1 INC DPTR DPTR = DPTR + 1 1
  • 138. Arithmetic Instructions MUL AB B:A = A * B 1 DIV AB A = [A/B] 1
  • 140. Logical Instructions These instructions perform logical operations between two register contents on bit by bit basis. After execution, the result is stored in the first operand.
  • 141. Logical Instructions MNEMONIC DESCRIPTION BYTE ANL A, Rn (A) (A) ^ (Rn) 1 ANL A, Rx (A) (A) ^ (Rx) 2 ANL A,@ Ri (A) (A) ^ (Ri) 1
  • 142. Logical Instructions ANL A, # X (A) (8 bit data) ^ (A) 2 ANL Rx, A (Rx) (A) ^ (Rx) 2 ANL Rx,# X (Rx) (8 bit data) ^ (Rx) 3
  • 143. Logical Instructions ORL A, Rn (A) (A) + (Rn) 1 ORL A, Rx (A) (A) + (Rx) 2 ORL A, @ Ri (A) (A) + (Ri) 2
  • 144. Logical Instructions RR A (An) (An + 1) 1 (A7) (A0) RRC A (An) (An + 1) 1 (A7) ( C ) ( C ) (A0)
  • 145. Logical Instructions On Bits MNEMONIC DESCRIPTION BYTE CLR C ( C = 0 ) 1 CLR bit clear directly addressed bit 2 SETB C ( C = 1 ) 1
  • 146. Logical Instructions On Bits SETB bit Set directly 2 addressed bit CPL C (1 = 0, 0 = 1) 1 CPL bit Complement directly 2 addressed bit
  • 147. Program Flow Control Instructions In this group, instructions are related to the flow of the program, these are used to control the operation like, JUMP and CALL instructions. Some instructions are used to introduce delay in the program, to the halt program.