Wednesday, 29 August 2018

8051 Assembly Language Programming

Assembly and  Running 8051 Micro-Controller


  • Editor- It is a source file where the programmer writes 8051 assembly language program.
    • This file is saved as "filename.asm" (asm = assembly)
  • Assembler - It converts assembly language into machine language 
    • It generates two files-
      • "filename.lst" -list file which contains sources of error and comments by programmers.(lst = list)
      • "filename.obj" - file containing machine language code. (obj = object)
  • Linker program - It relocates and links all the related files to create one absolute file
    • It create one file named "filename.abs" (abs = absolute) 
  • OH program - It converts the object code to hexadecimal code which can be burnt into target machine.
    • It generate file called "filename.hex" (hex = hexadecimal)

8051 Assembly Directives

They are the instruction directly gives to assembler
  • ORG - Origin, It denotes the starting address of the program
    • ORG 2000H
  • END - End, It denotes the end of program. 
    • END
  • EQU - Equal, associates a number with variable which can later be used in the program.
    • COUNT EQU 25
    • MOV R3 , #COUNT
Note - Without # it is a memory location. With # it is data.

Instructions

  • ACALL - Absolute Call
  • ADD, ADDC - Add Accumulator (With Carry)
  • AJMP - Absolute Jump
  • ANL - Bitwise AND
  • CJNE - Compare and Jump if Not Equal
  • CLR - Clear Registerr
  • CPL - Complement Register
  • DA - Decimal Adjust
  • DEC - Decrement Register
  • DIV - Divide Accumulator by B
  • DJNZ - Decrement Register and Jump if Not Zero
  • INC - Increment Register
  • JB - Jump if Bit Set
  • JBC - Jump if Bit Set and Clear Bit
  • JC - Jump if Carry Set
  • JMP - Jump to Address
  • JNB - Jump if Bit Not Set
  • JNC - Jump if Carry Not Set
  • JNZ - Jump if Accumulator Not Zero
  • JZ - Jump if Accumulator Zero
  • LCALL - Long Call
  • LJMP - Long Jump
  • MOV - Move Memory
  • MOVC - Move Code Memory
  • MOVX - Move Extended Memory
  • MUL - Multiply Accumulator by B
  • NOP - No Operation
  • ORL - Bitwise OR
  • POP - Pop Value From Stack
  • PUSH - Push Value Onto Stack
  • RET - Return From Subroutine
  • RETI - Return From Interrupt
  • RL - Rotate Accumulator Left
  • RLC - Rotate Accumulator Left Through Carry
  • RR - Rotate Accumulator Right
  • RRC - Rotate Accumulator Right Through Carry
  • SETB - Set Bit
  • SJMP - Short Jump
  • SUBB - Subtract From Accumulator With Borrow
  • SWAP - Swap Accumulator Nibbles
  • XCH - Exchange Bytes
  • XCHD - Exchange Digits
  • XRL - Bitwise Exclusive OR

No comments:

Post a Comment