BYU CS 124Lab 0 - Warm-up Lab1 Lab 0 – Warm-up Lab 1.Acquire a Texas Instruments MSP430 LaunchPad...
-
Upload
jennifer-stewart -
Category
Documents
-
view
215 -
download
2
Transcript of BYU CS 124Lab 0 - Warm-up Lab1 Lab 0 – Warm-up Lab 1.Acquire a Texas Instruments MSP430 LaunchPad...
Lab 0 - Warm-up Lab 1BYU CS 124
Lab 0 – Warm-up Lab
1. Acquire a Texas Instruments MSP430 LaunchPad Development Tool.
2. Setup a CS user account.3. Install (if necessary) and "run" blink.txt on the Digital
State Machine Simulator.4. Install (if necessary) and execute TI's Code Composer
Studio (CCSv5.2).a. Create a new assembly project. Load, assemble, and execute
blinky.asm on your LaunchPad development tool.b. Modify blinky.asm to double the toggle speed of the LED.c. Use Code Composer to create a new C language project.
Load, compile and execute blinky.c on your LaunchPad development tool as well.
d. Modify blinky.c to double the toggle speed of the LED.
Warm-up Lab
Lab 0 - Warm-up Lab 2BYU CS 124
Lab 0 – Warm-up Lab
No lab source material should ever be emailed to another student!
Please avoid even the appearance of cheating by looking on another's monitor.
Warm-up Lab
1. Read again the Academic Honesty declaration.
Students are encouraged work together in as far as discussing, clarifying, and helping each other understand material.
Lab 0 - Warm-up Lab 3BYU CS 124
Lab 0 – Warm-up Lab
2. Acquire a Texas Instruments MSP430 LaunchPad Development Tool directly from Texas Instruments (or BYU Book Exchange, Amazon, Digikey,…).
Warm-up Lab
Lab 0 - Warm-up Lab 4BYU CS 124
Lab 0 – Warm-up Lab
3. Setup a CS user account.
Warm-up Lab
If you are using your own computer, you can still set up your account.
If you are using a computer science department computer, then you should already have an account setup for you. (If you are setting up an account for the first time you may need to use your RouteY ID as your username and your student number as your password.)
Note: you may be required to change your password at this time.
Lab 0 - Warm-up Lab 5BYU CS 124
Lab 0 – Warm-up Lab
4. Install (if necessary) and "run" blink.txt on the Digital State Machine Simulator.
Warm-up Lab
Toggleson and off
LoadBlinky.txt
Lab 0 - Warm-up Lab 6BYU CS 124
Lab 0 – Warm-up Lab
5. Install (if necessary) and "clock" control.txt on the MSP430 micro-architecture simulator.
Warm-up Lab
Lab 0 - Warm-up Lab 7BYU CS 124
Lab 0 – Warm-up Lab
6. Install (if necessary) and execute TI's Code Composer Studio CCSv5.xx.
Warm-up Lab
Lab 0 - Warm-up Lab 8BYU CS 124
Lab 0 – Warm-up Lab
7. Create a new assembly-only project. Load, assemble, and execute blinky.asm on your LaunchPad development tool. Modify blinky.asm to double the toggle speed of the LED.
Warm-up Lab
;*******************************************************************************; CS 124 Lab 1 - blinky.asm: Software Toggle P1.0;; Description: Toggle P1.0 by xor'ing P1.0 inside of a software loop.;;******************************************************************************* .cdecls C,LIST, "msp430.h" ; MSP430
;------------------------------------------------------------------------------ .text ; beginning of executable codeRESET: mov.w #0x0280,SP ; init stack pointer mov.w #WDTPW+WDTHOLD,&WDTCTL ; stop WDT bis.b #0x01,&P1DIR ; set P1.0 as output
mainloop: xor.b #0x01,&P1OUT ; toggle P1.0 mov.w #0,r15 ; use R15 as delay counter
delayloop: sub.w #1,r15 ; delay over? jnz delayloop ; n jmp mainloop ; y, toggle led
;------------------------------------------------------------------------------; Interrupt Vectors .sect ".reset" ; MSP430 RESET Vector .short RESET ; start address .end
Lab 0 - Warm-up Lab 9BYU CS 124
Lab 0 – Warm-up Lab
8. Use Code Composer to create a new C language project. Load, compile and execute blinky.c on your LaunchPad development tool as well. Modify blinky.c to double the toggle speed of the LED.
Warm-up Lab
//******************************************************************************// CS 124 Lab 1 - blinky.c: Software Toggle P1.0//// Description; Toggle P1.0 by xor'ing P1.0 inside of a software loop.////******************************************************************************
#include "msp430.h"
volatile unsigned int i; // volatile to prevent optimization
void main(void){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction
for (;;) { P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR i = 0; // Delay while (--i); }}