1 / 22

Multi byte addition

Start. Load Accumulator with 0E7h. Add 08Dh to the contents of Accumulator. Move the result to R6 register. Multi byte addition. Load Accumulator with 03Ch. Add 03Bh to the contents of A with carry. Copy the higher byte result to R7 register. END. Start. Clear Carry flag.

hani
Download Presentation

Multi byte addition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Start Load Accumulator with 0E7h Add 08Dh to the contents of Accumulator Move the result to R6 register Multi byte addition • Load Accumulator with 03Ch Add 03Bh to the contents of A with carry Copy the higher byte result to R7 register END

  2. Start Clear Carry flag Load Accumulator with 043h Load R0 with 051h Multi byte Subtraction Subtract R0 from A • Copy the lower byte result to R6 register Load Accumulator with 017h Load R1 with 012h Subtract R1 from A Copy the higher byte result to R7 register END

  3. Start Load Accumulator with 085h Compliment the contents of Accumulator Add 1 to the Acc to get 2’s Compliment 2’s Compliment Copy the result to R0 register END

  4. Start Clear Accumulator Load R1 with no of values Decrement R1 • Load DPTR with the address of values Largest Number Copy first number to Accumulator Copy the first number to R0 register 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 ? No Yes Copy the Acc Contents to R0 register Decrement R1 Is R1 = 0? No Yes END

  5. Start Clear Accumulator Load R1 with no of values Decrement R1 • Load DPTR with the address of values Smallest number Copy first number to Accumulator Copy the first number to R0 register 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 ? No Yes Copy the Acc Contents to R0 register Decrement R1 Is R1 = 0? No Yes END

  6. 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 Copy first number to R6 register Ascending order Increment R0 to point next location Copy the next number to Accumulator Compare the contents of Accumulator with R6 register Is Acc <R6 ? No Yes Copy the Acc Contents to R6 register Decrement R4 Is R4 = 0? No Yes 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 No Is R3 = 0? Yes END

  7. Start Load R5 with number of values Load R0 with address of values Copy first number to Accumulator Ascending order Subroutine • Compare Contents of R6 register with Acc Is Acc =R6 ? No Yes Load 0FFh at the address specified by R0 Return to main program Increment R0 Decrement R5 Is R5 = 0 ? No Yes END

  8. Start Descending order 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 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 ? No Yes Copy the Acc Contents to R6 register Decrement R4 Is R4 = 0? No Yes 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 No Is R3 = 0? Yes END

  9. 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 Is Acc =R6 ? No Yes Load 00h at the address specified by R0 Return to main program Increment R0 Decrement R5 Is R5 = 0 ? No Yes END

  10. Start Load Accumulator with 08h( multiplicand ) Load B register with 03h( multiplier ) Multiply A and B Multiplication of two numbers • Copy lower byte(Acc) result to 50h Copy higher byte(B reg) result to 51h END

  11. Start Load Accumulator with 0ah(dividend) Load B register with 03h(divisor) Divide A by B Division of Two numbers • Copy quotient(Acc) to 50h Copy remainder(B reg) to 51h END

  12. Start Clear Accumulator Load R0 with 03h( multiplicand ) Load R1 with 04h( multiplier) Multiplication of two number using counter method • Add contents of R1 reg to Accumulator Decrement R0 Is R0 = 0 ? No Yes Store product in 50h address END

  13. Start Clear Carry flag Load Accumulator with 40h Load R0 register with 10h division of two number using counter method Clear R0 register Subtract R0 from Accumulator No Increment R1 Is Acc = 0 ? No Yes No Is carry set? Yes END

  14. Start Initialize 8255 Load Accumulator with initial pulse word Load DPTR with the port address of 8255 Stepper motor clock wise • Send the pulse word to the port Call Delay Subroutine Rotate the pulse word towards Right Start Load R0 reg with F1h Load R1 reg with 0Fh Decrement R1 reg Is R1 = 0 ? No Yes Decrement R0 reg No Is R0 = 0? Yes Return to main program

  15. Start Initialize 8255 Load Accumulator with initial pulse word Load DPTR with the port address of 8255 Stepper motor anti-clock wise • Send the pulse word to the port Call Delay Subroutine Rotate the pulse word towards left Start Load R0 reg with F1h Load R1 reg with 0Fh Decrement R1 reg Is R1 = 0 ? No Yes Decrement R0 reg No Is R0 = 0? Yes Return to main program

  16. Start Initialize 8255 Load the Acc with 0FFh digital data Load the DPTR with the address of DAC Triangular wave • Send the digital signal data to DAC Decrement Accumulator Is Acc = 0? No Yes Increment Accumulator Load the DPTR with the address of DAC • Send the digital signal data to DAC Is A = 0FFh ? No Yes

  17. Start Initialize 8255 Load the Acc with 0FFh digital data Load the DPTR with the address of DAC Saw-tooth wave • Send the digital signal data to DAC Decrement Accumulator Is Acc = 0? No Yes

  18. Start Initialize 8255 Load the Acc with 00h digital data Load the DPTR with the address of DAC Square wave • Send the digital signal data to DAC Call Delay Subroutine Compliment Accumulator contents Start Load R0 reg with 0FFh Load R1 reg with 0Fh Decrement R1 reg Is R1 = 0 ? No Yes Decrement R0 reg No Is R0 = 0? Yes Return to main program

  19. Start Clear Accumulator • Load R0 with the address of values Load R1 with no of values Largest number Decrement R1 Increment R0 to point next location Copy the next number to Accumulator Compare the contents of Accumulator with 50h address Is Acc > 50h ? No Yes Copy the Acc Contents to 50h address Decrement R1 Is R1 = 0? No Yes Copy contents of 50h address to accumulator END

  20. Start Clear Accumulator • Load R0 with the address of values Load R1 with no of values Smallest number Decrement R1 Increment R0 to point next location Copy the next number to Accumulator Compare the contents of Accumulator with 50h address Is Acc < 50h ? No Yes Copy the Acc Contents to 50h address Decrement R1 Is R1 = 0? No Yes Copy contents of 50h address to accumulator END

  21. Stepper motor Stepper motor Vcc High Speed Switching transistor LEDs to Indicate the phase of motor HEX Buffer Octal Buffer (inverting) PC0 - PC7 PC0 - PC7 PPI 8255 8051

  22. DAC PA0-PA7 High Speed Switching transistor O/P 0 to 10V or -5V to +5V Octal Buffer (inverting) Voltage O/P Voltage I/P Vref PPI 8255 Octal Buffer (inverting) 8051

More Related