Vous êtes sur la page 1sur 31

DATE: SHEET NO:

READING AND WRITING ON A PARALLEL PORTUSING 8051


MICROCONTROLLER
AIM: To perform reading and writing on a parallel port in 8051 micro controller.

RESOURCES: PC loaded with ESA software and connected to 8051 microcontroller hardware kit,
Regulated power supply.

THEORY:
MEMORY ARCHITECTURE:
The 8051 microcontroller has four distinct types of memory-internal RAM, special function registers,
program memory, and external data memory.
The 8051 is designed as a strict Harvard architecture; it can only execute code fetched from program
memory, and has no instructions to write to program memory.
INTERNAL RAM:
It has an 8-bit address space, allowed addresses 0 through 0Xff.IRAM from 0x00 to 0x7F can be accessed
directly. The address is loaded into R0 or R1, and memory is accessed using the @ R0 or @R1; indirect
address to those addresses will access the second half of the IRAM.

SPECIAL FUNCTION REGISTERS:


SFR’s are located in the same address space as IRAM, at address as for the lower half of IRAM.
16 of the SFRs are also bit-addressable.
EXTERNAL DATA MEMORY:
It is a third address space, also starting at address 0, and allowing 16 bits of address space.it can also be on-
off chip.
REGISTERS:
The only register on an 8051 that is not memory-mapped is the 16-bit program counter PC. This specifies
the address of the next instruction to execute. Relative branch instructions supply an 8-bit signed offset
which is added to the PC.
8 general purpose registers R0-R7 may be accessed with instructions 1 byte shorter than others.
PORTS:
The 8051 microcontrollers have 4I/O ports each comprising of 8-bits which can be configured as inputs or
outputs.
Port 0:
The P0 port is characterised by two functions. If external memory is used then the lower address byte
(addresses A0-A7) is applied on it. Otherwise, all bits of this port are configured as inputs/outputs.
Port 1:
P1 is a true I/O port, because it doesn’t have any alternative functions as is the case with P0, but can be
configured asa general I/O only.
Port 2:
P2 acts similarly to P0 when external memory is used.Pins of this port occupy addresses intended for
external memory chip.
Port 3:
All port pins can be used as general I/O, but they also have ana alternative function.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PROCEDURE:

 Switch on the PC, check for ESA term and enter into esa xt51.
 In the kit, we need to check serial in display.
 Open xt51.
 Reset your kit.
 Then we will get into prompt mode.
 Give the program starting address with the syntax: A 800 and give enter.
 Enter the program.
 For termination from the program mode press ESC.
 For given input use MD data address.
 For execution press SR Program starting address.
 Do this operation till completion of program.
 Note down the results of each and every step.
 For getting the opcodes use Z command.
 Syntax: Z starting address ending address.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ALGORITHM:
1. Initialize the accumulator and Point DPTR to an address location.
2. Read external memory location content to accumulator.
3. Copy the data from accumulator to port P1 address (Reading).
4. Copy the data from port3 to accumulator (Writing).
5. Increment DPTR and Copy the data in accumulator to external memory location.

