CSE477 Laboratory Assignment #1
Introduction to the M68HC11EVB: Using the Evaluation Board to Debug Microcontroller
Programs
Assigned: 4 January
Due: 14 January
Objectives:
When you have completed this lab, you should know how to:
-
Power up your evaluation board and connect it to an NT machine,
-
Enter and debug simple assembly language programs using the monitor program
on the evaluation board,
-
Download S-records generated by an assembler from an assembly language
program,
-
Use a microcontroller to output a digital signal.
-
Enter and debug simple C language programs using the monitor program on
the evaluation board.
-
Familiarization with the counter/timer unit of the 68HC11 microcontroller,
-
Use most of its input capture and output compare facilities,
-
Use basic interrupt handling capabilities, and
-
Understand the structure of data conversion routines.
Reading:
Other relevant links:
Part 1: Powering up the EVB and connecting it to the PC
You will need to supply power to the evaluation board through the power
supply connected to your protoboard. Four lines are needed: +12, -12, +5,
and GND. The supply lines are clearly marked on the power supply name plate
and the EVB. Make sure they are connected properly before plugging in the
power supply. GND and +5 are used to power the microcontroller and other
digital circuitry on the board. The +12 and -12 supplies are used for the
RS-232 logic levels. (If you exchange +12 and -12, or +12 and +5, or even
+5 and GND, some damage will occur to the EVB. Don't do this. You will
be responsible for this sort of damage.)
The serial line from the PC should be connected to the terminal port
on the EVB (the RS-232 connector furthest away from the red reset button,
this is marked terminal on the PCB) To communicate with the EVB, run hyper_terminal.
From the drop down menu choose File->New connection. A "connection description"
window appears, give a name for the connection, click OK. A "connect to"
window appears, on box "connecting using" choose com1 or com2 depending
up on the connection, click OK. A "property" window appears, in this choose
the baud rate to be 9600, click OK. Now a connection under the above name
is created.
Now plug in the power supply, and press the red reset button on the
EVB. A prompt should be sent to the terminal program and displayed on the
PC's screen. It should read:
BUFFALO 2.5 (ext) - Bit User Fast Friendly Aid to Logical Operation
Pressing return twice should list a bunch on commands that the EVB and
BUFFALO can be asked to perform.
Part 2: BUFFALO Tutorial
Read Section 4.7 of your EVB user manual. Type in the assembly
code on pages 4-27 and 4-28. Then issue the commands lists on page
4-29. (Remember to connect Pins 20 and 21 together on connector P1. This
connects the TxD and the RxD lines of the SCI together. The example program
will not work correctly if this connection is not made.)
Part 3: Assembly Language Program
Devise an assembly language program to turn a port bit on and off with
a cycle period of one second. I suggest using port bit PB0. To get started,
download the following sample program to the EVB. It just turns on this
port bit. Then modify it for your needs. Make sure that there is a tab
before each of the instructions below.
ORG $C000
LDAA #$01
STAA $1004
Type this program in using notepad and run the assembler that is
located at U:\cse477\buffalo\as11.exe. (U should be mapped to
\\ifilesrv1\courses) Run the assembler using the file manager's RUN command
and the assembly program's name as its only argument. To load the assembled
file to the EVB, you need to perform a text transfer using the terminal
emulator. First type
LOAD T
at the BUFFALO prompt and then pull down the Transfers->Send Text File
panel. Select the file generated by the assembler (it has the extension
.S19) and click the OK button. Your program should now be loaded into the
EVB. Press the red reset button to restart BUFFALO. (Note: its not clear
why you need to reset in order to start running the program but this seems
to be the only way to get things to work.)
To actually run these two instructions, first set a breakpoint after
the last instruction (use the BR C005 command) and then enter
G
C000. You should be able to observe that PB0 is now set to 1 with
your logic probe. The other bits of port B should all have been cleared
to a logic 0.
Part 4: C Language Program
Read the information from a previous quarter's cse477 project. The
SmallC compiler project will help you get started in compiling and
running simple C programs. You need to work through the following sections
of C language code. Part 1, Part 2,
and Part 3 are the C code fragments that you need to
run. The corresponding assembly code is a little difficult to follow at
first, but can also be ran. "EX10.asm" is the assembly
file you will need to run. If you start by working through the assembly
code and understand how the microcontroller is executing the assembly,
then following the corresponding C language code will be very easy to understand.
However, you are free to start with the C code and not spend much time
looking at assembly if you choose. Knowing the assembly is not required
for this part of the lab. The assembly code is described through out Chapter
10 of the MC68HC11 Reference Manual (the thicker pink manual).
Some important links to help you in programming your microcontroller:
-
More information on "EX10.asm".
-
Notes for the 68HC11EVB.
-
Notes for SmallC compiler.
-
Reference to the implementation of the SmallC libraries
used in Part 1-3.
-
Part 1 demonstrates measuring long periods using interrupts and
the Timer Over Flow interrupt handler.
-
Part 2 requires the user to enter a half-cycle delay at $D000 and
$D001 using memory modify (MM) before the program is executed. The output
compare function is handled with interrupts. Compare how this is done both
in the C program and in the assembly program.
-
Part 3 produces two pulse width modulated signals. It also requires
the user to set three values before executing the program. It's important
to note that OC1 is used to schedule and time signals out of OC2 and OC3.
However, OC2 and OC3 control their own output levels.
What to Turn In
Turn in the assembly program that makes the port bit turn on and off with
a cycle period of one second.
Demonstrate the execution of the C programs to the TA. Please make
sure to allow time for this.
Comments to: cse477-webmaster@cs.washington.edu
(Last Update: )