Presentation is loading. Please wait.

Presentation is loading. Please wait.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Configuring CodeWarrior V5.1 for the HCS12.

Similar presentations


Presentation on theme: "George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Configuring CodeWarrior V5.1 for the HCS12."— Presentation transcript:

1 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Configuring CodeWarrior V5.1 for the HCS12

2 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 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 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Choose MC9S12C32 Choose P&E USB BDM Multilink Click “Next”

4 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Check “C” Type in project name and use default location for your project Click “Next”

5 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Check Create main.c/main.asm file Click “Next”

6 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Select “None” Click “Next”

7 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Check ANSI startup code Check Small Check floating is IEEE32, double is IEEE64 “Next”

8 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Select “No” Click “Finish”

9 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 A new project is created as below

10 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Double click Project.prm file under Linker Files

11 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Change RAM 0x0800 To 0x7FFF Comment “ROM_4000…” line Save the change Change to 0x7FFF Comment out this line

12 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 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 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 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 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Enter the “Hello World “ code on this page in your “main.c” file #include /* common defines and macros */ #include /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12c32" #include void main(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 */ }

15 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 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 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Click the green triangle to start the Debugger

17 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Debugger window:

18 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 In the Debugger window, select the HC12MultilinkCyclonePro menu Choose “Debugging Memory Map…” Select the third listing for the RAM and click “Modify/Details”

19 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Change the End field to 7FFF and click OK Then close the window

20 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 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 George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Output window is shown below. Don’t open multiple debugger windows, otherwise you’ll see communication error.


Download ppt "George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Configuring CodeWarrior V5.1 for the HCS12."

Similar presentations


Ads by Google