Lab 2 - DP2230
Lab 2 - DP2230
1
COLLEGE OF THE
NORTH ATLANTIC
DP 2230
Microcontrollers
Memory Tracing & Code Warrior
DATE: ____________21/9/2020________________
This lab will introduce the student the Freescale Codewarrior software tool that is part of the
Microcontroller Development System.
2) Select HC(S)12 New Project Wizard, Set the location where the project is to be saved, and
name the project as shown below, then click Next.
3) Click Next at the Welcome screen shown below.
8) Expand the Sources folder created by CodeWarrior and double click main.asm as shown
below.
9) Replace the template code provided by CodeWarrior with an example from the book as
shown below or your own code. Note that the minimal requirements for an Assembly program
are the following:
a) the ABSENTRY Entry declaration at the top.
b) the include file that defines the registers of the MCU
c) the ORG declaration above the Entry label and
d) the ORG $FFFE and DS.W Entry declaration below the program.
Also note that the book does not define Assembly code this way. This is for compatibility with
a variety of Assemblers for the HCS12. See the full code defined for CodeWarrior below the
graphic. You can use the code as template for examples in the book by replacing the code
between Entry: and END.
; Code from Example 2-1 with full definition for the CodeWarrior Assembler
ABSENTRY Entry ; for absolute assembly: mark this as application entry
point INCLUDE 'mc9s12dp512.inc'
ORG $8000
Entry:
;Start your code here
SUM EQU $210 ;RAM loc 210H for SUM
LDAA #$25 ;A = 25H
ADDA #$34 ;add 34H to A (A=59H)
ADDA #$11 ;add 11H to A (A=6AH)
ADDA #18 ;A = A + 12H = 7CH
ADDA #%00011100 ;A = A + 1CH = 98H
STAA SUM ;save the SUM in loc 210H
HERE JMP HERE ;stay here forever
;End your code here
END
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
DC.W Entry ; Reset Vector
10) Select Full Chip Simulation in the drop down box, then hit F5 to debug. See the Debug
Tutorial for details.