0% found this document useful (0 votes)
11 views9 pages

Lab 2 - DP2230

This document provides instructions for using the Freescale Codewarrior software to program a microcontroller. It outlines how to start a new Codewarrior project, select the microcontroller and assembly language, and load example code. The objectives are to demonstrate starting Codewarrior, describe basic programming commands, and load data into memory locations. Example assembly code is provided to calculate a sum using addition instructions and store the result in a memory location.

Uploaded by

deema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

Lab 2 - DP2230

This document provides instructions for using the Freescale Codewarrior software to program a microcontroller. It outlines how to start a new Codewarrior project, select the microcontroller and assembly language, and load example code. The objectives are to demonstrate starting Codewarrior, describe basic programming commands, and load data into memory locations. Example assembly code is provided to calculate a sum using addition instructions and store the result in a memory location.

Uploaded by

deema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 9

Laboratory

1
COLLEGE OF THE
NORTH ATLANTIC

DP 2230
Microcontrollers
Memory Tracing & Code Warrior

NAME: __________Deema Bakhit____________________

STUDENT ID: ___________60083191____________

DATE: ____________21/9/2020________________

MARK: _______ / 100


Objectives:

This lab will introduce the student the Freescale Codewarrior software tool that is part of the
Microcontroller Development System.

At the completion of this lab the student will be able to:


 demonstrate how start codewarrior.
 describe some basic programming commands.
 demonstrate how to load data into specific memory locations.

Equipment and components needed:


• Lab computer with codewarrior
CodeWarrior for HCS12 Assembly Programming
1) Start CodeWarrior for HCS12, close the Tip of the Day if it comes up, and select New from
file menu as shown below.

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.

4) Select the MCU to program as shown below, then click Next.


5) Select Assembly as the programming language as shown below, then click Next.

6) Select Absolute Assembly as shown below, then click Next.


7) Select Full Chip Simulation and a hardware debugger as shown below, and click Next.

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.

You might also like