Mccontroler

Páginas: 12 (2848 palabras) Publicado: 12 de agosto de 2012
Laboratory Short Course

Introduction to CodeWarrior™ – Simulating the MC9S08 Microcontroller in C

www.freescale.com/universityprograms

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners © Freescale Semiconductor, Inc. 2006. Document Number: QEACADLABS2S /REV 0

Reading thisDocument
Answers provided to the Instructor assume that the reader is using Freescale Flexis DEMOQE128 development board and CodeWarrior for Microcontrollers 6.0 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

Freescale Semiconductor

1

Overview
Alaboratory experience is vital for us to be able to start programming the microcontroller and to be able to really understand how it works and how to apply it in embedded system designs. This module shows the student how to enter a C program into the CodeWarrior® integrated development environment and then to simulate its execution and search for and find a program error.

Learning Objectives
Inthis module you will start to learn about the CodeWarrior® programming environment. You will see how to start the system and enter a program to be run with the simulator, and you will explore some of the features of the simulator.

Success Criteria
At the end of this module you will be able to compile a C program and to run and debug it with the CodeWarrior True-Time Simulator.Prerequisites
You must have some C or other high-level language programming experience.

More Resources and Further Information
DEMOQE128 User Manual, DEMOQE128UM, Rev. 1.03, P&E Microcomputer Systems, Woburn, MA, May 2007 HC(S)08 Build Tools Reference Manual for Microcontrollers, HC08COMPILERRM, Freescale Semiconductor, Inc., 5/2007 MC9S08QE128 Reference Manual – HCS08 Microcontrollers, MC9S08QE128RM,Rev. 2, Freescale Semiconductor, Inc., 6/2007 Microcontrollers Debugger Manual, CWMCUDEBUGGERRM, Freescale Semiconductor, Inc., 5/2007

Using CodeWarrior®
1. Launch the CodeWarrior IDE. a. 2. 3. From the Windows desktop, click Start > Programs > Freescale CodeWarrior > CW for Microcontrollers V6.0 > CodeWarrior IDE.

Create New Project. Microcontrollers New Project. a. Device and Connection (i)Select the derivative you would like to use: Flexis > QE Family MC9S08QE128. (ii) Choose your default connection: Full Chip Simulation. (iii) Next > b. Project Parameters (i) Check the C language box. (ii) Project name: Type in a project name that makes sense to you. (iii) Location: Click the Set button and browse to a Location for the project. This should be on a drive or in a directory whereyou want to keep your HCS12 projects. (iv) Next > c. Add Additional Files

Freescale Semiconductor

2

(i)

Uncheck Copy files to the project.

(ii) Check Create main.c/main.asm file. (iii) Next > d. Processor Expert (i) e. Rapid Application Development Options: Check None. (ii) Next > C/C++ Options (i) Check ANSI startup code. (ii) Check Small memory model. (iii) Check None for floatingpoint format. (iv) Next > f. PC-Lint (i) Check No. (ii) Finish

In the Project Manager Window 4. Ensure Full Chip Simulation is to be used. If Full Chip Simulation is not shown, switch to the Simulator for debugging by clicking the pull down arrow and selecting it. (This does not use the hardware for debugging. If you want to actually use the MC9S08 hardware, choose P&E Multilink/Cyclone Pro orother hardware interface connection.)

5.

Create listing files by opening the Standard Settings … panel by clicking the icon shown above. a. b. Click on + next to Target in the Target Settings. Highlight Compiler for HC08 and in that panel click on Options and then on Output. (i) c. Check Generate a listing file. (ii) Click OK. Click OK.

6. 7.

Open the Sources folder (click on the +...
Leer documento completo

Regístrate para leer el documento completo.

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS