Dragon-12P tutorial

 

This tutorial will guide through the steps required to get Dragon-12P board (further referenced as D12P) working with Code Warrior through HCS12 serial monitor.

We will not use DBug12 or BDM interfaces to the board. In any documentation that you find, including the textbook, only information about using HCS12 serial monitor is relevant.

 

D12P information:

Ø      Here is the Web page describing the D12P board.

Ø      D12P manual

Ø      MC9S12DG256 brief specs

Ø      MC9S12DG256 datasheet

 

 

 

 

 

Rounded Rectangular Callout: Serial interface
 


Rounded Rectangular Callout: ResetRounded Rectangular Callout: Power

 

 

 

 

 

  1. Connect the serial cable to the serial port on your computer and the top serial port on D12P.

If your computer does not have a serial port:

Ø      Use a computer in CAMP195

Ø      Get a serial-to-USB adapter

 

  1. Connect the power cord
  2. Open My Computer->Properties->Hardware->Device Manager->Ports

 

 

  1. Determine to which port the D12P is connected. As an example, for the illustration above the serial port would be COM1.

 

  1. Download the test program. Unzip the archive.

 

  1. Double click TestAsm to start Code Warrior
     
  2. Make sure the HCS12 Serial Monitor is selected as build target

 

  1. Press F5 to start the debugger
  2. If you get a message

     

Click Ok and set the proper COM port number in the Monitor Setup window.
Note: your COM port number may be other than COM1

 

 

  1. Click the green arrow to start program execution

 

 

  1. This is what you will see on the board.  Now press the two buttons shown. The board will start playing a tune.

  

Rounded Rectangular Callout: PressRounded Rectangular Callout: Press

 

 

  1. Now is time to start a test project of your own. We will copy the state from the DIP switch and pass it to the row of LEDs.

    Close the TestAsm project and the debugger.
    In Code Warrior select File->New -> Project Wizard

Name the project as you like, for example, test

 

  1. Continue as usual:

Ø      Select MC9S12DG256B

Ø      Assembly language

Ø      Absolute assembly

Ø      Full chip simulation and HCS12 serial monitor

 

 

  1. Here is how the source code will look like once you open main.asm

When you edit the code make sure that everything between ifdef _HCS12_SERIALMON
and endif is not changed!!!
This is true for all future projects as well.

 

 

  1. Type in the following code:

 

  1. Make sure that your target is HCS12 serial monitor.

Start the Debugger. Run the program.

Now every change in the state of the DIP switches should be reflected on the LEDs.

 

 

Problems???

Remember that I have an open door policy and you do not have wait until office hours to ask questions.