Penn Engineering Homeline
    
ESE Undergraduate Labs
   
arrow General
  Introductory information
spacer spacer
arrow Schedule
  Hours of Operation
Closing Information
Test
spacer spacer
arrow Courses
  Undergraduate courses using the ESE labs
spacer spacer
arrow Instruments
  Devices available in the labs
spacer spacer
arrow Components
  Parts and tools used in the labs
spacer spacer
arrow Datasheets
  Detailed information for lab parts
spacer spacer
arrow PC-Based Hardware
  Data acquisition boards, 6811 boards, board setup...
spacer spacer
arrow Software
  Analog and digital programs, used with the laboratory tools...
spacer spacer
arrow Tutorials
  Learn how to use the hardware
spacer spacer
arrow Links
  Useful links for students and staff
spacer spacer
arrow Staff
  Faculty and lab administrators
spacer spacer

 

 

ESE Undergraduate Labs
RCA LabdividerKetterer LabdividerUndergraduate Robotics LabspacerDolph Simmons Senior Design Labspacer
Motorola 68HC11 Evaluation Board
Setting up the Board

Programming the 68HC11

The M68HC11EVB is an evaluation board for the Motorola 68HC11 microcontroller. For information about the microcontroller refer to the various books by Motorola available in the Undergraduate Laboratory or refer to the book, "Microcomputer Engineering" by Miller or the book, "Microprocessors and Microcomputers: Hardware and Software" by Tocci et al. The following is a step by step tutorial on the M68HC11EVB and its use in the Electrical Engineering Undergraduate Laboratory. Refer to the Evaluation Board User's Manual constantly as a reference in this tutorial. It can also be obtained in the Undergraduate Laboratory.

Setting up the Board

