Introduction to Embedded Systems :: CSCI 255
Lab Assignments
Lab 4
-- Save the Island....again


HOME        SYLLABUS        HOMEWORK        LABS        LINKS        NOTES









Due:  End of Lab Session (10.14.2013)

Requirement:  Bread Board, Jump Wires, MSP430, LEDs, Buzzer, and work with your lab partner on the code

The goal of this assignment is to gain experience using subroutines, improve your assembly language style, and practice using the integrated debugger in the CCS IDE.

This includes:

  • Create a subroutine that is used as the delay code, another subroutine to flash all LEDs & another for the buzzer sound.

  • Use comments to clearly describe what different parts of your program do.

  • Use descriptive names for all labels.

  • Use the .equ assembler directive to give friendly names to ports used for input/output (button, buzzer and LEDs).

  • Remove unnecessary instructions and simplify if possible

 

Port 1: Digital I/O Description (Ch7)

Port P1 input, P1IN: reading returns the logical values on the inputs if they are configured for digital input/output. This register is read-only and volatile. It does not need to be initialized because its contents are determined by the external signals.

Port P1 output, P1OUT: writing sends the value to be driven to each pin if it is configured as a digital output. If the pin is not currently an output, the value is stored in Digital Input, Output, and Displays 209 a buffer and appears on the pin if it is later switched to be an output. This register is not initialized and you should therefore write to P1OUT before configuring the pin for output.

Port P1 direction, P1DIR: clearing a bit to 0 configures a pin as an input, which is the default in most cases.Writing a 1 switches the pin to become an output. This is for digital input and output; the register works differently if other functions are selected using P1SEL.

Port P1 resistor enable, P1REN: setting a bit to 1 activates a pull-up or pull-down resistor on a pin (like the P1.3 button). Pull-ups are often used to connect a switch to an input as in the section "Read Input from a Switch" on page 80. The resistors are inactive by
default (0). When the resistor is enabled (1), the corresponding bit of the P1OUT register selects whether the resistor pulls the input up to VCC (1) or down to VSS (0).

Port P1 selection, P1SEL: selects either digital input/output (0, default) or an alternative function (1). Further registers may be needed to choose the particular function.

Button Example: How to make P1.3 work in Pseudo-code

 

Submission:

1 - Have each part of the lab checked out by Matt, Clint or Damian by showing your code, flashing your code to the board, and display working circuit.

2 - Print your final code with the following header:

/***************************************************
* Your Name
* Lab x assignment
* filename: yyyyyyyyy.asm
*
* Description of the assignment
*
***************************************************/

3 - Make sure you have a well commented code


Copyright © 2011 by Keith Vertanen.

 


Montana Tech -- College of Letters, Science & Professional Studies -- Computer Science Department
All Rights Reserved and Copyright © 2013 by Damian Valles