Download pptx - Multi byte addition

Transcript
Page 1: Multi byte addition

Multi byte addition

Start

Load Accumulator with 0E7h

Add 08Dh to the contents of Accumulator

Move the result to R6 register

Load Accumulator with 03Ch

Add 03Bh to the contents of A with carry

Copy the higher byte result to R7 register

END

Page 2: Multi byte addition

Multi byte Subtraction

Start

Load Accumulator with 043h

Load R0 with 051h

Subtract R0 from A

Copy the lower byte result to R6 register

Load Accumulator with 017h

Copy the higher byte result to R7 register

END

Clear Carry flag

Load R1 with 012h

Subtract R1 from A

Page 3: Multi byte addition

2’s Compliment

Start

Load Accumulator with 085h

Compliment the contents of Accumulator

Add 1 to the Acc to get 2’s Compliment

Copy the result to R0 register

END

Page 4: Multi byte addition

Largest Number Start

Clear Accumulator

Load R1 with no of values

Decrement R1

Load DPTR with the address of values

Copy first number to Accumulator

Copy the first number to R0 register

END

Clear Accumulator

Increment DPTR to point next location

Copy the next number to Accumulator

Compare the contents of Accumulator with R0 register

Is Acc > R0 ?

Yes

No

Copy the Acc Contents to R0 register

Decrement R1

Is R1 = 0?

Yes

No

Page 5: Multi byte addition

Smallest number Start

Clear Accumulator

Load R1 with no of values

Decrement R1

Load DPTR with the address of values

Copy first number to Accumulator

Copy the first number to R0 register

END

Clear Accumulator

Increment DPTR to point next location

Copy the next number to Accumulator

Compare the contents of Accumulator with R0 register

Is Acc < R0 ?

Yes

No

Copy the Acc Contents to R0 register

Decrement R1

Is R1 = 0?

Yes

No

Page 6: Multi byte addition

Ascending orderStart

Load R1 with the destination Address

Load R3 with number of values

Load R4 with number of values

Decrement R4

Load R0 with the address of the values

Copy first number to Accumulator

END

Copy first number to R6 register

Increment R0 to point next location

Copy the next number to Accumulator

Compare the contents of Accumulator with R6 register

Is Acc <R6 ?

Yes

No

Copy the Acc Contents to R6 register

Decrement R4

Is R4 = 0?

YesNo

Copy the contents of R6 reg to Acc

Copy the first smallest number to destination address at R1

Copy the contents of R6 reg to Acc

Increment R1

Call Subroutine program

Decrement R3

Is R3 = 0?

Yes

No

Page 7: Multi byte addition

Ascending order Subroutine

Start

Load R5 with number of values

Load R0 with address of values

Copy first number to Accumulator

Compare Contents of R6 register with Acc

Return to main program

Increment R0

END

Is Acc =R6 ?

Yes

No

Load 0FFh at the address specified by R0

Decrement R5

Is R5 = 0 ?

Yes

No

Page 8: Multi byte addition

Start

Load R1 with the destination Address

Load R3 with number of values

Load R4 with number of values

Decrement R4

Load R0 with the address of the values

Copy first number to Accumulator

END

Copy first number to R6 register

Increment R0 to point next location

Copy the next number to Accumulator

Compare the contents of Accumulator with R6 register

Is Acc > R6 ?

Yes

No

Copy the Acc Contents to R6 register

Decrement R4

Is R4 = 0?

YesNo

Copy the contents of R6 reg to Acc

Copy the first smallest number to destination address at R1

Copy the contents of R6 reg to Acc

Increment R1

Call Subroutine program

Decrement R3

Is R3 = 0?

Yes

No

Descending order

Page 9: Multi byte addition

Descending order Subroutine

Start

Load R5 with number of values

Load R0 with address of values

Copy first number to Accumulator

Compare Contents of R6 register with Acc

Return to main program

Increment R0

END

Is Acc =R6 ?

Yes

No

Load 00h at the address specified by R0

Decrement R5

Is R5 = 0 ?

Yes

No

Page 10: Multi byte addition

Multiplication of two numbers

Start

Load Accumulator with 08h( multiplicand )

Load B register with 03h( multiplier )

Multiply A and B

Copy lower byte(Acc) result to 50h

Copy higher byte(B reg) result to 51h

END

Page 11: Multi byte addition

Division of Two numbers

Start

Load Accumulator with 0ah(dividend)

Load B register with 03h(divisor)

Divide A by B

Copy quotient(Acc) to 50h

Copy remainder(B reg) to 51h

END

Page 12: Multi byte addition

Multiplication of two number using counter method

Start

Clear Accumulator

Load R0 with 03h( multiplicand )

Load R1 with 04h( multiplier)

Add contents of R1 reg to Accumulator

Store product in 50h address

END

Is R0 = 0 ?

Yes

No

Decrement R0

Page 13: Multi byte addition

division of two number using counter method

Start

Clear Carry flag

Load Accumulator with 40h

Load R0 register with 10h

Clear R0 register

Increment R1

END

Is Acc = 0 ?

Yes

NoSubtract R0 from Accumulator

Is carry set?

Yes

No

No

Page 14: Multi byte addition

Stepper motor clock wise

Decrement R0 reg

Load R0 reg with F1h

Yes

No

Start

Load R1 reg with 0Fh

Decrement R1 reg

Is R1 = 0 ?

Return to main program

Yes

No

Is R0 = 0?

Start

Initialize 8255

Load Accumulator with initial pulse word

Load DPTR with the port address of 8255

Send the pulse word to the port

Call Delay Subroutine

Rotate the pulse word towards Right

Page 15: Multi byte addition

Stepper motor anti-clock wise

Decrement R0 reg

Load R0 reg with F1h

Yes

No

Start

Load R1 reg with 0Fh

Decrement R1 reg

Is R1 = 0 ?

Return to main program

Yes

No

Is R0 = 0?

Start

Initialize 8255

Load Accumulator with initial pulse word

Load DPTR with the port address of 8255

Send the pulse word to the port

Call Delay Subroutine

Rotate the pulse word towards left

Page 16: Multi byte addition

Triangular wave

Start

Initialize 8255

Load the Acc with 0FFh digital data

Load the DPTR with the address of DAC

Send the digital signal data to DAC

Decrement Accumulator

Is Acc = 0?

Yes

No

Increment Accumulator

Is A = 0FFh ?

Yes

No

Load the DPTR with the address of DAC

Send the digital signal data to DAC

Page 17: Multi byte addition

Saw-tooth wave

Start

Initialize 8255

Load the Acc with 0FFh digital data

Load the DPTR with the address of DAC

Send the digital signal data to DAC

Decrement Accumulator

Is Acc = 0?

Yes

No

Page 18: Multi byte addition

Square wave

Start

Initialize 8255

Load the Acc with 00h digital data

Load the DPTR with the address of DAC

Send the digital signal data to DAC

Call Delay Subroutine

Compliment Accumulator contents

Decrement R0 reg

Load R0 reg with 0FFh

Yes

No

Start

Load R1 reg with 0Fh

Decrement R1 reg

Is R1 = 0 ?

Return to main program

Yes

No

Is R0 = 0?

Page 19: Multi byte addition

Largest number

Start

Clear Accumulator

Load R1 with no of values

Decrement R1

Load R0 with the address of values

Increment R0 to point next location

Copy the next number to Accumulator

END

Compare the contents of Accumulator with 50h address

Is Acc > 50h ?

Yes

No

Copy the Acc Contents to 50h address

Decrement R1

Is R1 = 0?

Yes

No

Copy contents of 50h address to accumulator

Page 20: Multi byte addition

Smallest number

Start

Clear Accumulator

Load R1 with no of values

Decrement R1

Load R0 with the address of values

Increment R0 to point next location

Copy the next number to Accumulator

END

Compare the contents of Accumulator with 50h address

Is Acc < 50h ?

Yes

No

Copy the Acc Contents to 50h address

Decrement R1

Is R1 = 0?

Yes

No

Copy contents of 50h address to accumulator

Page 21: Multi byte addition

Stepper motor

PPI 8

255

Oct

al B

uffer

(inve

rting

)

High

Spe

ed

Switc

hing

tr

ansis

tor

HEX

Buffe

r

Vcc

PC0

- PC7 PC

0 - P

C7

LEDs

to In

dica

te

the

phas

e of

mot

or

Step

per m

otor

8051

Page 22: Multi byte addition

DAC

PPI 8

255

Oct

al B

uffer

(inve

rting

)

High

Spe

ed

Switc

hing

tr

ansis

tor

8051

Oct

al B

uffer

(inve

rting

)

Volta

ge

I/P

Volta

ge

O/P

Vref

PA0-

PA7

O/P

0 to

10V

or

-5V

to +

5V


Recommended