OBSERVATIONS:
A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL
(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
00 00 07 01 9D 00 00 00 00 00 FF FB 90 03
R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
D7 79 7F BF 51 63 F4 4C 00000001
8003 E0 MOVX A, @DPTR
A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL
(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
00 00 07 01 9D 00 00 00 00 8E FF FB 90 04
R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
D7 79 7F BF 51 63 F4 4C 00000001
8004 F5 90 MOV 90H, A
A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL
(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
00 00 07 01 9D 00 00 00 00 8E FF FB 90 06
R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
D7 79 7F BF 51 63 F4 4C 00000001
8006 E5 B0 MOV A, 0B0H
A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL
(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
00 00 07 01 9D 00 00 00 00 8E FF FB 90 08
R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
D7 79 7F BF 51 63 F4 4C 00000001
8008 A3 INC DPTR
A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL
(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
00 00 07 01 9D 00 00 00 00 8F FF FB 90 09
R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
D7 79 7F BF 51 63 F4 4C 00000001
8009 F0 B0 MOVX@DPTR, A
A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL
(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
00 00 07 01 9D 00 00 00 00 8F FF FB 90 0A
R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
D7 79 7F BF 51 63 F4 4C 00000001
PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY
DATE: SHEET NO:

800A 80 FE SJMP 900AH


CODE:
A 8000
MOV DPTR, #9000
MOVX A,@DPTR
MOV 90, A
MOV A, 0B0
INC DPTR
MOVX @DPTR, A
SJMP 800A
MACHINE CODE:

ADDRESS OBJECT MNEMONIC COMMENT


8000 90 90 00 MOV DPTR,#9000H Point DPTR to location 9000
8003 E0 MOVX A,@DPTR Read external memory location content to accumulator
8004 F5 90 MOV 90H,A Copy the data in accumulator to port P1
8006 E5 B0 MOV A,0B0H Copy data in port3 to accumulator
8008 A3 INC DPTR Increment DPTR
8009 F0 MOVX @DPTR,A Copy the data in accumulator to external memory
location
800A 80FE SJMP 800AH Short jump

RESULT: Reading and writing on a parallel port in 8051 microcontroller has been performed.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

8255-PPI: WRITE AN ALP TO GENERATE SINUSOIDAL WAVE USING PPI


AIM: To generate a sine wave using 8086 microprocessor.

RESOURCES: PC loaded with ESA software and connected to 8086 microprocessor hardware kit, ADC/DAC
interface, Regulated power supply.

THEORY:
The Intel 82C55A is a general purpose programmable I/O device which may be used with many different
microprocessors. There are 24 I/O pins which may be individually programmed in 2 groups of 12 and used in 3 major
modes of operation. The high performance and industry standard configuration of the 82C55A make it compatible
with the 8086.

DATA BUS BUFFER:


This three-state bi-directional 8-bit buffer is used to interface the 82C55A to the system data bus. Data is
transmitted or received by the buffer upon execution of input or output instructions by the CPU. Control words and
status information are also transferred through the data bus buffer. Read/Write and Control Logic The function of
this block is to manage all of the internal and external transfers of both Data and Control or Status words. It accepts
inputs from the CPU Address and Control busses accepts inputs from the CPU Address and Control busses and in
turn, issues commands to both of the Control Groups.
PORT SELECT: These input signals, in conjunction with the RD and WR inputs, control the selection of one of the
three ports or the control word register
(CS) CHIP SELECT: A “low” on this input pin enables the communication between the 82C55A and the CPU.
(RD) READ: A “low” on this input pin enables 82C55A to send the data or status information to the CPU on the data
bus.
(WR) WRITE: A “low” on this input pin enables the CPU to write data or control words into the 82C55A.
(RESET) RESET: A “high” on this input initializes the control register to 9Bh and all ports (A, B, C) are set to the input
mode. “Bus hold” devices internal to the 82C55A will hold the I/O port inputs to a logic “1” state with a maximum
hold current of 400mA.
The modes for Port A and Port B can be separately defined, while Port C is divided into two portions as required by
the Port A and Port B definitions. For instance: Group B can be programmed in Mode 0 to monitor simple switch
closings or display computational results, Group A could be programmed in Mode 1 to monitor a keyboard or tape
reader on an interrupt-driven basis.
MODE 1 - (Strobed Input/Output: This functional configuration provides a means for transferring I/O data to or from
a specified port in conjunction with strobes or “hand shaking” signals. In mode 1, port A and port B use the lines on
port C to generate or accept these “hand shaking” signals.
MODE 1 BASIC FUNCTIONS:
Two Groups (Group A and Group B)
Each group contains one 8-bit port and one 4-bit control/data port
The 8-bit data port can be either input or output. Both inputs and outputs are latched.
The 4-bit port is used for control and status of the 8-bit port.
MODE 2 BASIC FUNCTIONS:
Used in Group A only
One 8-bit, bi-directional bus Port (Port A) and a 5-bit control Port (Port C)
Both inputs and outputs are latched
The 5-bit control port (Port C) is used for control and status for the 8-bit, bi-directional bus port (Port A)
BSR Mode For 8255: Any of the eight bits of Port C can be Set or Reset using a single Output instruction. This
feature reduces software requirements in control based applications. Operation just as if they were output ports.
When Port C is being used as status/control for Port A or B, these bits can be set or reset by using the Bit Set/Reset.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PROCEDURE:

 Switch on the PC, check for ESA term and xt86.


 We need to get ESA 86 in trainer kit display.
 Check for ESA directory and xt86 file
 Go to run menu, type cmd or command.
 Go to ESA directory.
 Type xt86, then we will be getting a message press any key to continue.
 Press RST from the trainer kit.
 We will be entering into the DOT menu.
 Press A to exit from DOT and entering into prompt mode.
 Give SG 00 to clear all the segments.
 Press LC to clear all the labels.
 Next DA address, enter the program in the window.
 The program is to be entered a space before every instruction.
 For the execution shift+1 (or)! Is entered.
 Then type EX and press enter key.
 After that type G and press enter key.
 Then enter the starting address.
 Then the sine wave is displayed on the CRO.
 Then observe the waveform and take readings like amplitude and time period.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ALGORITHM:
1. Initialize control word register.

2. Send the data to the port A in different steps from 00 to FF and from FF to 00 i.e. during on cycle
duration and off cycle duration.

3. Repeat step2 for repeated cycles for getting continuous sine wave.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

CODE:
MOVB AL, #80
MOVW DX, #0FFE7
OUTB DX
L7: MOVB AL, #00
L1: MOVWDX, #0FFE1
OUTB DX
INCB AL
CMPB AL, #0F
JB L1
L2: MOVWDX, #0FFE1
OUTB DX
INCB AL
INCB AL
INCB AL
CMPB AL, #0EF
JB L2
L3: MOVWDX, #0FFE1
OUTB DX
INCB AL
CMPB AL, #0FF
JB L3
L4: MOVW DX, #0FFE1
OUTB DX
DECB AL
CMPB AL, #0EF
JA L4
L5: MOVWDX, #0FFE1
OUTB DX
DECB AL
DECB AL
DECB AL
CMPB AL, #0F
JA L5
L6: MOVWDX, #0FFE1
OUTB DX
DECB AL
CMPB AL, #00
JA L6
JMP L7
INT 03

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

MACHINE CODE:
ADDRESS OPCODE MNEMONIC OPERAND COMMENTS
3000 B080 MOVB AL,#80 Copy the data 80 into control word
3002 BAE7FF MOVW DX,#FFE7 register of 8255A
3005 EE OUTB DX
3006 B000 MOVB AL,#00 Initialize accumulator with 00
3008 BAE1FF MOVW DX,#FFE1 In steps of 1 Send the data from 00
300B EE OUTB DX to 0F in port A of 8255
300C FEC0 INCB AL
300E 3D0F CMPB AL,#0F
3010 72F6 JB 3008
3012 BAE1FF MOVW DX,#FFE1 In steps of 3 send the data from 0F
3015 EE OUTB DX to EF in port A of 8255
3016 FEC0 INCB AL
3018 FEC0 INCB AL
301A FEC0 INCB AL
301C 3CEF CMPB AL,#EF
301E 72F2 JB 3012
3020 BAE1FF MOVW DX,#FFE1 In steps of 1 send the data from EF
3023 EE OUTB DX to FF in port A of 8255
3024 FEC0 INCB AL
3026 3CFF CMPB AL,#FF
3028 72F6 JB 3020
302A BAEHF MOVW DX,#FFE1 In steps of 1 send the data from FF
302D EE OUTB DX to EF in port A of 8255
302E FEC8 DECB AL
3030 3CEF CMPB AL,#EF
3032 77F6 JNBE 302A
3034 BAE1FF MOVW DX,#FFE1 In steps of 3 send the data from EF
3037 EE OUTB DX to 0F in port A of 8255
3038 FEC8 DECB AL
303A FEC8 DECB AL
303C FEC8 DECB AL
303E 3C0F CMPB AL,#0F
3042 77F0 JNBE 3034 Insteps of 3 send the data from 0F
3044 BAE1FF MOVW DX,#FFE1 to 0 0 in port A of 8255
3047 FE OUTB DX
3048 FEC8 DECB AL
304A 3C00 CMPB AL,#00
304C 77F6 JNBE 3044
304E EBB6 JMP 3006 Repeat the loop for getting next
cycle
3050 CC INT 3 Halt the program

RESULT: Sine wave is generated using 8086 microprocessor, its amplitude and time period are noted and
waveform is plotted.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

8255-PPI: WRITE AN ALP TO GENERATE SQUARE WAVE USING PPI


AIM: To generate a square wave using 8086 microprocessor.
RESOURCES: PC loaded with ESA software and connected to 8086 microprocessor hardware kit, ADC/DAC
interface, Regulated power supply.
THEORY:
The Intel 82C55A is a general purpose programmable I/O device which may be used with many different
microprocessors. There are 24 I/O pins which may be individually programmed in 2 groups of 12 and used in 3 major
modes of operation. The high performance and industry standard configuration of the 82C55A make it compatible
with the 8086.

DATA BUS BUFFER:


This three-state bi-directional 8-bit buffer is used to interface the 82C55A to the system data bus. Data is
transmitted or received by the buffer upon execution of input or output instructions by the CPU. Control words and
status information are also transferred through the data bus buffer. Read/Write and Control Logic The function of
this block is to manage all of the internal and external transfers of both Data and Control or Status words. It accepts
inputs from the CPU Address and Control busses accepts inputs from the CPU Address and Control busses and in
turn, issues commands to both of the Control Groups.
PORT SELECT: These input signals, in conjunction with the RD and WR inputs, control the selection of one of the
three ports or the control word register
(CS) CHIP SELECT: A “low” on this input pin enables the communication between the 82C55A and the CPU.
(RD) READ: A “low” on this input pin enables 82C55A to send the data or status information to the CPU on the data
bus.
(WR) WRITE: A “low” on this input pin enables the CPU to write data or control words into the 82C55A.
(RESET) RESET: A “high” on this input initializes the control register to 9Bh and all ports (A, B, C) are set to the input
mode. “Bus hold” devices internal to the 82C55A will hold the I/O port inputs to a logic “1” state with a maximum
hold current of 400mA.
The modes for Port A and Port B can be separately defined, while Port C is divided into two portions as required by
the Port A and Port B definitions. For instance: Group B can be programmed in Mode 0 to monitor simple switch
closings or display computational results, Group A could be programmed in Mode 1 to monitor a keyboard or tape
reader on an interrupt-driven basis.
MODE 1 - (Strobed Input/Output: This functional configuration provides a means for transferring I/O data to or from
a specified port in conjunction with strobes or “hand shaking” signals. In mode 1, port A and port B use the lines on
port C to generate or accept these “hand shaking” signals.
MODE 1 BASIC FUNCTIONS:
Two Groups (Group A and Group B)
Each group contains one 8-bit port and one 4-bit control/data port
The 8-bit data port can be either input or output. Both inputs and outputs are latched.
The 4-bit port is used for control and status of the 8-bit port.
MODE 2 BASIC FUNCTIONS:
Used in Group A only
One 8-bit, bi-directional bus Port (Port A) and a 5-bit control Port (Port C)
Both inputs and outputs are latched
The 5-bit control port (Port C) is used for control and status for the 8-bit, bi-directional bus port (Port A)
BSR Mode For 8255: Any of the eight bits of Port C can be Set or Reset using a single Output instruction. This
feature reduces software requirements in control based applications. Operation just as if they were output ports.
When Port C is being used as status/control for Port A or B, these bits can be set or reset by using the Bit Set/Reset.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PROCEDURE:

 Switch on the PC, check for ESA term and xt86.


 We need to get ESA 86 in trainer kit display.
 Check for ESA directory and xt86 file
 Go to run menu, type cmd or command.
 Go to ESA directory.
 Type xt86, then we will be getting a message press any key to continue.
 Press RST from the trainer kit.
 We will be entering into the DOT menu.
 Press A to exit from DOT and entering into prompt mode.
 Give SG 00 to clear all the segments.
 Press LC to clear all the labels.
 Next DA address, enter the program in the window.
 The program is to be entered a space before every instruction.
 For the execution shift+1 (or)! Is entered.
 Then type EX and enter key.
 After that type G and enter key.
 Then enter the starting address.
 Then the square wave is displayed on the CRO.
 Then observe the waveform and take readings like amplitude and frequency.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ALGORITHM:
1. Initialize control word register.

2. Send the data to the port A in different steps from on state to off state and vice versa.

3. Repeat step2 for repeated cycles for getting continuous square wave.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

CODE:
MOVB AL, #80
MOVWDX, #0FFE7
OUTB DX
L3: MOVB AL, #00
MOVB CL, #00
L1: MOVWDX, #0FFE1
OUTB DX
INCB CL
CMPB CL, #0FF
JB L1
MOVB AL, #0FF
L2: MOVWDX, #0FFE1
OUTB DX
DECB CL
CMPB CL, #00
JA L2
JMP L3
INT 03

MACHINE CODE:

ADDRESS OPCODE MNEMONIC OPCODE COMMENT


3000 B080 MOVB AL,#80 Copy the data 80 into control
3002 BAE7FF MOVW DX,#FFE7 word register of 8255A
3005 EE OUTB DX
3006 B000 MOVB AL,#00 Initialize accumulator with 00
3008 B100 MOVB CL,#00 Copy 00 to CL register
300A BAE1FF MOVW DX,#FFE1 Insteps of 1 send the data from
300D EE OUTB DX 00 to FF in port A of 8255 and
300E FEC1 INCB CL increment CL
3010 80F9FF CMPB CL,#FF
3013 72F5 JB 300A
3015 B0FF MOVB AL,#FF Insteps of 1 send the data from
3017 3AE1FF MOVW DX,#FFE FF to 00 in f port A of 8255 and
301A EE OUTB DX decrement CL
301B FEC9 DECB CL
301D 80F900 CMPB CL,#00
3020 77F5 JNBE 3017
3022 EBE2 JMP 3006 Repeat the loop for getting
next cycle
3024 CC INT 3 Halt the program

RESULT: Sine wave is generated using 8086 microprocessor, its amplitude and time period are noted and
waveform is plotted.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ARITHMETIC OPERATIONS USING 8051 MICROCONTROLLER


AIM: To perform Arithmetic operations using 8051 microcontroller.

RESOURCES: PC loaded with ESA software and connected to 8051 microcontroller hardware kit,
Regulated power supply.

THEORY:
MEMORY ARCHITECTURE:
The 8051 microcontroller has four distinct types of memory-internal RAM, special function registers,
program memory, and external data memory.
The 8051 is designed as a strict Harvard architecture; it can only execute code fetched from program
memory, and has no instructions to write to program memory.
INTERNAL RAM:
It has an 8-bit address space, allowed addresses 0 through 0Xff.IRAM from 0x00 to 0x7F can be accessed
directly. The address is loaded into R0 or R1, and memory is accessed using the @ R0 or @R1; indirect
address to those addresses will access the second half of the IRAM.

SPECIAL FUNCTION REGISTERS:


SFR’s are located in the same address space as IRAM, at address as for the lower half of IRAM.
16 of the SFRs are also bit-addressable.
EXTERNAL DATA MEMORY:
It is a third address space, also starting at address 0, and allowing 16 bits of address space.it can also be on-
off chip.
REGISTERS:
The only register on an 8051 that is not memory-mapped is the 16-bit program counter PC. This specifies
the address of the next instruction to execute. Relative branch instructions supply an 8-bit signed offset
which is added to the PC.
8 general purpose registers R0-R7 may be accessed with instructions 1 byte shorter than others.
PORTS:
The 8051 microcontrollers have 4I/O ports each comprising of 8-bits which can be configured as inputs or
outputs.
Port 0:
The P0 port is characterised by two functions. If external memory is used then the lower address byte
(addresses A0-A7) is applied on it. Otherwise, all bits of this port are configured as inputs/outputs.
Port 1:
P1 is a true I/O port, because it doesn’t have any alternative functions as is the case with P0, but can be
configured as a general I/O only.
Port 2:
P2 acts similarly to P0 when external memory is used. Pins of this port occupy addresses intended for
external memory chip.
Port 3:
All port pins can be used as general I/O, but they also have an alternative function.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

PROCEDURE:

 Switch on the PC, check for ESA term and enter into esa xt51.
 In the kit, we need to check serial in display.
 Open xt51.
 Reset your kit.
 Then we will get into prompt mode.
 Give the program starting address with the syntax: A 800 and give enter.
 Enter the program.
 For termination from the program mode press ESC.
 For given input use MD data address.
 For execution press SR Program starting address.
 Do this operation till completion of program.
 Note down the results of each and every step.
 For getting the opcodes use Z command.
 Syntax: Z starting address ending address.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ALGORITHM:
1. Initialize the accumulator
2. Read the values into accumulator and register B.
3. Perform addition operation.
4. Store the result.

ADDITON:
OBSREVATIONS:

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
97 00 07 01 00 00 00 00 FD 76 FF CB 80 02

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8002 75 F0 67 MOV 0F0H, #67H

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
97 67 07 01 00 00 00 00 FD FE FF CB 80 05

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8005 25 F0 ADD A, 0F0H

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
FE 67 07 01 00 00 00 00 FD FE FF CB 80 07

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8007 80 FE SJMP 8007H

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ADDITION:
MOV A, #97
MOV 0F0, #67
ADD A, 0F0
SJMP 8007

MACHINE CODE:
ADDRESS OBJECT MNEMONIC COMMENTS
8000 74 97 MOV A, #97H Copy 97 into accumulator
8002 75 F0 67 MOV 0F0H, #67H Copy 67 into register B
8005 25 F0 ADD A, 0F0H Add the values in accumulator and register B
8007 80 FE SJMP 8007H Short jump

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ALGORITHM:
1. Initialize the accumulator
2. Read the values into accumulator and register B.
3. Perform subtraction operation.
4. Store the result.

SUBTRACTION:
OBSREVATIONS:

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
97 67 07 01 00 00 00 00 FD FE FF CB 80 02

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8002 75 F0 67 MOV 0F0H, #67H

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
30 67 07 01 00 00 00 00 FD FF FF CB 80 05

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8005 95 F0 SUBB A, 0F0H

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
30 67 07 05 00 00 00 00 FD FF FF CB 80 07

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000101

8007 80 FE SJMP 8007H

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

SUBTRACTION:
MOV A, #97
MOV 0F0, #67
SUBB A, 0F0
SJMP 8007

MACHINE CODE:
ADDRESS OBJECT MNEMONIC COMMENTS
8000 74 97 MOV A, #97H Copy 97 into accumulator
8002 75 F0 67 MOV 0F0H, #67H Copy 67 into register B
8005 95 F0 SUBB A, 0F0H subtract the values in accumulator and register B
8007 80 FE SJMP 8007H Short jump

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ALGORITHM:
1. Initialize the accumulator
2. Read the values into accumulator and register B.
3. Perform multiplication operation.
4. Store the result.

MULTIPLICATION:
OBSREVATIONS:

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
97 00 07 01 00 00 00 00 FD 76 FF CB 80 02

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8002 75 F0 67 MOV 0F0H, #67H

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
97 67 07 01 00 00 00 00 FD FE FF CB 80 05

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8005 A4 MUL AB

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
C1 3C 07 05 00 00 00 00 FD FE FF CB 80 06

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000101

8006 80 FE SJMP 8006H

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

MULTIPLICATION:
MOV A, #97
MOV 0F0, #67
MUL AB
SJMP 8006

MACHINE CODE:
ADDRESS OBJECT MNEMONIC COMMENTS
8000 74 97 MOV A, #97H Copy 97 into accumulator
8002 75 F0 67 MOV 0F0H, #67H Copy 67 into register B
8005 A4 MUL AB Multiply the values in accumulator and register B
8006 80 FE SJMP 8006H Short jump

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

ALGORITHM:
1. Initialize the accumulator
2. Read the values into accumulator and register B.
3. Perform division operation.
4. Store the result.

DIVISION:
OBSREVATIONS:

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
97 3C 07 05 00 00 00 00 FD FE FF CB 80 02

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000101

8002 75 F0 67 MOV 0F0H, #67H

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
97 67 07 01 00 00 00 00 FD FF FF CB 80 05

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000101

8005 84 DIV AB

A B SP PSW DPH DPL TH0 TL0 TH1 TL1 P1 P3 PCH PCL


(E0) (F0) (81) (D0) (83) (82) (8C) (8A) (8D) (8B) (90) (B0)
01 30 07 01 00 00 00 00 FD FF FF CB 80 06

R0 R1 R2 R3 R4 R5 R6 R7 PSW
(00) (01) (02) (03) (04) (05) (06) (07) CAFBB0GP
00 00 00 00 00 00 00 00 00000001

8006 80 FE SJMP 8006H

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY


DATE: SHEET NO:

DIVISION:
MOV A, #97
MOV 0F0, #67
DIV AB
SJMP 8006

MACHINE CODE:
ADDRESS OBJECT MNEMONIC COMMENTS
8000 74 97 MOV A, #97H Copy 97 into accumulator
8002 75 F0 67 MOV 0F0H, #67H Copy 67 into register B
8005 84 DIV AB Divide the value in accumulator by register B
8006 80 FE SJMP 8006H Short jump

RESULT: Arithmetic operations using 8051 microcontroller have been performed.

PVP SIDDHARTHA INSTITUTE OF TECHNOLOGY

Vous aimerez peut-être aussi