MSP430 instruction set *

Similar documents
Befehle des MSP430. ADC Add carry to destination. ADD Add source to destination. ADDC[ Add source and carry to destination

Chapter 8 Architecture and Instruction Set

~TEXAS INSTRUMENTS. MSP430 Family ==-=---===========

Lecture 2 MSP430 Architecture. Atul Lele Ramakrishna Reddy

Hacettepe University

Organization in Memory

PHYS 319. Things to do before next week's lab Whirlwind tour of the MSP430 CPU and its assembly language Activity 1.

Intel Instruction Set (gas)

Before next weeks lab:

CPU: SOFTWARE ARCHITECTURE INSTRUCTION SET (PART

TYPES OF INTERRUPTS: -

Microcontroller Intel [Instruction Set]


10-1 C D Pearson Education, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 4e

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples.

INSTRUCTION SET OF 8085

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman


SOEN228, Winter Revision 1.2 Date: October 25,

Assembly Language Programming of 8085

TABLE 9-1. Symbolic Convention for Addressing Modes. Register indirect LDA (R1) ACC M[ R1] Refers to Figure 9-4. Addressing mode. Symbolic convention

Assembly Language Programming of 8085

Q. Classify the instruction set of 8051 and list out the instructions in each type.

By: Dr. Hamed Saghaei

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

Interrupt Driven Programming in MSP430 Assembly (ESCAPE) *

8085 INSTRUCTION SET INSTRUCTION DETAILS

1 The mnemonic that is placed before the arithmetic operation is performed is A. AAA B. AAS C. AAM D. AAD ANSWER: D

Programming of 8085 microprocessor and 8051 micro controller Study material

8051 Overview and Instruction Set

SN8F5000 Family Instruction Set

It is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.

Instruction set of 8085

Assembly Language programming (3)

8051 Microcontrollers

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

MSP430x2xx Family. User s Guide Extract Mixed Signal Products SLAU167

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

CHAPTER 3 JUMP, LOOP, AND CALL INSTRUCTIONS

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Table 1: Mnemonics Operations Dictionary. Add Accumulators Add B to Y. Add with carry to B. Add Memory to B. Add 16-bit to D And B with Memory

CY16 USB Host/Slave Controller/16-Bit

DR bit RISC Microcontroller. Instructions set details ver 3.10

H8/300L Series Programming Manual

Fig: Computer memory with Program, data, and Stack. Blog - NEC (Autonomous) 1

Block diagram of processor (Harvard)

Microcontroller. Instruction set of 8051

Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1

Tutorial 1: Programming Model 1

3.1 DATA MOVEMENT INSTRUCTIONS 45

C51 Family. Architectural Overview of the C51 Family. Summary

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Module Contents of the Module Hours COs

8051 Microcontroller

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

Copyright 2009 Texas Instruments All Rights Reserved

2005 Mixed Signal Products SLAU169

9/25/ Software & Hardware Architecture

Dodatak. Skup instrukcija

Digital Blocks Semiconductor IP

3.0 Instruction Set. 3.1 Overview

Computer System Architecture

Lecture-12 INTERNAL ARCHITECTURE OF INTEL 8085: The Functional Block Diagram Of 8085 Is Shown In Fig 16.

Programming Model 2 A. Introduction

Arithmetic and Logic Instructions And Programs

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

The Assembly Language of the Boz 5

Digital Blocks Semiconductor IP

PESIT Bangalore South Campus

Instruction Set Of 8051

MIDTERM#1. 2-(3pts) What is the difference between Von Neumann & Harvard processor architectures?

ENE 334 Microprocessors

Digital Blocks Semiconductor IP

ET2640 Microprocessors

PicoBlaze Instruction Set and Event Reference

UNIT THE 8051 INSTRUCTION SET AND PROGRAMMING

8051 Microcontroller Assembly Programming

from WRITE GREAT CODE Volume 2: Thinking Low-Level, Writing High-Level ONLINE APPENDIX A The Minimal 80x86 Instruction Set by Randall Hyde

APPENDIX C INSTRUCTION SET DESCRIPTIONS

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.

Lecture 6 Assembly Programming: Branch & Iteration

INSTRUCTION SET AND EXECUTION

Introduction. 3 major parts of CPU : Fig Design Examples of simple CPU. In this chapter : Chap. 8. Chap. 8 Central Processing Unit

Its Assembly language programming

8051 Instruction Set

ORG ; TWO. Assembly Language Programming

Dragonchip. Instruction Set Manual

Practical Malware Analysis

Chapter 1 MSP430 Microcontroller Family

ENE 334 Microprocessors

Programming the Motorola MC68HC11 Microcontroller

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

ELEG3924 Microprocessor

OSIAC Read OSIAC 5362 posted on the course website

MOS 6502 Architecture

Transcription:

OpenStax-CNX module: m23503 1 MSP430 instruction set * Pedro Dinis António Espírito Santo Bruno Ribeiro This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 3.0 Instruction set The MSP430 instruction set consists of 27 core instructions. Additionally, it supports 24 emulated instructions. The core instructions have unique op-codes decoded by the CPU, while the emulated ones need assemblers and compilers to generate their mnemonics. There are three core-instruction formats: - Double operand; - Single operand; - Program ow control - Jump. Byte, word and address instructions are accessed using the.b,.w or.a extensions. If the extension is omitted, the instruction is interpreted as a word instruction. 1 Double operand instructions The double operand instruction is formatted as follows: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 opcode S-Reg Ad B/W As D-Reg Table 1 Bit 15-12 opcode Description 11-8 S-Reg The working register used for the source operand (src) * Version 1.1: May 19, 2009 12:30 pm -0500 http://creativecommons.org/licenses/by/3.0/

OpenStax-CNX module: m23503 2 7 Ad The addressing bits responsible for the addressing mode used for the destination operand () 6 B/W Byte or word operation:b/w=0: word operation; B/W=1: byte operation 5-4 As The addressing bits responsible for the addressing mode used for the source operand (src) 3-0 D-Reg The working register used for the destination operand () Table 2 The next tableshows the double operand instructions that are not emulated. Mnemonic Operation Description Arithmetic instructions ADD(.B or.w) src+ Add source to destination ADDC(.B or.w) src++c Add source and carry to destination DADD(.B or.w) src++c (dec) Decimal add source and carry to destination SUB(.B or.w) +.not.src+1 Subtract source from destination SUBC(.B or.w) +.not.src+c Subtract source and not carry from destination AND(.B or.w) src.and. AND source with destination BIC(.B or.w).not.src.and. Clear bits in destination BIS(.B or.w) src.or. Set bits in destination BIT(.B or.w) src.and. Test bits in destination XOR(.B or.w) src.xor. XOR source with destination CMP(.B or.w) -src Compare source to destination MOV(.B or.w) src Move source to destination Table 3 Depending on the double operand instruction result, the status bits may be aected. The following gives the conditions for setting and resetting the status bits.

OpenStax-CNX module: m23503 3 Status bits Mnemonic V N Z C Arithmetic instructions ADD(.B or.w) ADDC(.B or.w) DADD(.B or.w) SUB(.B or.w) SUBC(.B or.w) overow=0, overow=0, - =1, MSB=1=0, overow=0, overow=0, AND(.B or.w) BIC(.B or.w) BIS(.B or.w) BIT(.B or.w) XOR(.B or.w) CMP(.B or.w) =0 =1, MSB result set=0, if not set =0 =1, MSB result set=0, =1, both operands negative overow=0, =1, MSB result set=0, =1, src>==0, src< =1, src==0, =1, carry from result=0, if not =1, carry from MSB result=0, if not =1, result > 99(99) =1, if no borrow=0, =1, if no borrow=0, =1, carry from MSB result=0, if not

OpenStax-CNX module: m23503 4 MOV(.B or.w) Table 4 2 Single operand instructions The single operand instruction is formatted as follows: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 opcode B/W Ad D/S-Reg Table 5 Bit 15-7 opcode Description 6 B/W Byte or word operation:b/w=0: word operation; B/W=1: byte operation 5-4 Ad The addressing bits responsible for the addressing mode used for the source operand (src) 3-0 D/S-Reg The working register used for the destination operand () or for the source operand (src) Table 6 The next table shows the single operand instructions that are not emulated. Mnemonic Operation Description RRA(.B or.w) MSB MSB...LSB C Roll destination right RRC(.B or.w) C MSB...LSB C Roll destination right through (from) carry SWPB(.B or.w) Swap bytes Swap bytes in destination SXT bit 7 bit 8...bit 15 Sign extend destination

OpenStax-CNX module: m23503 5 PUSH(.B or.w) src SP-2 SP, src @SP Push source to stack Program ow control instructions CALL(.B or.w) SP-2 SP, PC+2 @SP PC Subroutine call to destination RETI TOS SR, SP+2 SPTOS PC, SP+2 SP Table 7 Conditions for status bits, depending on the single operand instruction result. Return from interrupt Status bits Mnemonic V N Z C RRA(.B or.w) RRC(.B or.w) SWPB(.B or.w) =0 =1, positive & C=1=0, SXT =0 PUSH(.B or.w) src CALL(.B or.w) RETI restored from stack - - - restored stack Table 8 from restored stack from Loaded from LSB Loaded from LSB restored stack from 3 Program ow control - Jumps The jump instruction is formatted as follows: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 opcode C 10 bit PC oset Table 9 Bit Description 15-13 opcode 12-10 C 9-0 PC oset PCnew = PCold + 2 + PCoset 2

OpenStax-CNX module: m23503 6 Table 10 The following table shows the program ow control (jump) instructions that are not emulated. Mnemonic Description Program ow control instructions JEQ/JZ label Jump to label if zero ag is set JNE/JNZ label Jump to label if zero ag is reset JC label Jump to label if carry ag is set JNC label Jump to label if carry ag is reset JN label Jump to label if negative ag is set JGE label Jump to label if greater than or equal JL label Jump to label if less than JMP label Jump to label unconditionally Table 11 4 Emulated instructions The next gives the dierent emulated instructions. This table also contains the type of operation and the emulated instruction based on the core instructions. Mnemonic Operation Emulation Description Arithmetic instructions ADC(.B or.w) DADC(.B or.w) +C ADDC(.B or.w) #0, Add carry to destination +C (decimally) DADD(.B or.w) #0, Decimal add carry to destination DEC(.B or.w) -1 SUB(.B or.w) #1, Decrement destination DECD(.B or.w) -2 SUB(.B or.w) #2, Decrement destination twice INC(.B or.w) +1 ADD(.B or.w) #1, Increment destination

OpenStax-CNX module: m23503 7 INCD(.B or.w) SBC(.B or.w) +2 ADD(.B or.w) #2, Increment destination twice +0FFFFh+C +0FFh SUBC(.B or.w) #0, Subtract source and borrow /.NOT. carry from dest. RLA(.B or.w) RLC(.B or.w) INV(.B or.w).not. XOR(.B or.w) #0(FF)FFh, Invert bits in destination C[U+F0AC]MSB[U+F0AC]MSB- ADD(.B or.w), 1...LSB+1[U+F0AC]LSB[U+F0AC]0 Rotate left arithmetically C[U+F0AC]MSB[U+F0AC]MSB- ADDC(.B or.w), Rotate left 1...LSB+1[U+F0AC]LSB[U+F0AC]C through carry CLR(.B or.w) 0 MOV(.B or.w) #0, Clear destination CLRC 0 C BIC #1,SR Clear carry ag CLRN 0 N BIC #4,SR Clear negative ag CLRZ 0 Z BIC #2,SR Clear zero ag POP(.B or.w) @SP tempsp+2 SPtemp MOV(.B or.w) @SP+, Pop byte/word from stack to destination SETC 1 C BIS #1,SR Set carry ag SETN 1 N BIS #4,SR Set negative ag SETZ 1 Z BIS #2,SR Set zero ag TST(.B or.w) + 0FFFFh + 1 + 0FFh + 1 Program ow control CMP(.B or.w) #0, Test destination BR PC MOV,PC Branch to destination DINT 0 GIE BIC #8,SR Disable (general) interrupts

OpenStax-CNX module: m23503 8 EINT 1 GIE BIS #8,SR Enable (general) interrupts NOP None MOV #0,R3 No operation RET @SP PCSP+2 SP MOV @SP+,PC Return from subroutine Table 12 Conditions for status bits, depending on the emulated instruction result. Status bits Mnemonic V N Z C Arithmetic instructions ADC(.B or.w) DADC(.B or.w) overow=0, DEC(.B or.w) overow=0, DECD(.B or.w) INC(.B or.w) INCD(.B or.w) - =1, MSB=1=0, overow=0, 07(FF)h=0, 07(FFE)h=0, =1, =0=0, 1=0, 2=0, FF(FE)h=0, =1, from 0FFFFh to 0000=0, =1, from 99(99) to 00(00)=0, 0=0, 0 or 1=0, FF(FF)h=0, FF(FF)h=0, FF(FF)h or FF(FE)h=0,

OpenStax-CNX module: m23503 9 SBC(.B or.w) overow=0, INV(.B or.w) =1, negative initial =0, RLA(.B or.w) overow=0, RLC(.B or.w) overow=0, FF(FF)h=0, CLR(.B or.w) CLRC - - - =0 CLRN - =0 - - CLRZ - - =0 - POP(.B or.w) SETC - - - =1 SETN - =1 - - SETZ - - =1 - TST(.B or.w) =0 =1, negative=0, Program ow control =1, contains zero=0, BR DINT EINT NOP RET Table 13 =1, if no borrow=0, Loaded from MSB Loaded from MSB Request the MSP430 Teaching ROM Materials here https://www-a.ti.com/apps/dspuniv/teaching_rom_request.asp 1 =1 1 https://www-a.ti.com/apps/dspuniv/teaching_rom_request.asp