Reading this Document Answers provided to the Instructor assume that the reader is using <strong>Freescale</strong> HCS12C Family Student Learning Kit, and CodeWarrior development software. This short course has been created using an adapted version of the Process Oriented Guided Inquiry Learning (POGIL) method. For more information visit www.pogil.org <strong>Freescale</strong> Semiconductor LABS12CINTRO03S, Rev 1 1
Overview A laboratory experience is vital for us to be able to start programming the microcontroller and to be able to really understand how it works and to apply it in embedded system designs. This module shows the student how to enter an assembly language program in the CodeWarrior® integrated development environment and then to simulate its execution using the True-Time simulator/debugger. Learning Objectives In this module we introduce you to the CodeWarrior® programming environment. We will see how to start the system and enter a program to be run with the debugger. In the next module we will give you a program and you will start to learn to use the HCS12 instruction set by modifying if to change how it operates. Success Criteria At the end of this module you will be able to assemble a program and to run and debug it with the CodeWarrior simulator/debugger. Prerequisites You must know about the HCS12 instruction set and the memory addressing modes available. You do not have to know the instruction set in detail. <strong>The</strong> following lab modules will help you learn that. More Resources and Further Information Cady, Fredrick M., Software and Hardware Engineering: Assembly and C Programming for the <strong>Freescale</strong> HCS12 Microcontroller, 2 nd edition. (New York: Oxford University Press, Inc., 2008). Chapter 5 An Assembler Program, Chapter 6 <strong>The</strong> Linker, Chapter 7 <strong>The</strong> HCS12 Instruction Set. Smart Linker, Metrowerks Corporation, Austin, TX, 2003. Debug (DBG) Module V1 Block User Guide, S12DBGV1/D, <strong>Freescale</strong> Semiconductor, 2003. MC9S12C128 Data Sheet: Covers MC9S12C Family and MC9S12GC Family, <strong>Freescale</strong> Semiconductor, Austin, Texas, 2005. Montañez, E. and Ruggles, S., MCUSLK_CSM12C32 - Getting Started with the Microcontroller Student Learning Kit (MCUSLK), <strong>Freescale</strong> Semiconductor, Austin, Texas, 2005. Sibigtroth, J. M., CPU12RM/AD rev. 3 <strong>–</strong> CPU12 Reference Manual, <strong>Freescale</strong> Semiconductor, Austin, Texas, 2002. Williams, J., AN2548SW1 <strong>–</strong> CodeWarrior Project Software files for AN2548/D, <strong>Freescale</strong> Semiconductor, Austin, Texas, 2003. Debugger HCS12 Onchip DBG Module User Interface, Metrowerks, 2003. Using the CodeWarrior® Simulator 1. Launch the CodeWarrior IDE. a. From the Windows desktop, click Start > Programs > <strong>Freescale</strong> CodeWarrior > CW for HC12 Vx.x > CodeWarrior IDE. 2. Create New Project. a. From the IDE main menu bar, select File > New. New window appears. b. Highlight HC(S)12 New Project Wizard. c. Enter a Project Name that makes sense to you (like lab_x). d. Enter a Location for the project. This should be on a drive or in a directory where you want to keep your HCS12 projects. e. Click OK. 3. In the New Project Wizard Page 2: Select MC9S12C32 (or your derivative) as the derivative you want to use and click Next. <strong>Freescale</strong> Semiconductor LABS12CINTRO03S, Rev 1 2