The purpose of this lab is to write a few assembly language programs and test them on the simulator and on your EVBU.
As in last week's lab you will write some programs in assembly language and run the programs on the HC12 simulator and the EVBU. To make sure your programs work you will use D-Bug 12 op codes as your input data. There is one problem when running programs on the simulator - D-Bug 12 code which is present in the EVBU is not on the simulator. We can fix this problem by loading D-Bug 12 into the simulator. The following tells you how to do that.
net use e: \\timor\pclibThis will mount a disk which contains an H12 file of D-Bug 12.
Write and run the following programs:
Test your program both on the simulator and the EVBU. Trace through the program on the simulator and observe what happens to the data at address 0x0000. Check that the port PA lines are being toggled on your EVBU. (Use a logic probe to verify that the Port B lines are toggling.)
Check that your program works both on the simulator and the EVBU. Use the following data for your test:
Test your program on the simulator and the EVBU. What is the value of the sum stores at 0x0900?
You can load programs into the on-chip EEPROM. When loaded in EEPROM your program will remain on your HC12 even after turning off power. Before loading your program into EEPROM, you must re-assemble it after modifying your program to start your code at address 0x0D00.
The details of how to download your program into EEPROM are given in the Universal Evaluation Board User's Manual in Appendix E, and are summarized here, with a description of how to make this work with our computers.
clr $16 ; Turn off the COP reset timerLeave the data at address 0x0900. Modify your lkf link file to put the .text section at address 0x0D00.
After the code is in the EEPROM, you can run it in one of two ways - 1) From D-Bug 12, set the program counter to 0x0D00 and `g` (or `g 0D00`); or 2) Move jumper W3 to its other position (position 1), and reset or power-cycle the EVBU. (Note that if you run your program using method 2, you cannot easily re-enter D-Bug 12 to check the results of your program. We will use method 2 in later labs where we won't need to re-enter D-Bug 12 after starting a program.)