To set up and program the 68HC11, the M68HC11EVB board must first be connected to a personal computer and powered up (p 2-2, User's Manual).

To power up the system, connect the external power connector attached to P4 of the M68HC11EVB board to a 120VAC source.

Connect P2 (P2 is the 25 pin connector furthest from the power connector P4 on the top right hand side of the board) of the board with a serial cable to the COM1 serial port of your computer. This will allow you to program the microcontroller.

Note that when the board is powered up, from Port P1 (on the left side of the board), +5V can be taken from pin 26 and pin 1 will be ground.

Programming the 68HC11

On your PC, make sure that you are in Windows.

Click on Start, select Programs, select Accessories, and choose Hyperterminal. This will open a Hyperterminal window. Open the Hyperterminal Program, hypertrm.exe.

A window may appear asking you if you wish to install a modem. If so, click on NO.

A New Connection window will appear. Type a name for the connection (eg. MC68HC11). Select any icon and then click OK. This will open the Phone Number window. Make sure that the 'connect using' option is set to 'Direct to Com 1'. Click OK.

This will then open the COM1 Properties window. Change the BPS selection to 9600. Keep the default settings for the other options. Click OK.

Press the red button, which is located next to the power connector P4. The following message will appear on the terminal window:

Buffalo 2.5 (ext) - Bit User Fast Friendly Aid to Logical Operation

Press <ENTER>.

A prompt will appear as such:

>

Now the Microcontroller is ready to be programmed.
 
 

To start off with, let us try modifying the memory of a random address $c03c to $e5 (The '$' signifies that the number is in hexadecimal). To do this, type at the command prompt:

mm c03c <ENTER>

The following line will appear:

C03C 00 _

And you will be able to write a 8 bit hexadecimal number at the cursor. Enter a number, say $e5 as such:

e5 <ENTER>

Note that all Hexadecimal alpha values must be in small letters.

This tells BUFFALO to Modify Memory location $103c by changing its contents to $e5. Make sure that you do all programming and memory modifications in locations between $c000 and $dfff which is the User RAM (p5-3, User's Manual). In this manner, it is possible to modify locations in memory of the EVB.

The following is a step by step approach to write and run a simple program to load a number to an accumulator, add a number to it and store the new number in a specific memory address. This is to familiarize you with some very basic commands of the BUFFALO software. Clearer descriptions of the commands can be found on pages 4-6 to 4-34 of the User's Manual.

At the command prompt, type:

asm c000 <ENTER>

You will see the memory address and other information similar to that given below:

C000 TEST

>

The cursor will be just after the indented prompt symbol.

At the prompt, type the following assembly instruction:

LDAA #20 <ENTER>

This will load the number $20 into accumulator A. The following will be displayed underneath the command that you just wrote:

86 20

This is the hexadecimal code for the LDAA command. At the next line, type:

ADDA #20 <ENTER>

This will add the number $20 to the Accumulator A. Again, this will be followed by:

8B 20

Now type:

STAA c020 <ENTER>

This will store the new number in Accumulator A into location $c020.

B7 C0 20 will be displayed.

Press <CTRL> <A> to leave the assembler. Then type:

rm <ENTER>

This will display the contents of some of the special registers of the 68HC11 and allow you to modify the program counter (PC) which is displayed as P:

P-FFFF

Set the value to $c000 and then press <ENTER> as follows:

c000 <ENTER>

We will do a line by line execution of the program. In order to do this, type:

t <ENTER>

The letter t represents the word trace. This will execute the command at the location pointed by the PC. The updated values of the registers will be displayed. You will see that the PC's value is now $c002 and the Accumulator A (A) is now $20. Now repeat the t command. The PC's value is now $c004.

The next command should store this new value, $40 into location $c020. First we will examine the contents of location of $c020. Type:

md c020 c020 <ENTER>

This will display the contents of memory (memory display) in location $c020 as well as the contents of the next 15 memory locations. The contents of $c020 will be right next to the address. You will see that its value is $00. Type the command t again. Now the contents of location $c020 must be reexamined again by typing md c020 c020. You will see that $40 is now in the contents of $c020.

You can clear the contents of the memory by typing:

bf c000 c030 0 <ENTER>

Here bf stands for block fill and will fill memory locations from $c000 to $c030 with $00. You can verify this my retyping the md command:

md c000 c030 <ENTER>

This command will display the contents of the memory from $c000 through $c03f. You will see that all the memory locations from $c000 through $c030 are cleared.

Next, we will write a similar program externally, assemble it and then load the assembled code into BUFFALO. A text editor with a filename followed by the extension '.ASM' needs to be opened; in this example, we will call the file 'test.asm' and use Notepad to write the program.

Click on Start, select Programs, select Accessories, and choose Notepad. This will open Notepad. Type out the following program, making sure to use tabs as given:

mem_loc equ $c020 ; sets the variable 'mem_loc' to $c020

org $c000 ; write program from location $c000

ldaa #$10 ; load accumulator A with value $10

adda #$55 ; add $55 to the contents of A

staa mem_loc ; store value in A to location set by mem_loc

The first column of the program is used for variable name definitions or labels. The second column contains the opcodes or other assembly instructions. The third column contains the data and the fourth contains remarks that are preceded with a semi-colon.

Now from the File menu, select Save As.. At the Save As window, select the appropriate directory to save the file in. In this example, the file will be saved in the directory Sevile that will be in the root directory. Change the Save as type: option to All Files (*.*). Write the file name, test.asm in quotes (note that if you use another file name, it must be a maximum of eight characters long):

"test.asm"

Now click on Save.

You now have your program written and saved in assembly code. To assemble it you must enter MS-DOS by double clicking on the MS-DOS Prompt on your computer's desktop or by selecting Start, then selecting Programs followed by the MS-DOS Prompt. The following prompt will be on your window:

C:\WINDOWS>

Change the directory to MOTOROLA by typing the following commands:

cd .. <ENTER>

This will bring you into the root directory. Now type:

C:\>

Now type:

cd motorola <ENTER>

This will take you to the MOTOROLA directory:

C:\MOTOROLA>

Now that you are in the proper directory, type the following to assemble the program (be sure to replace Sevile with the appropriate directory):

as11 c:\sevile\test.asm <ENTER>

This will assemble your code using the as11 assembler, and place the created machine code into a file with the same file name but with extension '.s19'.

Now, return to the hyperterminal window and load your program. To do this, type:

load t <ENTER>

Select Transfer from the terminal menus and then select Send Text File.. Choose the directory in which your file is stored in (in this case it would be Sevile) and select your file, test.s19. Change the Files of Type: option to All Files (*.*). Now click on Open. The following should appear on your screen:

load t

done

>

Modify the program counter (PC) to begin at location $c000:

rm <ENTER>

Set the value to $c000 and then press <ENTER> as follows:

c000 <ENTER>

This time, instead of doing a line by line execution of the program, we will execute a block of code. In order to do this we will set a break point at location $c004, just before the 68HC11 executes the storage command. Type:

br c004 <ENTER>

To execute this block of program, type g for go:

g <ENTER>

The program will execute until it reaches the break point and the current status of the special registers will be displayed. Now display the contents of location $c020:

md c020 c020 <ENTER>

It can be seen that the location has $00 stored currently. Type the command t:

t <ENTER>

Now the contents of location $c020 must be reexamined by typing md c020 c020 again. The value of $65 should now be in $c020.

The previously inserted break can be removed by typing:

br - <ENTER>

You should now have a basic understanding of the BUFFALO Monitor Program.

 
Go to the Penn Home Page divider Contact Us divider SEAS divider ESE Department spacer spacer
 


University of Pennsylvania - School of Engineering & Applied Science
ESE Undergraduate Labs - 101 Moore Building - 200 South 33rd Street, Philadelphia, PA 19104

This page is maintained and administered by Siddharth M. Deliwala <deliwala_at_ee.upenn.edu>.