Multi byte addition

  • View
    30

  • Download
    0

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Text of Multi byte addition

Multi byte addition

Multi byte additionStartLoad Accumulator with 0E7hAdd 08Dh to the contents of AccumulatorMove the result to R6 registerLoad Accumulator with 03ChAdd 03Bh to the contents of A with carryCopy the higher byte result to R7 registerEND1Multi byte SubtractionStartLoad Accumulator with 043hLoad R0 with 051hSubtract R0 from ACopy the lower byte result to R6 registerLoad Accumulator with 017hCopy the higher byte result to R7 registerENDClear Carry flagLoad R1 with 012hSubtract R1 from A22s ComplimentStartLoad Accumulator with 085hCompliment the contents of AccumulatorAdd 1 to the Acc to get 2s ComplimentCopy the result to R0 registerEND3Largest NumberStartClear AccumulatorLoad R1 with no of valuesDecrement R1Load DPTR with the address of valuesCopy first number to AccumulatorCopy the first number to R0 registerENDClear AccumulatorIncrement DPTR to point next locationCopy the next number to AccumulatorCompare the contents of Accumulator with R0 registerIs Acc > R0 ?YesNoCopy the Acc Contents to R0 registerDecrement R1Is R1 = 0?YesNo4Smallest numberStartClear AccumulatorLoad R1 with no of valuesDecrement R1Load DPTR with the address of valuesCopy first number to AccumulatorCopy the first number to R0 registerENDClear AccumulatorIncrement DPTR to point next locationCopy the next number to AccumulatorCompare the contents of Accumulator with R0 registerIs Acc < R0 ?YesNoCopy the Acc Contents to R0 registerDecrement R1Is R1 = 0?YesNo5Ascending orderStartLoad R1 with the destination Address Load R3 with number of valuesLoad R4 with number of valuesDecrement R4Load R0 with the address of the valuesCopy first number to AccumulatorENDCopy first number to R6 registerIncrement R0 to point next locationCopy the next number to AccumulatorCompare the contents of Accumulator with R6 registerIs Acc R6 ?YesNoCopy the Acc Contents to R6 registerDecrement R4Is R4 = 0?YesNoCopy the contents of R6 reg to AccCopy the first smallest number to destination address at R1Copy the contents of R6 reg to AccIncrement R1Call Subroutine programDecrement R3Is R3 = 0?YesNoDescending order8Descending order SubroutineStartLoad R5 with number of valuesLoad R0 with address of valuesCopy first number to AccumulatorCompare Contents of R6 register with AccReturn to main programIncrement R0ENDIs Acc =R6 ?YesNoLoad 00h at the address specified by R0Decrement R5Is R5 = 0 ?YesNo9Multiplication of two numbersStartLoad Accumulator with 08h( multiplicand )Load B register with 03h( multiplier )Multiply A and BCopy lower byte(Acc) result to 50hCopy higher byte(B reg) result to 51hEND10Division of Two numbersStartLoad Accumulator with 0ah(dividend)Load B register with 03h(divisor)Divide A by BCopy quotient(Acc) to 50hCopy remainder(B reg) to 51hEND11Multiplication of two number using counter methodStartClear AccumulatorLoad R0 with 03h( multiplicand )Load R1 with 04h( multiplier)Add contents of R1 reg to AccumulatorStore product in 50h addressENDIs R0 = 0 ?YesNoDecrement R012division of two number using counter methodStartClear Carry flag Load Accumulator with 40hLoad R0 register with 10hClear R0 registerIncrement R1ENDIs Acc = 0 ?YesNoSubtract R0 from AccumulatorIs carry set?YesNoNo13Stepper motor clock wiseDecrement R0 regLoad R0 reg with F1hYesNoStart Load R1 reg with 0FhDecrement R1 regIs R1 = 0 ?Return to main programYesNoIs R0 = 0?StartInitialize 8255Load Accumulator with initial pulse wordLoad DPTR with the port address of 8255Send the pulse word to the portCall Delay SubroutineRotate the pulse word towards Right14Stepper motor anti-clock wiseDecrement R0 regLoad R0 reg with F1hYesNoStart Load R1 reg with 0FhDecrement R1 regIs R1 = 0 ?Return to main programYesNoIs R0 = 0?StartInitialize 8255Load Accumulator with initial pulse wordLoad DPTR with the port address of 8255Send the pulse word to the portCall Delay SubroutineRotate the pulse word towards left15Triangular waveStartInitialize 8255Load the Acc with 0FFh digital dataLoad the DPTR with the address of DAC Send the digital signal data to DACDecrement AccumulatorIs Acc = 0?YesNoIncrement AccumulatorIs A = 0FFh ?YesNoLoad the DPTR with the address of DAC Send the digital signal data to DAC16Saw-tooth waveStartInitialize 8255Load the Acc with 0FFh digital dataLoad the DPTR with the address of DAC Send the digital signal data to DACDecrement AccumulatorIs Acc = 0?YesNo17Square waveStartInitialize 8255Load the Acc with 00h digital dataLoad the DPTR with the address of DAC Send the digital signal data to DACCall Delay SubroutineCompliment Accumulator contentsDecrement R0 regLoad R0 reg with 0FFhYesNoStart Load R1 reg with 0FhDecrement R1 regIs R1 = 0 ?Return to main programYesNoIs R0 = 0?18Largest numberStartClear AccumulatorLoad R1 with no of valuesDecrement R1Load R0 with the address of valuesIncrement R0 to point next location Copy the next number to AccumulatorENDCompare the contents of Accumulator with 50h addressIs Acc > 50h ?YesNoCopy the Acc Contents to 50h addressDecrement R1Is R1 = 0?YesNoCopy contents of 50h address to accumulator19Smallest numberStartClear AccumulatorLoad R1 with no of valuesDecrement R1Load R0 with the address of valuesIncrement R0 to point next location Copy the next number to AccumulatorENDCompare the contents of Accumulator with 50h addressIs Acc < 50h ?YesNoCopy the Acc Contents to 50h addressDecrement R1Is R1 = 0?YesNoCopy contents of 50h address to accumulator20Stepper motorPPI 8255Octal Buffer(inverting)High Speed Switching transistorHEX Buffer

VccPC0 - PC7PC0 - PC7LEDs to Indicate the phase of motorStepper motor805121DACPPI 8255Octal Buffer(inverting)High Speed Switching transistor8051Octal Buffer(inverting)Voltage I/PVoltage O/PVrefPA0-PA7O/P 0 to 10V or -5V to +5V22