1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

data transfer instruction in assembly language

Discussion in '8051/8951' started by Parth86, Nov 14, 2013.

  1. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    515
    Likes:
    5
    ONLINE
    I know the data transfer instruction is used to move data. data can be move between memory, register and accumulator
    different movement of data in assembly

    accumulator to register mov R0, A
    register to accumulator mov A, R0

    how to write instruction for memory ( which memory is used for this)
    memory to accumulator ?
    memory to register ?
     
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,185
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    • Like Like x 1
  3. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    515
    Likes:
    5
    ONLINE
    thanks its very useful can you tell me how to load the memory address i think when we use # then we can say we are loading the data and when we don't use # we can say we are loading the memory address
    mov R0, #55h data is loading
    mov R0, 55h address is loading
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK

    You can load directly..
    Code (asm):

    counter equ 0x30

    mov A, counter
    inc A
    mov counter, A
     
    Or indirectly using one of the registers
    Code (asm):

    counter equ 0x30

    mov R0,#counter

    mov A, @R0
    inc A
    mov @R0, A
     
    Oh yeah! the '#' means data without it will be location... In my example I load the value of counter into A
    In the second, I load the actual location number into R0.
     
    Last edited: Nov 14, 2013
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,185
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi,
    From your two 'MOV' instructions, I would say yes.
    This Link explains the MOV instructions in detail.
    http://www.8052.com/51mov
    E
     
  7. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    515
    Likes:
    5
    ONLINE
    ok it means
    MOV A,iram addr ( memory to accumulator)
    MOV A , 55h where 55h is iram address
     
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    If you have downloaded MPU51IDE... Just play with the commands to see them working for yourself...

    The simulator is brilliant!!
     

Share This Page