190 likes | 378 Views
Microcontroller Fundamentals & Programming. Data Movement Instructions. Data Movement Instructions. LOAD Instructions e.g. LDAA , LDAB , LDD , LDX , LDY STORE Instructions e.g. STAA , STAB , STD , STX , STY TRANSFER Instructions and e.g. TAB , TBA EXCHANGE Instructions
E N D
Microcontroller Fundamentals & Programming Data Movement Instructions
Data Movement Instructions • LOAD Instructions e.g. LDAA , LDAB , LDD , LDX , LDY • STORE Instructions e.g. STAA , STAB , STD , STX , STY • TRANSFER Instructions and e.g. TAB , TBA • EXCHANGE Instructions e.g. XGDX , XGDY
22 33 44 I/O LOAD Instructions Load Instructions : Example: LDAA , LDAB , LDD , LDX , LDY Instructions load CPU registers with values from memory or I/O. 68HC11 Memory CPU Registers Data Flows
Sample of Load Instructions (1) Addressing Instructions Modes Description LDAA #$30 IMM ;ACCA loaded with $30 (hex) CPU ACCA I/O $30 Data Flows
$22 $33 $44 $002E $002F $0030 Sample of Load Instructions (2) Addressing Instructions Modes Description LDAA $30 DIR ;ACCA loaded with contents ;from memory address $30 Memory Content Memory Address CPU ACCA $44 Data Flows
$56 $78 $90 $9000 $9001 $9002 Sample of Load Instructions (3) Addressing Instructions Modes Description LDD $9000 EXT ;ACCD loaded with contents ;from memory address $9000 ;& $9001 Memory Content Memory Address CPU ACCA ACCB $56 $78 $44 ACCD
$22 $33 $44 $902E $902F $9030 Sample of Load Instructions (4) Addressing Instructions Modes Description LDAA $10,X IND ;ACCA loaded with contents ;from memory address (offset ;+ X) Memory Content Memory Address CPU IND X 9020 ACCA $44 Data Flows
STORE Instructions Store Instructions : Example: STAA , STAB , STD , STX , STY - Instructions store or place contents of any CPU registers to a memory or I/O location. 68HC11 Memory CPU Registers I/O Data Flows
$22 $33 $44 $000F $0010 $0011 Sample of Store Instructions (1) Addressing Instructions Modes Description STAA $10 DIR ; Place contents of ACCA into ; memory location ($0010). Memory Content Memory Address CPU ACCA $90 $90 $44 Data Flows
$22 $33 $44 $0FFF $1000 $1001 Sample of Store Instructions (2) Addressing Instructions Modes Description STAA $1000 EXT ; Place contents of ACCA into ; memory location ($1000). Memory Content Memory Address CPU ACCA $E0 $E0 $44 Data Flows
$22 $33 $44 $005F $0060 $0061 Sample of Store Instructions (3) Addressing Instructions Modes Description STX $60 DIR ; Place contents of IX into ; memory location $0060 and ; $0061 Memory Content Memory Address CPU IX Register $12 $34 $1234 $44 Data Flows
$22 $33 $44 $801E $801F $8020 Sample of Store Instructions (4) Addressing Instructions Modes Description STAA $20,Y IND ; Place contents of ACCA into ; memory location $20 + Y CPU Memory Content Memory Address IY $8000 $44 $E0 $E0 Data Flows ACCA
TRANSFER Instructions 68HC11 • Transfer Instructions: • Example: TAB , TBA • TAB => Transfer ACCA to ACCB. • Instruction TAB will move (or copy) the contents of ACCA to ACCB. • If contents ACCA = $38 & ACCB = $9F • Executing TAB, will result in ACCA = ACCB = $38 TBA ACCA ACCB TAB
$42 $8E TRANSFER Instructions Example: TBA = Transfer (or copy) contents of ACCB to ACCA. If contents of ACCA = $42 & ACCB = $8E 68HC11 TBA $8E ACCB ACCA
EXCHANGE Instructions 68HC11 • Exchange Instructions • Examples: XGDX , XGDY • XGDX instruction will transfer the contents of ACCD to Index-X (IX) register and the contents of IX will transfer to ACCD. ACCD IX
EXCHANGE Instructions Example: XGDY :Instruction will transfer the contents of ACCD to Index-Y (IY) register and the contents of IY will transfer to ACCD. 68HC11 XGDY $1234 $5678 ACCD IY
Load, Transfer and Exchange Instructions Examples: LDAA #$59 LDAB #$2A TAB LDX #$4567 XGDX LDY #$1122 XGDY ; Load ACCA with data $59 ; Load ACCB with data $2A ; Transfer contents of ACCA to ACCB ; Load IX register with data $4567 ; Exchange contents of IX and ACCD ; Load IY with data $1122 ; Exchange contents of IY and ACCD
Load, Transfer and Exchange Instructions Examples: LDAA #$59 LDAB #$2A TAB LDX #$4567 XGDX LDY #$1122 XGDY A B A, B $2A $59 $11 $67 $22 $59 $45 D $4567 $1122 $5959 $592A IX $5959 $4567 IY $1122 $4567