5
TUTORIAL
This section was written to help you get started developing software with the CMD912X board.
Be sure to read the rest of this manual as well as the documentation on the disk if you need
further information.
The following sections take you through the complete development cycle of a simple "hello
world" program, which sends the string "Hello World" to the serial port.
Creating source code
You can write source code for the CMD912X board using any language that compiles to
Motorola 68HC12 instructions. Included on the software disk is a free Assembler.
You can write your source code using any ASCII text editor. You can use the free EDIT or
NOTEPAD programs that come with your computer. Once your source code is written and
saved to a file, you can assemble or compile it to a Motorola S-Record (hex) format. This type
of output file usually has a .MOT, .HEX or .S19 file extension and is in a format that can be
read by the programming utilities and programmed into the CMD912X board.
It's important to understand your development board's use of Memory and Addressing when
writing source code so you can locate your code at valid addresses. For example, when in
debug mode, you should put your program CODE in External RAM. In assembly language,
you locate the code with ORG statements in your source code. Any lines following an ORG
statement will begin at that ORG location, which is the first number following the word ORG,
for example:
ORG $4400
. You must start your DATA (or variables) in a RAM location
unused by your program, for example:
ORG $4000
.
In “debug mode” you’ll be using a debugger utility (Mon12, NoICE, etc) which will handle both
interrupts (reset, timers, etc) and the STACK. When finished debugging, you must add code
to your application to handle the STACK and Interrupt vector initialization. Set the stack
somewhere at the top of your available RAM, for example $3FFE, in assembly this would be
LDS #$3FFE
. Also define the RESET vector address, $FFFE, at the end of your program.
For example:
ORG $FFFE
FDB START ; where START is the beginning label of your program
A look at the example programs on the disk can make all of this clearer. If you're using a
compiler instead of an assembler, consult the compiler documentation for methods used to
locate your code, data and stack.