
- •Acknowledgments
- •About the Author
- •1.1 Basic Computer Structure
- •1.3 A Few Instructions and Some Simple Programs
- •2 The Instruction Set
- •3.1 Op Code Byte Addressing Modes
- •4.2 Assembler Directives
- •4.3 Mechanics of a Two-Pass Assembler
- •4.6 Summary
- •5.1 Cross Assemblers and Downloaders
- •5 Problems
- •6.3 Passing Arguments by Value, Reference, and Name
- •7 Arithmetic Operations
- •7.2 Integer Conversion
- •8 Programming in C and C++
- •8.1 Compilers and Interpreters
- •9 Implementation of C Procedures
- •9.2 Expressions and Assignment Statements
- •9.4 Loop Statements, Arrays, and Structs
- •10 Elementary Data Structures
- •10.1 What a Data Structure Is
- •11.4 Synchronization Hardware
- •12.4 The 68300 Series
- •A2.1 Loading HiWare Software
- •A2.2 Opening the HiWare Toolbox
- •A2.3 Running Examples From the ManualProgramFolder
- •A2.6 POD-Mode BDM Interface
- •Index
Appendix 2
Using the HiWare CD-ROM
A2.1 Loading HIWARE Software
You can use the software on the enclosed CD-ROM to simulate your programs on a PC running Windows 95 or later, or Windows NT 5.0 or later, without using any extra hardware. You can also use this software with a real target microcontroller, so you can collect data from external hardware, and control external hardware. Open the CD-ROM, check "setpe.exe", and choose the Motorola HC12 target. If you have 60 megabytes of disk space, load all parts of the tool chain.
A2.2 Opening the HIWARE Toolbox
You can open the HIWARE Toolbox in at least two ways, depending on how HIWARE was installed. The best way is to click on the Start icon, to the Programs item, to the HIWARE item, to HC12 Projects item, to either ManualProject item or AssemblerProject item. This should open the toolbox for this book's experiments.
Another way to open the HIWARE Toolbox is to click on the Start icon, to the Programs item, to the HIWARE item, to the HIWARE TOOLS item. When the tool bar appears, click on its leftmost icon (the one with the picture of three pages and a pencil) to open a dialog box. In that dialog box, click on the Open., icon. Click on folder and files names to find and select one of the folders described below. Then click on OK in the inner box, and the outer box. If a dialog box appears to confirm that you change the project, click on OK. This should open the toolbox for experiments in this book.
The folder ManualProgramFolder in the HIWARE folder provides examples of programs in the first three chapters of the book. These examples use just the HIWARE debugger applicaton. The folder AssemblyProgramFolder in the HIWARE folder provides examples of programs in the remaining chapters of the book. These examples use the NOTEPAD text editor, the HIWARE assembler and the HIWAVE debugger. You can also use other text editors such as WinEdit,in place of NOTEPAD, to generate source code for the assembler.
A2.3 Running Examples From the ManualProgramFolder
ManualProgramFolder has files which contain examples from this text book that you can load and run on the HIWAVE simulator, or download and run on the target machine. The file p.ll.abs contains machine code for an example on page 11, which is Figure 1.5. Similarly, p.lSa.abs is the example on the top of page 13, Figure 1.8. Click on the HIWAVE icon in the HIWARE toolbox. After HIWAVE starts, load an example by pulling the Simulator menu to the Load., item. Select the file for the example, such as p.ll.abs. First, double-click on the box next to SP in the Register window, and type a suitable stack pointer value such as hexadecimal AOO (just press the keys A, 0, and 0, and Enter), Then single-step though the program to learn how it works. You can single-
387


Appendix! Using the HIWARE CD-ROM |
389 |
toolbox. Type the source file's name, Program.asm, in the assembler's top center window. If the file name is already in the window, instead of retyping the file name, click on the icon immediately to the right of this window. The status of the assembly, including error messages, is output into the bottom window. When you have no errors, the Program.abs file is written. Program.abs can then be simulated as in §A2.3.
A2.5 Downloading to a 'B32 Board
You can use the HIWARE software to download and debug a program in a file, such as p.1Labs or program.abs, on the Motorola M68HC12B32EVB board as your target. Before you attempt to run your first program on a target, you should begin by simulating the program on the HIWAVE simulator, as in §A2.4. After you are comfortable with the simulator's operation, you should run it on actual hardware. First, make sure that W3 and W4 are in their 0 position to configure the board for EVB mode. Then connect the target's DB-9 connector to the personal computer COM! port. Apply 5 volt power to the target. You should always apply the 5V power after all connections are made, and you should never change a connector while power is applied to the 'B32 board. Pull the Component menu to the Select_Target item, which brings up a dialog box. In that box, select the Asciimon target name. (If COM1 is not available, use another COM port, but change HIWAVE's communictations by pulling the Monitor menu to the Communication item, and change the port in the dialog box that appears).
HIWAVE behaves the same when used as a downloader/debugger as when used as a simulator. Follow §A2.4's procedures to run an example on the target microcontroller.
Having changed HIWAVE from a simulator to a downloader/debugger, you can pull the File menu to the Save Project item and release. This will save the current configuration so that when you restart HIWAVE it will start as a downloader/debugger, and you won't have to repeat the above procedure each time you use HIWAVE as a downloader/debugger. To change HIWAVE back to a simulator, pull the Components menu to the Set Target item, and click on the Sim entry.
A2.6 POD-Mode BDM Interface
You can run your program on a target, such as an Technological Arts Adapt-812 board, or an Axiom PB68HC12A4 board. This technique utilizes the state-of-the-art background debug module BDM in your target, providing a debugger that runs in the M68HC12B32EVB board (called the POD) that is isolated from the target.
Begin by running a program on the HIWAVE simulator, and then running it on the 'B32 board, as described in §A2.5. After you are comfortable with the simulator's and 'B32 board's operation, reconnect the W3 to its 0 position and W4 to its 1 position to configure the board for POD mode, and reset the POD. Plug the 6-wire cable into the POD's Wll connector and the target's BDM connector. Match pin 1 with the cable/connector pin 1. Restart HIWAVE. You should be able to duplicate what you did In the 'B32 board, nmning it on the Adapt-812 or PB68HC12A4 board as a target. You
