AssemblyProgramPractice
AssemblyProgramPractice
Practice
https://www.eeemadeeasy.com/8051-microcontroller-instruction-set/#Subtraction
Examples
Addition of two numbers:
ORG 0000H
MOV A, # 05H 05 - 0000 0101
ADD A, # 02 H 02 - 0000 0010
END 07 0000 0111
0F 0000 1111
02 0000 0010
1 0001
Examples
Addition of two numbers:
ORG 0000H
MOV A, #0AH 0A - 0000 1010
ADD A, # 02h 02 - 0000 0010
END 0C - 0000 1100
Different Versions of MOV Instruction
Examples
Addition of two numbers:
ORG 0000H
MOV A, #0FFH FF - 1111 1111
ADD A, # 01H 01 - 0000 0001
END 100 - 0001 0000 0000
ANS:7F
What will be the contents of A after the
execution of following instructions?
ORG 0000H
MOV R0, #30H
MOV 30H, #01H
MOV A, @R0
RL A
RL A
END
ANS:04
What value to be loaded in register PSW for
selecting Bank3
MOV PSW , #
What is the address of register R7?
ORG 0000H
CLR PSW.3
SETB PSW.4
MOV R7,A
END
ANS:00
How many times will the loop be executed in the
following set of instructions?
ORG 0000H
MOV A, #55H A= 0101 0101
DJNZ R2, UP
DJNZ R3, NEXT
END
ANS:700
What will be the contents of A after the
execution of following instructions?
ORG 0000H
MOV A, #47H
MOV R0, #25H
ADD A, R0
DA A
END
ANS:72
What is the location value of R0 and the content at that place
after the following set of instructions are executed?
ORG 0000H
MOV R0, #56H
MOV A, #05
ADD A, R0
DA A
INC R0
MOV @R0, A
END
ANS:R0=57
What will be the contents of R0 and A after the
execution of following instructions?
ORG 0000H
MOV A, #32H
MOV R0, #56H
CJNE A, R0, L1
INC R0
L1: INC A
END
ANS:A=75H; R0=41H
What is the result in A, @R1 after the following set of
instructions are executed?
ORG 0000H
MOV A, #72H
MOV R1, #70H
MOV 70H, # 43H
XCHD A, @R1
END
ANS:A=73H; R1=42H
What is the value of the bits 0-3 of @R0 after the
following instructions are executed?
ORG 0000H
MOV @R0, #05H
MOV A, #21H
XCHD A, @R0
END
ANS:A=25H;R0=01
What is the value of the bits 0-3 of @R0 after the
following instructions are executed?
ORG 0000H
MOV @R0, #05H
MOV A, #21H
XCHD A, @R0
END
ANS:
What will be contents of DPTR after execution of
following instructions?
ORG 0000H
MOV DPTR, #5006H
MOV A, #4
MOVC A, @A + DPTR
END
ANS:
What will be contents of DPTR after execution of following
instructions?
ORG 0000H
MOV DPTR, #5006H
MOV A, #4
MOVC A, @A + DPTR
END
ANS: 5006H
What will be the contents of the registers R2 and R3
after the following instructions are executed?
ORG 0000H
MOV DPTR,#00FF H
MOV R2,DPL
MOV R3,DPH
END
ANS:
Which is equivalent instruction?
ORG 0000H
MOV A, #55H
RL A
RL A
RL A
RL A
END
ANS:
What will be the contents of A after the execution
of following instructions? Consider CY = 1 initially
ORG 0000H
CLR C
MOV A, #4CH
SUBB A, #6EH
END
POP 4
POP 1
POP 6 0A
0F3
09 12 12
08 25 25
25 25
P0MDIN= 0XFFH
P0MDIN= 0X00H
What Is An Integrated Development
Environment (IDE)?
• Integrated development environments (IDE) are applications that facilitates
the development of other applications. Designed to encompass all
programming tasks in one application, one of the main benefits of an IDE is
that they offer a central interface with all the tools a developer needs,
including:
• Code editor: Designed for writing and editing source code, these editors are
distinguished from text editors because work to either simplify or enhance
the process of writing and editing of code for developers
• Compiler: Compilers transform source code that is written in a human
readable/writable language in a form that computers can execute.
• Debugger: Debuggers are used during testing and can help developers debug
their application programs.
• Build automation tools: These can help automate developer tasks that are
more common to save time.
Languages That Are Supported by IDE
µVision® IDE
The µVision IDE combines project management, run-time environment,
build facilities, source code editing, and program debugging in a single
powerful environment. µVision is easy-to-use and accelerates your
embedded software development. µVision supports multiple screens and allows you to create
individual window layouts anywhere on the visual surface.
The µVision Debugger provides a single environment in which you may test, verify, and optimize
your application code. The debugger includes traditional features like simple and complex
breakpoints, watch windows, and execution control and provides full visibility to device
peripherals.
• Value to be loaded in P0MDOUT to make P0 as output port
XBR1 = 0x43
P0SKIP = 0x0C
P1SKIP = 0x01