1 / 21

ME 4447/6405

ME 4447/6405. Configuring CodeWarrior for the HCS12. Open Freescale CodeWarrior IDE. File…New to start a new project. Select the HC(S)12 New Project Wizard Choose a name and default directory location for the project files. Select the device “MC9S12C32” Click “Next”. Check “C”

lavi
Télécharger la présentation

ME 4447/6405

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ME 4447/6405 Configuring CodeWarrior for the HCS12

  2. Open Freescale CodeWarrior IDE. File…New to start a new project.

  3. Select the HC(S)12 New Project Wizard Choose a name and default directory location for the project files

  4. Select the device “MC9S12C32” Click “Next”

  5. Check “C” Click “Next”

  6. Select “No” for Processor Expert Click “Next”

  7. Select “No” Click “Next”

  8. Select “ANSI Startup” Click “Next”

  9. Select “float is IEEE32, double is IEEE64” Click “Next”

  10. Select “Small” for the memory model

  11. Check the box next to “P&E Multilink/Cyclone Pro” Click “Finish”

  12. In the project files shown expand the “Prm” folder and double click on “P&E_Multilink_cyclonePro_linker.prm”

  13. This file tells the compiler how to allocate memory. At the top of the file you will see the RAM variable defined from $0800 to $0FFF, corresponding to the locations of internal RAM. Change $0FFF to $7FFF. This expands the RAM region to include external RAM. Also, we are not using the Flash EEPROM region “ROM_4000,” so comment out that line by placing “//” at the start of the line. If external RAM is to be used, the MODE, MISC, and PEAR registers must be modified to configure the HCS12 in Expanded Wide Mode and to , MODB, and ROMHM bits may need to be changed. We’ll do this at the start of our source code. Change to 0x7FFF Comment out this line

  14. Configuring for External Memory Access • The “Sources” folder in the project pane contains “main.c”. This is the source code you will be editing to create your program. In order to configure the microcontroller for external memory access, you need to put the following three statements at the start of your “main” function before any other statement (but after any variable definitions). MISC = 0x03; PEAR = 0x0C; MODE = 0xE2;

  15. Complete the Example Program • Enter the code on this page in your “main.c” file #include <hidef.h> /* common defines and macros */ #include <mc9s12c32.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12c32" #include <stdio.h> #include <termio.h> voidmain(void) { MISC = 0x03; PEAR = 0x0C; MODE = 0xE2; TERMIO_Init(); //Initializes the SCI subsystem puts("Hello, World!\n"); //Prints the string to the screen for(;;) {} /* wait forever */ /* please make sure that you never leave this function */ }

  16. Add stdio and termio to project • Right-click the “Libraries” folder in the project pane and select “Add files…” • Add the three files shown located in “C:\Program Files\Freescale\CW for HC12 V4.5\lib\hc12c\include” and “C:\Program Files\Freescale\CW for HC12 V4.5\lib\hc12c\src”

  17. Double-click on termio.c In the window that opens, make the change the “0” to “1” as shown below. Edit termio.c This was a “0”

  18. Click the green triangle to start the Debugger

  19. In the Debugger window, select the MultilinkCyclonePro menu • Choose “Debugging Memory Map…” • Select the third listing for the RAM and click “Modify/Details”

  20. Change the End field to 7FFF and click OK • Then close the window

  21. Connect The serial cable to COM1 and start AxIDE • Click the Green Arrow to begin execution of your program • “Hello, World!” should appear on the screen

More Related