Docstoc

Computer-Architecture

Document Sample
Computer-Architecture Powered By Docstoc
					Computer Architecture ELEC1099/ELEC2199

Getting Started with the ICS05B Development Kit

Getting Started with the ICS05B Development Kit

De Montfort University Faculty of Computing Sciences and Engineering
This is a brief guide that explains the main steps involved in using the ICS05B development kit. ICS05B is a set of programs that allows you to design and test programs for Motorola M68HC05 microcontrollers. Testing the software is carried out either by simulation on a PC or by running and debugging the programs in the microcontroller itself. First start the WinIDE Development Environment from the Start menu. Then open a new file from the File menu of this program (see Figure 1). The application program you develop can now be typed in the white window opened by the New File command. Figure 2 presents a small program that you can use in order to explore the facilities of this software. The program contains a data segment and a code segment. The data segment defines a two-byte variable alpha placed at address 50 in the RAM memory of the microcontroller. The code segment starts at address 100 and contains only a few simple instructions. First the accumulator is initialised with the hexadecimal number 10 and then this number is stored into the memory both at address 50 and at address 51. Subsequently, the content of the accumulator is incremented. The incrementing and the writing to the memory writing operations are part of an infinite loop so that they are repeatedly performed until the program is stopped by the user. The program has to be assembled by pressing the button indicated in Figure 3. Some programs (as in this example) contain syntax errors. The errors are pointed out at the assembly stage by highlighting the program lines containing them. The highlighted instruction in Figure 4 contains an incorrect mnemonic (acronym). There is no instruction ld recognised by the controller. Therefore replace the mnemonic ld by lda and try to assemble the program again. Now the program does not contain any other errors and the assembly process can be successfully finished. The program operation can be

Figure 1 – Opening a new edit window

Figure 2 – The program edit window

Figure 3 – Starting the assembly

Figure 4 – Highlighted error in the program

1

Getting Started with the ICS05B Development Kit

tested by pressing the button indicated in Figure 5, which starts a component of the ICS05B named “debugger”. The assembly of the program (that is the translation into machine code) detected the syntax errors of the program. The debugging stage allows you to detect any logical errors in the program. In other words, it helps check if the program really does what you expect it to do. If the computer is not connected to an application board or there is a communication problem then the window illustrated in Figure 6 will come up on the screen. In this case you can either try using another COM port or simply start the debugger in the simulation mode by pressing the appropriate button. For this introductory example, the simulation mode is enough.

Figure 5 – Starting the debugger

Figure 6 – Choosing a communication port

Figure 7 – The debugger windows The debugger opens a whole new set of windows (Figure 7) that describe different aspects of the microcontroller operation when running the application program. To start running the program the program counter register (PC) has to be initialised with the address of the first instruction in the code segment. To do this, you simply have to double-click on the current value of this register. The content of all the microcontroller registers are shown in the bottom-left window of the debugger (Figure 7 and Figure 8). When double-clicking the register value, a new window is opened where you can insert a new value (Figure 9). Insert the number 100, which is the address of the program code. The selection bar in the “Disassembly” window will jump to the first instruction in the program as shown in Figure 10. Note that the Disassembly window is part of the debugger set of windows. The selection bar always shows the next instruction to be executed by the microcontroller. Therefore, the controller is now ready to start running your application.

Figure 9 – Changing the program counter Figure 8 – The register window The program can be run in a step-by-step manner by pressing the first arrow in Figure 11. You can also run multiple steps of the program using the next two arrow buttons. The last arrow button in Figure 11 stops the multiple step operation allowing you to inspect the values stored in the registers and in the memory. The memory content is shown in the so-called “Memory Window” which is the top-right windows displayed by the debugger (Figure 7 and Figure 12).

2

Getting Started with the ICS05B Development Kit

NOTE 1: The memory locations that show Xs instead of definite values are uninitialised locations. If you try to run programs from uninitialised addresses, an error will occur.

Figure 10 – The disassembly window

Figure 11 – Important buttons in the debugger window

Figure 12 – The memory window NOTE 2: You can close the debugger and switch back to the program editor by pressing the first button in Figure 11. There you can modify the initial program, assemble it again and restart the debugger.

3


				
DOCUMENT INFO
Shared By:
Tags: Compu, ter-A
Stats:
views:180
posted:11/27/2009
language:English
pages:4
Description: Computer-Architecture