Skip to content Skip to navigation Skip to collection information

OpenStax_CNX

You are here: Home » Content » Microcontroller and Embedded Systems Laboratory » Lab 3: Introduction to Assembly Language

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • TI MSP430 display tagshide tags

    This collection is included inLens: Texas Instruments MSP430
    By: Texas Instruments

    Comments:

    "Basic introduction to microcontroller-based embedded systems development. Includes structured laboratory exercises in the following areas: assembly programming, C language programming, peripheral […]"

    Click the "TI MSP430" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Lab 3: Introduction to Assembly Language

Module by: CJ Ganier. E-mail the author

Summary: A lab that introduces a student to assembly language programming.

In this lab you will be introduced to assembly programming. The specific assembly language instruction set of the MSP will be explained. Setting up and executing assembly projects in Crossworks will also be explained. Finally you will implement the blinking lights program from the previous lab in assembly.

Read the following modules before you begin lab exercises:

Exercise 1

Formulate instructions to do the following things:

  1. Set bit 3 to 1 at the memory address 0xd640 while leave bits 0-2 and 4-16 unaffected.
  2. Jump to the instruction labeled POINT if the carry bit is set.
  3. Shift register R6 right one place while preserving the sign.

Exercise 2

Examine this loop:


... more instructions... 	
Mov.w  &I,  R4  
Cmp.w  #0x0000, R4 
JZ    After_loop

Start_loop:
Dec.w   #0x0001, R4	 
JZ  After_loop
BR #Start_loop

After_loop:
...more instructions...
  • How many times will this loop execute?
  • Why do we use the BR instruction with a #Start_loop, but with the JZ we use a plain After_loop?
  • What does the first JZ instruction do? If we did not have this initial Cmp and JZ, what (possibly) inadvertent effect might occur?

Exercise 3

Re-write the blinking light program from Lab 2, now using assembly code. The program should do the following:

  1. When the program starts all three LED’s should light up for about a second then turn off.
  2. Next, the green LED should blink for about 1/2 second on, 1/2 second off while the other two LED’s are off.
  3. Pushing Button 1 should cause the green LED to stop blinking and cause the red LED to start the blinking pattern.
  4. Pushing the button again should continue the pattern with the yellow LED, and pushing it more times should repeat the green, red, yellow pattern. Note that the current LED that's blinking should stop as soon as the button is pressed and the next LED should begin immediately.

Collection Navigation

Content actions

Download:

Collection as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks