Using the ImageCraft "ICC12" C Compiler

PURPOSE:

STEPS:
  1. We "will" compile the modified code,

    (REF): MC68HC12:An Intro S/W and H/W Interfacing, Han-Way Huang, THOMSON/Delmar Learning, 2003, chap 5.

    //FILE: gcd2.c #include <stdio.h> #include <putchar_dp256.c> int gcd(int a, int b); void main (void) { int x, y, result; x = 3600; y = 1500; result = gcd(x, y); printf("The gcd of %d and %d is %d\n", x, y, result); return; } int gcd(int a, int b) { int i, temp; if (a > b) { temp = a; a = b; b = temp; } if (a == b) return a; if (a == 1) return 1; temp = 1; for (i = 2; i <= a; i++) { if (((a % i) == 0) && ((b % i) == 0)) temp = i; } return temp; }

  2. First setup the Compiler Options by.

    Start ICC12, click "Project" menu to drop down, select "Options".

  3. Setup the include & library path,

    Check language and select output format,

    Select "9S12DP256 12K RAM mode" for DRAGON 12 as target. We only illustrate EVB mode of D-Bug12 monitor.

  4. Create New Project, in simplified notation: Project > New
    Type "gcd2.prj" as the project name. On the Project navigation right window, right click & select add files: "gcd2.c" into the "Files" folder.

    Result,

  5. To compile do: Project > Make Project

  6. Edit and repeat above until no errors,

  7. Testing on DRAGON 12,

    Open the terminal,

    Click "Open Com Port" button,

    Click "Browse" button for "gcd2.s19", "Open" it.

    Connect RS232 cable between PC and DRAGON 12. Power-up the board. Press RESET on DRAGON 12, type LOAD, enter "gcd2.s19", hit RETURN on PC keyboard. Type G 1000 to execute.