DOC PREVIEW
USC EE 459Lx - CodeWarrior-ASM

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Ming Hsieh Department of Electrical EngineeringEE 459Lx - Embedded Systems Design LaboratoryProgramming the Freescale MC908JL16 in Assembly Language(for CodeWarrior V6.x)byby Allan G. Weber1 IntroductionThis document discusses the use of the CodeWarrior for Microcontrollers, Special Edition software for pro-gramming the Freescale HC08 microcontrollers in assembly language. Much if this document is generic andapplies to any processor in the HC08 family. However parts that discuss things like memory layout arespecific to the processor currently being used in the class. The class is currently using the MC908JL16(sometimes listed as MC68HC908JL16.) If the CodeWarrior compiler is used for other HC08 processors theinformation in these areas will have to be adjusted to match the other processor.2 Installation InstructionsThe CodeWarrior installation software can be obtained from the instructor if you wish to install the softwareon your own system. It should run on any Windows XP or Windows 7 system. To install the software:• Copy the installation file to your hard drive. Depending on the version it will have a name like“CW_MCUs_V6_3.exe”.• Double-click on the file you just copied. There may also be some patch or updates file with it.• Proceed through the series of questions and agreements posed to you. The program will try to installitself under the Program Files folder of your C drive. Feel free to change that if you desire. When youare asked what type of installation you desire, choose “Complete”.• If there are any update files these can also be installed.• After the installation is complete, reboot your system.The CodeWarrior application can be found in the Start menu under “All Programs”, “Freescale Code-Warrior”, “CW for Microcontrollers V6.x”, “CodeWarrior IDE”. You should now be ready to run the Code-Warrior development system to create software for your microcontroller.3 Starting a New ProjectIn order to create a program for your microcontroller, you must first have CodeWarrior create a project. ACodeWarrior project is a folder that contains all the necessary files and configuration information to buildthe project. Start CodeWarrior from the desktop icon or the Start menu and follow these steps.• File. . . New Project. . . . This will bring up the new project wizard to gather information about yourproject.EE 459Lx, Rev. 5/29/13 1• On the Device and Connection screen select the microcontroller you will be using. For most of theclass projects it should be the MC68HC908JL16. Open up the “HC08” list and then open the “JK/JLFamily” list. Click on the microcontroller being used.In the “Connections” box, select “P&E Multilink/Cyclone Pro” if you will be using the USB program-ming hardware, or “Mon08 Interface” to use the Freescale development boards. See Sec. 9 for moreinformation on the programming hardware. Click “Next”.• On the Project Parameters screen, select the programming language. Select “Relocatable assemby”and deselect the other languages. Type a project a name in the text box. CodeWarrior will create afolder of this name under your “My Documents” folder or you can change the location. Click “Next”.• On the Add Additional Files screen you can add source files to the project (this can also be done later.)Select the files to add and then click on “Add”. If the “Copy files to project” button is selected thefiles will be copied into the “Sources” folder in the project folder the new project wizard is creating.Use this option if you are going to create your project by modifying one of the demo or template files.If this option is not selected, the source files are left in their original location.One file in the project must contain the starting point of the program. If the “Create main.c/main.asmfile” box is checked, CodeWarrior will add a main.asm file to your project containing this entry point.You can later edit this file to add your own code. Alternatively you can uncheck the main.asm box andadd your own file that contains a entry point. This method is easier if you are copying a main programfrom some other project. However it is done there must be one, and only one, file that contains thestarting point. Click “Next”.• On the Processor Expert screen, select “None” when it asks about Rapid Application DevelopmentOptions. Click “Finish”.At this point CodeWarrior will create the project folder and bring up the project window.4 Navigating Through Your ProjectAfter CodeWarrior creates your project you will see the project window as shown in Figure 1. In the left-handwindow pane you will see a folder structure for the files that are part of your project.• The “Sources” folder contains your source files. In that folder you should see the files you asked to beadded to your project. If you didn’t add any and selected the option to have CodeWarrior create amain.asm it will show up here and you can either edit main.asm or replace it with another file. If youchoose to replace it, use the “Remove” command under the Edit menu to delete main.asm from theproject, then use the “Add Files” command under the Project menu to add a different main programfile. Other ASM files can also be added to the project. Double-clicking the file will open it in theCodeWarrior editor.• The “Includes” folder contains files specific to model of microcontroller you are using. Your programshould reference the “derivative.inc” file which then references the correct include file for your micro-controller. These files declare variable names you can use to read and write the internal registers ofyour microcontroller. It also defines bit names that allow you to read, set, or clear any bit in one ofthe internal registers. You should use these variables rather than trying to create your own system ofaddressing the internal registers.• The “Linker Files” folder, contains files used the CodeWarrior program to compile and link yourprogram. The only file you should be interested in is the “.prm” file that specifies the overall memorymap of your program and also provides the ability to register your interrupt service routines (ISR’s).Initially a new project has a file named “Project.prm” in this folder. As with the main ASM programfile, you can either edit this file or remove it and replace it with another. See Sec. 6 for more information.EE 459Lx, Rev. 5/29/13 2Figure 1: New


View Full Document

USC EE 459Lx - CodeWarrior-ASM

Download CodeWarrior-ASM
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CodeWarrior-ASM and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CodeWarrior-ASM 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?