Lab 7 MSP430 Assembly Programming Basics In this lab, you will be designing assembly programs running on MSP430 hardware using the LAR Kickstart IDE tool, a free tool for 1AR for programming MSP430. You will lean basic assembly programming, debugging techniques, MSP430 general purpose I/O along with number conversions. This lab worksheet along with your assembly program design and simulation will be inspected by the instructor in the lab for grading. Note that you will be using your own MSP430 for the lab. Most of the materials are hosted at glab Tutorials.htm- Understand your MSP430 hardware. Depends what MSP430 chips you've got, you may have a slightly different hardware setting. Most of the hardware manufacturers encode chip numbers according to chip attributes such as capacity, features, etc. The following figure shows MSP430 nomenclature. 1. MSP430FG46191QZWR R Tape &Rel Temp ringe (l--40 to as, T-40to105C Family (Memory size & peripherals configuration Series of similar function Generation (1xx, 2xx, 3xx, 4xx, 5xx) Optional: End Equipment Optimized (G-Medical, E-E-Meter) Memory Type (F-Flash, C ROM, P OTP) Member of the 430 MCU Platform Mixed Signal Processor OCMS-Experimental skon) First of all, read the chip number on your MSP430 and write it down to the following box. Yo may need a magnifier to read it because the code is pretty small. Note the MPS430 is sitting on the far end to the USB plug, and the following figure may not reflect the actual shape of your MSP430 check MSP430 Copyright 2012-2015 by Chia-Tien Dan Lo 2. Familiar yourself with the IAR Kickstart IDE and its besic assembly programming structure. Walk through the utorial create project named "HelloWorldPy" and a workspace called D tutorial. In IAR, projects are contained in a workspace. Each of the projects may have diffierent settings according to what the target hardware is. Therefore, each project is basically independent but the project wizard won't create a dedicated directory for every project. Iht is your responsibility to create one folder for every project in the workspace. An assembly program for MSP430 is composed of instructions (one instraction per one line) and other information for the assembler Each line is divided into three columns: label, instruction, and operands, Comments are identified by a semicolon. Each instruction has two versions: byte (.B) and word (W). Answer the following like what's in the a) How many bytes in a word in MSP4307 Check b) What does the MOV.W instruction do? Show the instructor how to convert decimal 1234 to hexadecimal in AR. c) d) Show the instructor how to convert octal 1234 to decimal in IAR 3. Walk through the tutorial aboutMSP430 O at 0 ports in MSP430 are controlled by three registers, e.g., PIOUT, PIIN, and PIDIR. Each of the registers has 8 bits. The zero bit (P1.0) in PIOUT is connected to an LED. If P1.0 is set, the LED light up: otherwise, the LED is off. The port is bi-directional, and controlled by PIDIR. In order for the MSP430 to set the P1.0, the zero bit of PIDIR has to be set to 1 (output mode). When we need to read input signal from the port, PIIN is used and its corresponding bit will be set to 0 (input mode). Based on the above knowledge, answer the following questions. Copyright 0 2012-2015 by Chia-Tien Dan Lo a) What does the instruction BIS.B do7 b) What does the instruction XOR B do? c) What happened if XOR.B is replaced with XOR. W d) Add a label "loop:" in front of XOR.B, and change the S sign with the label without the colon. Debug the program. What do you find? Why is that? e) What does the instruction JMP do? Copyright O 2012-2015 by Chia-Tien Dan Lo Lab 7 MSP430 Assembly Programming Basics In this lab, you will be designing assembly programs running on MSP430 hardware using the LAR Kickstart IDE tool, a free tool for 1AR for programming MSP430. You will lean basic assembly programming, debugging techniques, MSP430 general purpose I/O along with number conversions. This lab worksheet along with your assembly program design and simulation will be inspected by the instructor in the lab for grading. Note that you will be using your own MSP430 for the lab. Most of the materials are hosted at glab Tutorials.htm- Understand your MSP430 hardware. Depends what MSP430 chips you've got, you may have a slightly different hardware setting. Most of the hardware manufacturers encode chip numbers according to chip attributes such as capacity, features, etc. The following figure shows MSP430 nomenclature. 1. MSP430FG46191QZWR R Tape &Rel Temp ringe (l--40 to as, T-40to105C Family (Memory size & peripherals configuration Series of similar function Generation (1xx, 2xx, 3xx, 4xx, 5xx) Optional: End Equipment Optimized (G-Medical, E-E-Meter) Memory Type (F-Flash, C ROM, P OTP) Member of the 430 MCU Platform Mixed Signal Processor OCMS-Experimental skon) First of all, read the chip number on your MSP430 and write it down to the following box. Yo may need a magnifier to read it because the code is pretty small. Note the MPS430 is sitting on the far end to the USB plug, and the following figure may not reflect the actual shape of your MSP430 check MSP430 Copyright 2012-2015 by Chia-Tien Dan Lo 2. Familiar yourself with the IAR Kickstart IDE and its besic assembly programming structure. Walk through the utorial create project named "HelloWorldPy" and a workspace called D tutorial. In IAR, projects are contained in a workspace. Each of the projects may have diffierent settings according to what the target hardware is. Therefore, each project is basically independent but the project wizard won't create a dedicated directory for every project. Iht is your responsibility to create one folder for every project in the workspace. An assembly program for MSP430 is composed of instructions (one instraction per one line) and other information for the assembler Each line is divided into three columns: label, instruction, and operands, Comments are identified by a semicolon. Each instruction has two versions: byte (.B) and word (W). Answer the following like what's in the a) How many bytes in a word in MSP4307 Check b) What does the MOV.W instruction do? Show the instructor how to convert decimal 1234 to hexadecimal in AR. c) d) Show the instructor how to convert octal 1234 to decimal in IAR 3. Walk through the tutorial aboutMSP430 O at 0 ports in MSP430 are controlled by three registers, e.g., PIOUT, PIIN, and PIDIR. Each of the registers has 8 bits. The zero bit (P1.0) in PIOUT is connected to an LED. If P1.0 is set, the LED light up: otherwise, the LED is off. The port is bi-directional, and controlled by PIDIR. In order for the MSP430 to set the P1.0, the zero bit of PIDIR has to be set to 1 (output mode). When we need to read input signal from the port, PIIN is used and its corresponding bit will be set to 0 (input mode). Based on the above knowledge, answer the following questions. Copyright 0 2012-2015 by Chia-Tien Dan Lo a) What does the instruction BIS.B do7 b) What does the instruction XOR B do? c) What happened if XOR.B is replaced with XOR. W d) Add a label "loop:" in front of XOR.B, and change the S sign with the label without the colon. Debug the program. What do you find? Why is that? e) What does the instruction JMP do? Copyright O 2012-2015 by Chia-Tien Dan Lo