EMCH 367 Fundamentals of Microcontrollers Lab 1

LAB 1 - BASIC PROGRAMMING

OBJECTIVE

The objective of this lab is to develop basic programming skills in direct contact with the Motorola 68HC11 microcontroller unit (MCU).

PREREQUISITES

Floppy disk with the asm codes

Hard copy (printout) of Hmwk1 Hmwk2, Hmwk 3. When printing, use the 'pages per sheet' option in the lower right corner of the print dialog-box with settings of 4 or 2 (depending on your eyesight) to save paper. (We may want to experiment a little with this before printing the full document.)

PROCEDURE

The students will utilize the asm code developed with the THRSim11 simulator for Hmwk1 and Hmwk2. The students will go through their Hmwk1 and Hmwk2 step by step and will find how the MCU responds to their instruction. The lab is divided into sections. After completing each section, the student will ask the TA to check the student’s work and make a check mark on that section.

The asm code is compiled and downloaded into the MCU through the MiniIDE terminal emulator software. The same software allows to correct/modify/re-save the code as the need arises. When using the MiniIDE, the following procedure is used to 'activate' your program in the MCU:

a) Verify that the power supply is active, and that the MCU is connected to the power supply

b) Open the MiniIDE program

c) Connect it to the processor using the menu item ‘Terminal connect/disconnect’ button.

d) Open your asm program from the floppy disk

e) Compile your asm program

f) Type “LOAD T” in the terminal window and press enter. Download the S19 code of your program to the MCU using the 'Download' button

g) Type the BUFFALO command RM in the command window. Verify that the program counter (PC) is set to the value $C000. If not, set it to $C000.

h) Reset accA and accB by typing 0 at the command prompt

j) To step through the program, use the BUFFALO command T

k) To run the program, use the BUFFALO command G, with the starting PC (e.g., $C000)

Hmwk 1 -- Exercise 1

Activate your LASTNAME_Firstname_Ex1.asm file.

Step through the program and compare what you see happening in PC, accA, accB with your predictions from Exercise 1.

When satisfied with your results, call your TA and demonstrate.

TA checkmark ______

Hmwk 1 -- Exercise 2

Activate your LASTNAME_Firstname_Ex2.asm file.

Step through the program and compare what you see happening in PC, accA, accB with your predictions from Exercise 2.

When satisfied with your results, call your TA and demonstrate. TA checkmark ______

Hmwk 2 -- Exercise 3-7

Activate your LASTNAME_Firstname_Ex3-7.asm file. Step through the program and compare what you see happening in PC, accA, accB with your predictions from Exercise 3-7.

Note that when decimal numbers are specified in the asm code, their hex equivalent are actually loaded. Verify the conversion with your pocket calculator. When satisfied with your results, call your TA and demonstrate.

8+7=15 TA checkmark ______

$08+$07=$0f TA checkmark ______

9+9=18 TA checkmark ______

$09+$09=$12 TA checkmark ______

12+29=41 TA checkmark ______

$0c+$1d=$29 TA checkmark ______

$ff+$01=$00 TA checkmark ______

255+1=0 TA checkmark ______

Hmwk 2 -- Exercise 8-9

Activate your LASTNAME_Firstname_Ex8-9.asm file.

Step through the program and compare what you see happening in PC, accA, accB with your predictions from Exercise 3-7.

Note that when decimal numbers are specified in the asm code, their hex equivalent are actually loaded.

When satisfied with your results, call your TA and demonstrate.

8-1=7 TA checkmark ______

$08-$01=$07 TA checkmark ______

20-1=19 TA checkmark ______

$20-$01=$0f TA checkmark ______

$00-$01=$ff TA checkmark ______

0-1=255 TA checkmark ______

$0f-$07=$08 TA checkmark ______

$00-$07=$f9 TA checkmark ______

0-7=249 TA checkmark ______

$0f-$2b=$e4 TA checkmark ______

15-43=228 TA checkmark ______

Hmwk 3 -- Exercise 10

Activate your LASTNAME_Firstname_Ex10.asm file.

Step through the program and compare what you see happening in PC, accA, accB with your predictions from Exercise 3-7.

Note that when decimal numbers are specified in the asm code, their hex equivalent are actually loaded.

When satisfied with your results, call your TA and demonstrate.

i) one through seventeen TA checkmark ______

ii) 5+4=9 TA checkmark ______

iii) 15-7=8 TA checkmark ______

iv) $1f+$01=$ TA checkmark ______

v) $20-$01=$ TA checkmark ______

vi) $ff+$01=$ TA checkmark ______

vii) $00-$01=$ TA checkmark ______

viii) 0 AND 1 = TA checkmark ______

ix) 0 OR 1 = TA checkmark ______

x) 0 XOR 1 = TA checkmark ______

xi) 1 OR 1 = TA checkmark ______

xii) 1 XOR 1 = TA checkmark ______

xiii) %00000000 NAND %11111111 = % TA checkmark ______

xiv) %11111111 NOR %00000000 = % TA checkmark ______

xv) %10101110 AND %00001000 = % TA checkmark ______

(This page is intentionally left blank)

Dr. Victor Giurgiutiu Page 375 8/17/2005

EMCH 367 Fundamentals of Microcontrollers Lab 1

Dr. Victor Giurgiutiu Page 1 6/13/2005