Professional Documents
Culture Documents
Program Description
Operating system DOS or Windows operating systems are used for the programming
program process.
Word processing Assembly program mnemonics are written in the text editor. This is
Text editor stored on the disk in the format of file with extension .asm.
The assembler will take the .asm file from the disk and convert that into
Assembler
machine code. The machine code is stored in the file with extension
program
.obj.
This program allows the user to test his program under controlled
Testing program conditions. These testing programs can also called as debuggers or
simulators.
Write the program using the mnemonics by using the text editor.
Store the edited assembly program on the disk
Load the assembled machine language program form the disk into the
RAM for testing purpose.
Identify the errors, reedit the program, reassemble the program and
again test until get the result.
Flow charts: Flow charts are used for visualizing the programs. Flow chart uses five
elements, they are
Symbol Purpose
Action The action box is used to represent the data moves, math operations or any
box other instructions used to denote the program action.
Bubble This is used to represent the beginning and end of the programs.
the decision symbol used for condition checking the condition outputs either
Decision
yes or no. The decision is represented by using diamond symbol.
Line The line is used for showing the program flow.
The line is used for showing the program flow. The arrow will show in what
Arrow
direction the information is passing.
Assembly language programs are written as the sequence of text lines. Each line of the
text is nothing but the instruction to the CPU. The syntax of the instruction of the text line
is shown below.
Moving data:
The data stored at the source address are moved onto the destination address. The 8051 is
using six types of op-codes for moving data. They are
Op-Code Description
moves the data from internal RAM source address to internal RAM destination
MOV
address.
moves a byte data from external RAM source address to register A and vice
MOVX
versa.
MOVC moves data from external or internal RAM source address to register A
PUSH copy a byte to internal stack from internal RAM source.
POP copy a byte from internal stack to internal RAM destination.
XCH used to exchange data between register and internal RAM.
"Logical Instructions"
Logical Operations: The logical instructions in 8051 are divided into two types.
The byte level logical operations use all four addressing modes for the
source of a data type. Logical operations at the BYTE level The destination
address of the operartion can be the accumulator (register A), a general
register, or a direct address. Status flags are not affected by these logical
operations (unless PSW is directly manipulated).
Example instructions are:
ANL A, #55h ; AND each bit in A with corresponding bit in
Byte level
number 55h, leaving the result in A.
logical
ANL 42h, R4 ; AND each bit in RAM location 42h with
operations
corresponding bit in R4, leaving the result in RAM location 42h.
ORL A,@R1 ; OR each bit in A with corresponding bit in the
number whose address is contained in R1 leaving the result in A.
XRL R4, 80h ; XOR each bit in R4 with corresponding bit in RAM
location 80h (port 0), leaving result in A.
Other Instructions
RRC A ; Rotates to the right and includes the carry bit as the 9th
bit.
Swap The Swap instruction swaps the accumulator’s high order nibble with the
Instructions low-order nibble using the instruction: