0% found this document useful (0 votes)
8 views

Task 1: School of Electronics Engineering Vit, Vellore

Uploaded by

autorelax369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Task 1: School of Electronics Engineering Vit, Vellore

Uploaded by

autorelax369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

TASK 1

School of Electronics Engineering


VIT, Vellore

Reg.No

Student Name

L51+L52
Course Code MAME502P Slot & Semester
FALL ~ 2023-24

Course Name M.Tech Automotive Electronics

Program Title Microcontrollers for Vehicular Systems Lab

Date of
Date of Exp. 19/08/2023 01/09/2023
Submission

Faculty Dr. Karthikeyan A

Question
1.Write and assemble a program to add the following data and then use the simulator to
examine the CY flag. INPUT DATA REG NO: . Five max 8BIT NUMBERS (FF,
FF, FF, FF, FF)

2.Write and assemble a program to load values into each of registers R0 - R4 and then push
each of these registers onto the stack. Single-step the program, and examine the stack and
the SP register after the execution of each instruction.

3.Write an 8051 assemble language program to:


(a) Set SP = 0D,
(b) Load a different value in each of RAM locations 0D, 0C, 0B, 0A, 09, and 08,
(c) POP each stack location into registers R0 - R4. Use the simulator to single-step and
examine the registers, the stack, and the stack pointer.
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

4. Write and assemble a program to load values into each of registers R0 - R4 and then push
each of these registers onto the stack and pop them back. Single-step the program, and
examine the stack and the SP register after the execution of each instruction.
5. Write a program to add 10 bytes of BCD data and store the result in R2 and R3.
The bytes are stored in ROM space starting at 300H.

The data would look as follows:


MYDATA: DB ; pick your data. (10 DATA )

EX: 22H,43H,23H,34H,31H,77H,91H,33H,43H,07H

Notice that you must first bring the data from ROM space into the CPU's RAM,
then add them together. Use a simulator to single-step the program and examine the data.

EXPERIMENT 1:
Write and assemble a program to add the following data and then use the simulator to examine
the CY flag. INPUT DATA REG NO: Five max 8BIT NUMBERS (FF ,FF,FF,FF,FF)

Aim:
To write an 8051 ALP to perform addition of the following data and then use the simulator to
examine the CY flag Tools Required. [ DATA: 02, 03, EA, 00, 06]
Tools Required:
Keil version5 Software.
Algorithm:
1. Initialize registers A and B with the value 02 and 3A.
2. Add the contents of A and B; it is stored in accumulator (A).
3. Check the carry flag (JNC) after the addition. If no carry is occurred, go to Label1;
otherwise Increment the value in register R0.
4. Label 1: Move the value of register A to B.
5. Initialize registers A with the value EA.
6. Add the contents of A and B; it is stored in accumulator (A).

SENSE, Page 2 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

7. Check the carry flag (JNC) after the addition. If no carry is occurred, go to Label 2;
otherwise increment the value in register R0.
8. Label 2: Move the value of register A to B.
9. Initialize registers A with the value 00.
10. Add the contents of A and B; it is stored in accumulator (A).
11. Check the carry flag (JNC) after the addition. If no carry is occurred, go to Label 3;
otherwise increment the value in register R0.
12. Label 3: Move the value of register A to B.
13. Initialize registers A with the value 06.
14. Add the contents of A and B; it is stored in accumulator (A).
15. Check the carry flag (JNC) after the addition. If no carry is occurred, go to Label 4;
otherwise increment the value in register R0.
16. End of program.

Program:

Label Mnemonics Operands Addressing Type of Comments Flags


Mode used Instruction getting
affected by
the
Instruction

MOV A, #002H Immediate Data Transfer Load A Parity Flag


Addressing Instruction with 02
Mode

MOV B, #03AH Immediate Data Transfer Load B with Parity Flag


Addressing Instruction 3A
Mode

ADD A, B Immediate Arithmetic Add A and


Addressing Instruction B Operands
Mode 02 + 3A =
3C

JNC L1 Branch Jump No

SENSE, Page 3 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Instruction Carry

INC R0 Immediate Arithmetic No


Addressing Instruction Increment
Mode of R0

L1 MOV B, A Immediate Data Transfer Load the


Addressing Instruction value of A
Mode into B = 3C

MOV A, #0EAH Immediate Data Transfer Load the Parity Flag


Addressing Instruction Value EA
Mode into A

ADD A, B Immediate Arithmetic Add A and Parity Flag


Addressing Instruction B Operands Auxilary
Mode EA + 3C = carry Flag
26
Carry Flag

JNC L2 Branch Jump No Parity Flag


Instruction Carry Auxilary
carry Flag
Carry Flag

INC R0 Immediate Arithmetic R0 Parity Flag


Addressing Instruction incremented Auxilary
Mode by 1 carry Flag
(CY=1)
Carry Flag
R0=1

L2 MOV B, A Immediate Data Transfer Load the Parity Flag


Addressing Instruction value of A Auxilary
Mode into B=26 carry Flag
Carry Flag

MOV A, #000H Immediate Data Transfer Load the Auxilary


Addressing Instruction Value 00 carry Flag
Mode into A Carry Flag

SENSE, Page 4 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

ADD A, B Immediate Arithmetic Add A and Parity Flag


Addressing Instruction B Operands
Mode 00 + 26 =
26

JNC L3 Branch Jump No Parity Flag


Instruction Carry

INC R0 Immediate Arithmetic No Parity Flag


Addressing Instruction Increment
Mode of Register

L3 MOV B, A Immediate Data Transfer Load the Parity Flag


Addressing Instruction value of A
Mode into B = 26

MOV A, #006H Immediate Data Transfer Load the


Addressing Instruction Value 06
Mode into A

ADD A, B Immediate Arithmetic Add A and Parity Flag


Addressing Instruction B Operands
Mode 06 + 26 =
2C

JNC L4 Branch Jump No


Instruction Carry

INC R0 Immediate Arithmetic Increment


Addressing Instruction of Register
Mode

L4 END

Output:
Registers containing the Result:
r0 = 01 sp = 0x07
A = 2C
B = 26

SENSE, Page 5 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Manual Calculation:

Results and Observations

Program and registers before execution:

Program and registers after execution:

SENSE, Page 6 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Inferences:
1. If there is a carry between D3 and D4 registers then Auxilary carry Flag is 1 [AC=1].
2. If there is a carry beyond D7 register then Carry Flag is 1 [CY = 1].
3. If there are odd no’s of 1 in register then Parity Flag is 1.
Result:
The 8051 ALP to perform addition of given data of 5 8BIT NUMBERS is executed using Keil
software and the results are verified manually.

EXPERIMENT 2:
Write and assemble a program to load values into each of registers R0 - R4 and then push each of
these registers onto the stack. Single-step the program, and examine the stack and the SP register
after the execution of each instruction.

Aim:
To write an 8051 ALP to perform register to stack pointer using Keil software and to verify the
result manually.
Tools Required
Keil version5 Software.
Algorithm:

SENSE, Page 7 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

1. Set the origin address of the program to 0000H.


2. Load the immediate value 25H into register R0.
3. Load the immediate value 35H into register R1.
4. Load the immediate value 45H into register R2.
5. Load the immediate value 55H into register R3.
6. Load the immediate value 65H into register R4.
7. Push the immediate value 0 onto the stack.
8. Push the immediate value 1 onto the stack.
9. Push the immediate value 2 onto the stack.
10. Push the immediate value 3 onto the stack.
11. Push the immediate value 4 onto the stack.
12. End the program.
Program:

Label Mnemonics Operands Addressing Type of Comments Stack


Mode used Instruction pointer
and
Registers
getting
affected by
the
Instruction

ORG 000H

MOV R0, #025H Immediate Data R0 = 25H sp = 0x07


addressing Transfer r0 = 25
mode Instruction

MOV R1, #035H Immediate Data R1= 35H sp = 0x07


addressing Transfer r0 = 25
mode Instruction r1 = 35

MOV R2, #045H Immediate Data R2 = 45H sp = 0x07


addressing Transfer r0 = 25
mode Instruction

SENSE, Page 8 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

r1 = 35
r2 = 45

MOV R3, #055H Immediate Data R3 = 55H sp = 0x07


addressing Transfer r0 = 25
mode Instruction r1 = 35
r2 = 45
r3 = 55

MOV R4, #065H Immediate Data R4 = 65H sp = 0x07


addressing Transfer r0 = 25
mode Instruction r1 = 35
r2 = 45
r3 = 55
r4 = 65
sp = 0x08
PUSH 0 Register Data PUSH from
addressing Transfer R0 onto Value in
Mode Instruction STACK Registers
remains
same
sp = 0x09
PUSH 1 Register Data PUSH from
addressing Transfer R1 onto Value in
Mode Instruction STACK Registers
remains
same
sp = 0x0a
PUSH 2 Register Data PUSH from
addressing Transfer R2 onto Value in
Mode Instruction STACK Registers
remains
same
sp = 0x0b
PUSH 3 Register Data PUSH from
addressing Transfer R3 onto Value in
Mode Instruction STACK Registers
remains
same
sp = 0x0c
PUSH 4 Register Data PUSH from
addressing Transfer R4 onto Value in
Registers

SENSE, Page 9 of
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Mode Instruction STACK remains


same

END

Output :
Registers containing the Result:
r0 = 25 sp = 0x0c
r1 = 35
r2 = 45
r3 = 55
r4 = 65
Manual Calculation:

Results and Observations

Program and registers before execution:

SENSE, Page 10
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Program and registers after execution:

Inferences:
1. The PUSH instruction is commonly used in microcontrollers to push data onto the stack.
2. The stack is a region of memory used to store data temporarily during program execution, typically to
save the context of a subroutine or function.
3. The Stack Pointer (SP) is decremented to point to the next available memory location on the stack.

SENSE, Page 11
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Result:
The 8051 ALP to perform register to stack pointer using Keil software the results are verified manually.

EXPERIMENT 3:
Write an 8051 assemble language program to:
(a) Set SP = 0D,
(b) Load a different value in each of RAM locations 0D, 0C, 0B, 0A, 09, and 08,
(c) POP each stack location into registers R0 - R4. Use the simulator to single-step and
examine the registers, the stack, and the stack pointer.

Aim:
To write an 8051 ALP to load a different value in each of RAM locations and POP each stack
location into registers R0 - R4 using Keil software and to verify the result manually.
Tools Required
Keil version5 Software.
Algorithm:
1. Set the origin address of the program to 0000H.
2. Move the immediate value 0DH (13 in decimal) into the Stack Pointer (SP) register, potentially
setting up the stack's initial position.
3. Move the immediate value 10H (16 in decimal) into memory address 08H.
4. Move the immediate value 11H (17 in decimal) into memory address 09H.
5. Move the immediate value 12H (18 in decimal) into memory address 0AH.
6. Move the immediate value 13H (19 in decimal) into memory address 0BH.
7. Move the immediate value 14H (20 in decimal) into memory address 0CH.
8. Move the immediate value 15H (21 in decimal) into memory address 0DH.
9. Pop the top value from the stack into register 0.
10. Pop the next value from the stack into register 1.
11. Pop the following value from the stack into register 2.
12. Pop the subsequent value from the stack into register 3.
13. Pop the succeeding value from the stack into register 4.
14. Pop the last value from the stack into register 5.
15. End the program.

SENSE, Page 12
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Program:

Label Mnemonics Operands Addressing Type of Comments Stack


Mode used Instruction Pointer and
Registers
getting
affected by
the
Instruction

ORG 000H
sp = 0x0d
MOV SP, #0DH Immediate Data Transfer SP = 0DH
addressing Instruction Registers are
mode 0

sp = 0x0d
MOV 08H, #10H Immediate Data Transfer 08H<-10H
addressing Instruction Registers are
mode 0

sp = 0x0d
MOV 09H, #11H Immediate Data Transfer 09H<-11H
addressing Instruction Registers are
mode 0
sp = 0x0d
MOV 0AH, #12H Immediate Data Transfer 0AH<-12H
addressing Instruction Registers are
mode 0

sp = 0x0d
MOV 0BH, #13H Immediate Data Transfer 0BH<-13H
addressing Instruction Registers are
mode 0
sp = 0x0d
MOV 0CH, #14H Immediate Data Transfer 0CH<-14H
addressing Instruction Registers are
mode 0
sp = 0x0d
MOV 0DH, #15H Immediate Data Transfer 0DH<-15H
addressing Instruction Registers are
mode 0

POP 0 Register Data Transfer POP from sp = 0x0c


addressing Instruction stack into r0 = 15
Mode mode R0

SENSE, Page 13
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

POP 1 Register Data Transfer POP from sp = 0x0b


addressing Instruction stack into r0 = 15
Mode R1 r1 = 14

POP 2 Register Data Transfer POP from sp = 0x0a


addressing Instruction stack into r0 = 15
Mode R2 r1 = 14
r2 = 13

POP 3 Register Data Transfer POP from sp = 0x09


addressing Instruction stack into r0 = 15
Mode R3 r1 = 14
r2 = 13
r3 = 12

POP 4 Register Data Transfer POP from sp = 0x08


addressing Instruction stack into r0 = 15
Mode R4 r1 = 14
r2 = 13
r3 = 12
r4 = 11

POP 5 Register Data Transfer POP from sp = 0x07


