Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

8051 micro controller assembly language program?

ORG OOOOH

MOV RO,36d

MOV A,RO

MOV B,#5H

DIV AB

MOV R1,B

MOV B,#09H

MUL AB

MOV R2,A

MOV DPH,B

MOV A,R1

MOV B,#10H

MUL AB

MOV B,#05H

DIV AB

MOV A,#09H

MUL AB

MOV B,#10H

DIV AB

MOV B,R2

ADD A,B

MOV B,#20 H

ADD A,B

MOV A,DPL

NOP

END

I hace this above machine language program for degree to farenheit conversion...it works fine but i am unable to understand some portion of the code...please help me explain this code...i need to get the meaning of the code from the instruction MOV DPH,B onwards....please tell me why the values 10H and 20H are used in the further code....people having good knowledge with 8051 are welcome....others please do not waste your and my time!!!

2 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    MOV B,#10H

    MUL AB

    MOV B,#05H

    DIV AB

    MOV A,#09H

    MUL AB

    MOV B,#10H

    DIV AB

    is actually "multiply by 1.8".

    Times 10 divide by 5 (equals 2) times 9 (equals 18) divide by 10 (equals 1.8)

    Not that mysterious, is it? :)

  • Anonymous
    5 years ago

    That's just what the designers chose.  They didn't have enough room in the 1-byte instructions (or maybe in the instruction decoder hardware) to make MOV B immediate a 1-byte opcode, so it wound up in the 2-byte opcodes.  They probably did this so other instructions could be shorter and run faster, or require fewer gates to implement.

Still have questions? Get your answers by asking now.