EGH167 Hands-on Lab

Lab 5: Controlling a Stop Light

 

Introduction

Purpose

The purpose of this lab is to create a program for the Handy Board to control a simulated stoplight.

 

Lab Experience

The lab experience will encompass:

1)            Using the Handy Board and Interactive C,

2)            Writing and converting source files from C to IC, and

3)            Compiling source files.

 

Lab Experience

Introduction

Using the C program you wrote for Hand Out #1, you are to create a program for the Handy Board to control a simulated stoplight. You will need

to edit your program to make the necessary changes so that it will compile with the Interactive C compiler (IC) for the Handy Board. You may

choose to either use a Windows editor (Notepad, Wordpad, or other) or you may use the editor built into IC (suggested). You will need to

connect the stoplight wires to the motor ports on the Handy Board. Refer to the diagram of the Handy Board for location of motor ports. Recall

that one motor port will be used to control one of the colors on the stoplight, and the polarity of the motor output will control the which of the two

lights (i.e., which direction) will be turned on. Thus, three motor ports will be used, one for the "red", one for the "yellow", and one for the "green"

lights.

 

Procedure

Each team member should attempt the following procedure:

 

1.      Start IC and "Download P-Code" to Handy Board. (Click on "Board" and select "Reload Pcode", follow directions, choose "Handy_Board_1.2.icd" if given choice).

 

2.      Open your source file in IC. (Click on "File" and select "Open").

 

3.      Edit source file as may be necessary.

 

4.      Download (compile) source file to Handy Board. (Click on "Load" and select "Download Window". If not error free, go to step 3.

 

5.      Reset (Turn off, then on) Handy Board to start program. If stoplight does not perform as desired, check hookup and/or program. Return to step 3 as necessary.

 

6.      If stoplight performs as desired, have Lab Instructor or TA verify operation and initial your printed copy of the Handy Board source code. (You will have to open your source code in a Windows editor to print it.)

 

LAB REPORT

Format

  Lab reports must be done individually

 

General Guidelines

  Cover page (Hand Out #1 sheet).

 

  Copy of source code that runs on UNIX system.

 

  Printed copy of messages produced when program was run on UNIX system.

 

  Copy of Handy Board source code as initialed by Instructor or TA. (If you are not able to get your own version running on the Handy Board, you must include a copy of your team's working program).

 

  Provide a one to two-page discussion which includes the following:

 

a). Brief discussion (make a list) of steps required to transport and convert UNIX source code to Handy Board source

 

b). Brief discussion of changes you expected to make to your source code.

 

c). Brief discussion of changes you actually had to make to your source code.

 

d). If you were not able to get your own source code converted and running, explain what the difficulties were.