addressing Instruction stack into r0 = 15
Mode R5 r1 = 14
r2 = 13
r3 = 12
r4 = 11
r5 = 10

END

Output:
Registers containing the Result:
r0 = 15 sp = 0x07
r1 = 14
r2 = 13
r3 = 12
SENSE, Page 14
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

r4 = 11
r5 = 10

Manual Calculation:

Results and Observations


Program and registers before execution: Use snip tool

SENSE, Page 15
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Program and registers after execution: Use snip tool

Inferences:
1. The "POP" instruction is used to retrieve data from the top of the stack.
2. The POP instruction operates by first moving the data at the current stack pointer location to the
destination register or memory location and then incrementing the stack pointer to point to the next
available location.
Result:
The 8051 ALP to load a different value in each of RAM locations and POP each stack location
into registers R0 - R4 using keil software and the results are verified manually

EXPERIMENT 4:
Write and assemble a program to load values into each of registers R0 - R4 and then push each of
these registers onto the stack and pop them back. Single-step the program, and examine the stack
and the SP register after the execution of each instruction.
Aim:
To write an 8051 ALP load values into each of registers R0 - R4 and then push each of these
registers onto the stack and pop them back using keil software and to verify the result manually.
Tools Required
Keil version5 Software.

SENSE, Page 16
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Algorithm:
1. Set the origin address of the program to 0000H.
2. Load the immediate value 25H into register R0.
3. Load the immediate value 35H into register R1.
4. Load the immediate value 45H into register R2.
5. Load the immediate value 55H into register R3.
6. Load the immediate value 65H into register R4.
7. Push the value in register 0 onto the stack.
8. Push the value in register 1 onto the stack.
9. Push the value in register 2 onto the stack.
10. Push the value in register 3 onto the stack.
11. Push the value in register 4 onto the stack.
12. Pop the value from the top of the stack into register 0.
13. Pop the value from the top of the stack into register 1.
14. Pop the value from the top of the stack into register 2.
15. Pop the value from the top of the stack into register 3.
16. Pop the value from the top of the stack into register 4.
17. End the program.
Program:

Label Mnemonics Operands Addressing Type of Comments Stack


Mode used Instruction Pointer
getting
affected by
the
Instruction

ORG 000H

MOV R0, #25H Immediate Data R0<-25H sp = 0x07


addressing Transfer
mode Instruction

MOV R1, #35H Immediate Data R1<-35H sp = 0x07


addressing Transfer

SENSE, Page 17
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

mode Instruction

MOV R2,#45H Immediate Data R2<-45H sp = 0x07


addressing Transfer
mode Instruction

MOV R3, #55H Immediate Data R3<-55H sp = 0x07


addressing Transfer
mode Instruction

MOV R4,#65H Immediate Data R4<-65H sp = 0x07


addressing Transfer
mode Instruction

PUSH 0 Register Data PUSH from sp = 0x08


addressing Transfer R0 onto
Mode Instruction STACK

PUSH 1 Register Data PUSH from sp = 0x09


addressing Transfer R1onto
Mode Instruction STACK

PUSH 2 Register Data PUSH from sp = 0x0a


addressing Transfer R2 onto
Mode Instruction STACK

PUSH 3 Register Data PUSH from sp = 0x0b


addressing Transfer R3 onto
Mode Instruction STACK

PUSH 4 Register Data PUSH from sp = 0x0c


addressing Transfer R4 onto
Mode Instruction STACK

POP 0 Register Data POP from sp = 0x0b


addressing Transfer stack into
Mode Instruction R0

POP 1 Register Data POP from sp = 0x0a


addressing Transfer stack into
Mode mode Instruction R1

SENSE, Page 18
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

POP 2 Register Data POP from sp = 0x09


addressing Transfer stack into
Mode Instruction R2

POP 3 Register Data POP from sp = 0x08


addressing Transfer stack into
Mode Instruction R3

POP 4 Register Data POP from sp = 0x07


addressing Transfer stack into
Mode Instruction R4

END

Output:
Registers containing the Result:
R0 = 65H sp = 0x07
R1 = 55H
R2 = 45H
R3 = 35H
R4 = 25H
Manual Calculation:

Results and Observations

SENSE, Page 19
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Program and registers before execution:

Program and registers after execution:

SENSE, Page 20
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Inferences:
1. This program serves as an example of stack manipulation in assembly programming.

SENSE, Page 21
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

