Mode Pengalamatan ATMEL AT89S51/AT89S52

Mode Pengalamatan Microcontroller AT89S51/AT89S52

All the family members of ATMEL Microcontroller 89S51/52 have the same instruction set. This instruction set has been optimized for 8-bit control applications, and provide a variety of fast addressing modes for accessing the internal RAM and external RAM

Addressing mode 89S51/52 ATMEL Microcontroller family is as follows

Immediate Addressing

Immediate addressing is so-named because the value to be stored in memory immediately follows the operation code in memory. That is to say, the instruction itself dictates what value will be stored in memory.
Example:
  • MOV A, # 1AH ; Fill in the accumulator with data 1AH
  • MOV DPTR, # 10H ; Fill in the register DPTR with data 10H
  • MOV R1, #30H ; Fill in the register R1 with data 30H

Direct Addressing

Direct addressing is so-named because the value to be stored in memory is obtained by directly retrieving it from another memory location.
Example:
  • MOV A,15H ; Read the data Internal RAM address 15 H and store it in the Accumulator.
  • MOV 90H, A, Read the data Accumulator and store it in the SFR/Port (whose address 90H)

Indirect Addressing

In Indirect Addressing, Operands pointing to a register that contains the memory address location to be used in the operation. To implement the indirect addressing used symbol @. Addressing this type usually used for writing, transfer or reading some data in memory locations. AT89C51 has a 16-bit register (DPTR) which can be used to perform indirect addressing

Example:
  • ADD, A, R1 ; Add data internal RAM which is found at the address indicated by R1 into the data accumulator
  • DEC @ R1 ; Reduce the contents of RAM address indicated by the register R1
  • MOVX, ADPTR, A ; read data Accumulator and store it in the external memory location indicated by DPTR

Bit Addressing

Bit addressing is the appointment of bit locations address both the internal RAM or hardware using the symbol dot (.).
Example:
  • SETB p1.7; Set port 1.7 bits active
  • SETB TR1: Set TR1 (Timer 1 active)

Operator

Operators used to perform action arithmetic, logic shifting bits and others at the Operands. Some operators are available including
Arithmetic operators
  • * For multiplication
  • / For division
  • + For addition
  • - For subtraction
Example: MOV A, # 25H +3 H

Operator Logic
  • Poerasi OR to OR
  • AND to AND operation
  • XOR to XOR operations
  • EXOR for EXOR operation
  • NOT to invert operation
Example: MOV A, # 20H OR 40H; equal to MOV A, # 60H

Special Operations
  • Shr 16 ; bit shift to right
  • SHL 16 ; bit shift to the left
  • HIGH ; bits select the bag
  • LOW ; select the lower bit
  • EQ = equal to
  • NET <> ; is not equal to
  • Fl <= ; less than or equal to · GT> more
  • GE> = ; greater than or equal to
0 Komentar untuk "Mode Pengalamatan ATMEL AT89S51/AT89S52"

Back To Top