<< Chapter < Page | Chapter >> Page > |
Symbolic mode allows the assignment of labels to fixed memory locations, so that those locations can be addressed. This is useful for the development of embedded programs.
Description: (PC + X) points to the operand. X is stored in the next word. Indexed mode X(PC) is used.
Source mode bits: As = 01 (memory location is defined by the word immediately following the opcode).
Destination mode bit: Ad=1 (memory location is defined by the word immediately following the opcode).
Syntax: ADDR.
Length: Two or three words.
Comment: Valid for source and destination.
Example 3: Move the content of source address XPT (x pointer) to the destination address YPT (y pointer).
Before operation: XPT=A002h Location YPT=050Ah
Operation: MOV XPT, YPT
After operation: XPT= A002h Location YPT=A002h
Operands | 2 nd operand mode | Operator | Cycles | Length (words) |
2 | Register | Any | 3 | 2 |
2 | Indexed, Symbolic or Absolute | Any | 6 | 3 |
1 | N/A | RRA, RRC, SWPB or SXT | 4 | 2 |
1 | N/A | CALL or PUSH | 5 | 2 |
Similar to Symbolic mode, with the difference that the label is preceded by “&”.
Description: The word following the instruction contains the absolute address. X is stored in the next word. Indexed mode X(SR) is used.
Source mode bits: As = 01 (memory location is defined by the word immediately following the opcode).
Destination mode bit: Ad=1 (memory location is defined by the word immediately following the opcode).
Syntax: &ADDR.
Length: Two or three words.
Comment: Valid for source and destination.
Example 4: Move the content of source address XPT to the destination address YPT.
Before operation: Location XPT=A002h Location YPT=050Ah
Operation: MOV&XPT,&YPT
After operation: Location XPT= A002h Location YPT=A002h
Operands | 2 nd operand mode | Operator | Cycles | Length (words) |
2 | Register | Any | 3 | 2 |
2 | Indexed, Symbolic or Absolute | Any | 6 | 3 |
1 | N/A | RRA, RRC, SWPB or SXT | 4 | 2 |
1 | N/A | CALL or PUSH | 5 | 2 |
The data word addressed is located in the memory location pointed to by Rn. Indirect mode is not valid for destination operands, but can be emulated with the indexed mode format 0(Rn).
Description: Rn is used as a pointer to the operand.
Source mode bits: As = 10.
Syntax: @Rn.
Length: One or two words.
Comment : Valid only for source operand. The substitute for destination operand is 0(Rn).
Example 5: Move the contents of the source address (contents of R4) to the destination (register R5). Register R4 is not modified.
Before operation: R4=A002h R5=050Ah Loc:0xA002=0123h
Operation: MOV @(R4), R5
After operation: R4= A002h R5=0123h Loc:0xA002=0123h
Operands | 2 nd operand mode | Operator | Cycles | Length (words) |
2 | Register | Any | 2* | 1 |
2 | Indexed, Symbolic or Absolute | Any | 5 | 2 |
1 | N/A | RRA, RRC, SWPB or SXT | 3 | 1 |
1 | N/A | CALL or PUSH | 4 | 1 |
Similar to indirect register mode, but with indirect auto increment mode, the operand is incremented as part of the instruction. The format for operands is @Rn+. This is useful for working on blocks of data.
Description: Rn is used as a pointer to the operand. Rn is incremented afterwards by 1 for byte instructions and by 2 for word instructions.
Source mode bits: As = 11.
Syntax: @Rn+.
Length: One or two words.
Comment : Valid only for source operand. The substitute for destination operand is 0(Rn) plus second instruction INCD Rn.
Example 6: Move the contents of the source address (contents of R4) to the destination (register R5), then increment the value in register R4 to point to the next word.
Before operation: R4=A002h R5=050Ah Loc:0xA002=0123h
Operation: MOV @R4+, R5
After operation: R4= A004h R5=0123h Loc:0xA002=0123h
Operands | 2 nd operand mode | Operator | Cycles | Length (words) |
2 | Register | Any | 2* | 1 |
2 | Indexed, Symbolic or Absolute | Any | 5 | 2 |
1 | N/A | RRA, RRC, SWPB or SXT | 3 | 1 |
1 | N/A | PUSH | 4 | 1 |
1 | N/A | CALL | 5 | 1 |
Immediate mode is used to assign constant values to registers or memory locations.
Description: The word following the instruction contains the immediate constant N. Indirect autoincrement mode @PC+ is used.
Source mode bits: As = 11.
Syntax: #N.
Length: Two or three words. It is one word less if a constant in CG1 or CG2 can be used.
Comment : Valid only for source operand.
Example 7: Move the immediate constant E2h to the destination (register R5).
Before operation: R4=A002h R5=050Ah
Operation: MOV #E2h, R5
After operation: R4= A002h R5=00E2h
Operands | 2 nd operand mode | Operator | Cycles | Length (words) |
2 | Register | Any | 2* | 2 |
2 | Indexed, Symbolic or Absolute | Any | 5 | 3 |
1 | N/A | RRA, RRC, SWPB or SXT | N/A | N/A |
1 | N/A | PUSH | 4 | 2 |
1 | N/A | CALL | 5 | 2 |
Request the MSP430 Teaching ROM Materials here (External Link)
Notification Switch
Would you like to follow the 'Teaching and classroom laboratories based on the “ez430” and "experimenter's board" msp430 microcontroller platforms and code composer essentials' conversation and receive update notifications?