2. The PUSH instruction pushes the value of register onto the stack, and the POP instructions pops the
values from the stack back into registers.
3. The stack pointer is decremented to allocate space for the new data that will be pushed onto the
stack, this effectively moves the stack pointer downward in memory during push operation.
4. The data at the memory location pointed by the stack pointer is retrieved and loaded into a register
or memory location, the stack pointer is incremented to release the memory space that was previously
occupied by the data.

Result:
The 8051 ALP load values into each of registers R0 - R4 and then push each of these registers
onto the stack and pop them back using keil software and the results are verified manually

EXPERIMENT 5:
Write a program to add 10 bytes of BCD data and store the result in R2 and R3.
The bytes are stored in ROM space starting at 300H.

The data would look as follows:


MYDATA: DB; pick your data. (10 DATA)

EX: 22H,43H,23H,34H,31H,77H,91H,33H,43H,07H

Notice that you must first bring the data from ROM space into the CPU's RAM,
then add them together. Use a simulator to single-step the program and examine the data.

Aim:
To write an 8051 ALP to perform to add 10 bytes of BCD data and store the result in R2 and
R3. The bytes are stored in ROM space starting at 300H. using keil software and to verify the result
manually.

Tools required:
Keil version 5 software.

Algorithm:
1. Set the origin address of the program to 000H.
2. Load the data pointer (DPTR) with the memory address 300H.
3. Load the immediate value 10H into register R0.
4. Start a loop labelled "LOOP".
- Clear the accumulator (A) register.
- Move a byte of data from the address pointed to by (A + DPTR) to the accumulator using
the MOVC instruction.
SENSE, Page 22
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

- Add the value in register R2 to the accumulator.


- Decimal adjusts the accumulator after addition.
- If no carry occurred during addition, jump to the label "NEXT".
- Increment R3.
- Jump back to the beginning of the loop ("LOOP").
5. Label "NEXT":
- Increment the data pointer (DPTR).
- Move the value in the accumulator (A) to register R2.
- Decrement the value in register R0 (DJNZ) and jump back to "LOOP" if R0 is not zero.
6. Label "HERE":
- Loop indefinitely by jumping back to the same label.
7. Set the origin address to 300H.
8. Define a data block (DB) with 10 bytes of data.
9. End of the program.

Program:

Label Mnemon Operan addressin Type of Comments Flags


ics ds g mode Instructio getting
used n affected by
the
Instruction
.

ORG 000H

MOV DPTR, Immediate Data DPTR<- DPTR=300


#300H addressing Transfer 300H H
mode Instruction

MOV R0, Immediate Data R0<-10H R0=10H


#10H addressing Transfer
mode Instruction

SENSE, Page 23
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

LOOP CLR A Logical A<-00H


Instruction

MOVC A, Index Data A<-


@A+DP memory Transfer @A+DPT
A=22H
TR addressing Instruction R
mode

ADD A, R2 Register Arithmetic A<-R2+A


addressing Instruction
mode

DA A Arithmetic
Instruction

JNC NEXT Boolean


Instruction

INC R3 Register Arithmetic No


addressing Instruction increment
mode of R3

NEXT INC DPTR Register Arithmetic DPTR=30


addressing Instruction 1
mode

MOV R2, A Immediate Data R2<-A


addressing Transfer
mode Instruction

DJNZ R0, Branching Decrement


LOOP Instruction R0 and
jump to
LOOP if
not zero

HERE SJMP HERE Branching Unconditio


Instruction nal jump
back to
label

SENSE, Page 24
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

HERE

ORG 300H
22H,
DB
43H,
23H,
34H,
31H,
77H,
91H,
33H,
43H,
07H

END

Output: R2= 04
R3= 04
A= 04
Sp= 07
Dptr= 0x0310

Manual Calculation:

SENSE, Page 25
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Results and Observations

Program and registers before execution:

SENSE, Page 26
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Program and registers after execution:

SENSE, Page 27
2
Reg no: 23MEA0006 Fall 2023-24 MAME502L Microcontrollers
for
Vehicular Systems

Inferences:
1. BCD is a way of representing decimal digits in binary form, where each decimal digit is
encoded using four binary bits.
2. To get result in BCD addition, we use DA A instruction, if lower nibble is greater than 9 or
AC=1 then add #06H(0110) to the lower nibble.
3. If higher nibble is greater than 9 or CY=1 then add #06H(0110) to the lower nibble.
Result:

The 8051 ALP to perform to add 10 bytes of BCD data and store the result in R2 and R3. The bytes
are stored in ROM space starting at 300H. is executed using keil software and the results are verified
manually.

SENSE, Page 28
2

You might also like