Cpr E 211 Laboratory

Lab 2

Tractor Meter

Lecture – Lab Connection

In lecture, we have reviewed the parts of a computer and introduced that a key aspect of this course in input/output interfacing of a processor with its environment. In the first sections of this lab, we learn more about the basic digital input/output devices (switches and LEDs) on the PowerBox.  We will often use this I/O in the lab to represent user or environment input, such as from buttons, dials, etc. Memory-mapped I/O is also defined. The rest of the lab describes an embedded programming exercise in the application domain of "smart farming." Students will need to write a C program, and thus lecture and laboratory experiences are both being used to help students understand and practice features of C needed for PowerBox programs. The prelab reading is an important supplement to the lecture.

SKIBLE (SKIll-BuiLding Exercise)

What is a SKIBLE? A skill-building exercise is an activity to start the laboratory period that is focused on learning or reviewing some particular skill relevant to the course that students are expected to be proficient in. A skible is worth 10 points and must be handed in during lab. Lab partners should work on the skible together during the first 10 minutes of lab. Typically, the next 5 minutes of lab will be reserved for the lab instructor to discuss the lab and answer any questions.

See the SKIBLE page for this week’s activity.

Purpose

In this lab, you will write your first complete C program.  At the end of the lab, you should be able to:

Prelab

Complete all sections of the prelab before your lab begins. This means:

§         Read the lab instructions.

§         Read any reference material cited/linked in the instructions.

§         Answer any questions that are indicated as part of the prelab.

§         Begin to design your software. Draw pictures, write pseudo-code, etc. You will need to hand in a code listing at the beginning of lab.

o       Your code does not need to be compiled, but must be typed. 

o       To print your code, use a fixed font (such as Courier) via Word or CodeWarrior/Visual C++.  Do not use Notepad. 

o       If you are writing your prelab together with your lab partner, include near the beginning of your comments a list of the parts that each of you worked on.

Also review the code commenting guidelines.  Commenting should be included in both your prelab and final code, but we will look more closely at your final code with respect to the guidelines.

Reference Files for the Lab

File Name

Description

I/O Port Addresses

Definitions to reference I/O ports

PowerPC.zip

PC HyperTerminal settings

C Reference Manual

CodeWarrior C Reference Manual (3.5 MB)

Lab Evaluation Form

Evaluation checklist for Lab 2

Lab Components

  1. Print a Lab Evaluation Form for your group.
  2. Turn in the prelab to your TA at the beginning of the lab.
  3. Open a new project in CodeWarrior (go to File menu, then New)
    - Select CprE 211 - PowerPC - Stationery as the project type.
    - Name your project, and set your project directory on the U: drive.
    - Select C code.
    - Go to Project menu, and use Add Files to add the C program file you created for this lab.
    - Inspect the project window. Does each of the files you have included (using #include)
    appear in the listing?  If not, go to Project menu, Add Files option.
  4. Test and debug your lab
  5. Demonstrate the completed lab to your TA
  6. Save a copy of the completed lab to each partner's U: drive or Vincent account