1 / 21

ME 4447/6405

ME 4447/6405. Configuring CodeWarrior V5.1 for the HCS12. Connect BDM cable to board (red line of ribbon cable connected to pin 1 of BDM_PORT) Open CodeWarrior IDE on desktop. Click on Create New Project. Choose MC9S12C32 Choose P&E USB BDM Multilink Click “Next”. Check “C”

Download Presentation

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 V5.1 for the HCS12

  2. Connect BDM cable to board (red line of ribbon cable connected to pin 1 of BDM_PORT) Open CodeWarrior IDE on desktop. Click on Create New Project

  3. Choose MC9S12C32 • Choose P&E USB BDM Multilink • Click “Next”

  4. Check “C” • Type in project name and use default location for your project • Click “Next”

  5. Check Create main.c/main.asm file • Click “Next”

  6. Select “None” Click “Next”

  7. Check ANSI startup code • Check Small • Check floating is IEEE32, double is IEEE64 • “Next”

  8. Select “No” Click “Finish”

  9. A new project is created as below

  10. Double click Project.prm file under Linker Files

  11. Change RAM 0x0800 To 0x7FFF Comment “ROM_4000…” line Save the change Change to 0x7FFF Comment out this line

  12. Configuring for External Memory Access • 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;

  13. Double click “main.c” under Sources. This is the source code you will be editing to create your program. • Put the three statements in your main function

  14. #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 */ } • Enter the “Hello World “ code on this page in your “main.c” file

  15. Add stdio and termio to project • Right-click the “Libs” folder in the project pane and select “Add files…” • Add stdlib.h and termio.h files from “C:\Program Files\Freescale\CWS12v5.1\lib\hc12c\include” • Add termio.c file from “C:\Program Files\Freescale\CWS12v5.1\lib\hc12c\src”

  16. Click the green triangle to start the Debugger

  17. Debugger window:

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

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

  20. 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

  21. Output window is shown below. • Don’t open multiple debugger windows, otherwise you’ll see communication error.

More Related