8051 Program to Rotate DPTR value

8051 Program to Rotate DPTR Value. 
ALGORITHM:
  1. Start.
  2. Load the value to be rotated in DPTR.
  3. Move the Lower nibble of DPTR in Accumulator.
  4. Rotate Left 8 bits along with carry.
  5. Move the Upper nibble of DPTR in Accumulator.
  6. Rotate Left 8 bits along with carry.
  7. Now we got the Upper nibble of DPTR move it to DPH.
  8. Move the Lower nibble of DPTR in Accumulator.
  9. Rotate Left 8 bits along with carry.
  10. Now we got the Lower nibble of DPTR move it to DPL.
  11. The output is stored in the DPTR.
  12. End.

For example if we are trying to rotate the number as below.

After rotating the DPTR the value will be:

! Information
To get details about instructions used visit Keil Website.

CODE:

Output Images:

Rotate DPTR Output Image

Download Code:

If you are facing problem reading the code.Download this code.
Click on the link below to Download

 

8051 Rotate DPTR File

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Advertisment ad adsense adlogger