Wytec Dragon12 Development Board
Code Examples
This page provides links to a number of useful code examples
for on
the Wytec
Dragon12
development board (freescale MC9S12DP256B/C) and/or the Wytec
MiniDragon+ board.
Quick links:
HCS12
Serial
Monitor
This link provides instructions for replacing the on-board monitor
program DBug-12 by Motorola’s HCS12
Serial Monitor. The
latter is useful when working within the Metrowerks CodeWarrior
IDE. The HCS12 Serial Monitor provides full access
to CodeWarrior’s
source level debugger Hi-Wave. Updated hc12.ini and CW12_PARTID_0033.cfu files to work with the Dragon-12 boards up to Revision E have been included. Two sample projects are provided, test_led and test_led_revE for Revision D and older, and Revision E boards respectively.
Protected programs
This extension of the above project allows the installation
of two ROM resident system programs which can be
launched via
the on-board switch SW7\2 of the Dragon12 board. SystemProgram1
provides a comprehensive self-assessment of the MC9S12DP256B/C
–
this program uses features of a protective circuit board we have
developed to safeguard our Dragon12 boards against the worst student
abuse. The protective circuit board features two serially loaded D/A
converters which are used to test the A/D converter unit of the
microcontroller. The circuit diagrams as well as the PCB layout have
been included with the documentation. SystemProgram2
simply
displays the board ID on the LCD-display of the Dragon12. Both
programs are in the protective area of Flash ROM (extended to 8
kByte); the total size of both programs must be less than 6 kByte. It
is possible to extend this to a maximum of 14 kByte.
SerMon on MiniDragon rev. D
This is an adaptation of the above project for the MiniDragon+ revision D board. This board has a dedicated load/run switch.
SerMon on MiniDragon
This is an adaptation of the above project for the MiniDragon+
board. Two ROM resident system programs can be
launched via the
on-board switches SW1 and SW2 of the MiniDragon+
board. At present, SystemProgram1 simply displays a
‘1’ on
the 7-segment display; SystemProgram2 displays a
‘2’. Both
programs are in the protective area of Flash ROM (extended to 8
kByte); the total size of both programs must be less than 6 kByte. It
is possible to extend this to a maximum of 14 kByte.
P&E
BDM-Multilink interface
This short tutorial explains how to re-program the Flash, both
protected and unprotected, of the MC9S12 using the P&E
BDM-Multilink interface and the HC12 Flash programmer
PROG12Z (http://www.pemicro.com).
Laboratory
handouts
The following lab handouts have been
written for and tested
with the Dragon12 boards:
Lecture notes
The following lecture notes complement the above laboratory
sessions. The make reference to the Infineon C167 microcontroller. However, all introduced topics can easily be transferred to Freescale MC9S12 based systems (e.g. the Dragon-12). The accompanying programs can be run in simulation mode using the KEIL Integrated Development Environment mVision (3.0); a code-size limited evaluation version of this IDE can be downloaded from the KEIL web site.
- Lecture MP2: Powerpoint slides Printable version (black and white, pdf, 458 kB)
- Lecture MP3: Powerpoint slides Printable version (black and white, pdf, 1012 kB)
- Lecture MP4: Powerpoint slides Printable version (black and white, pdf, 417 kB)
- Lecture MP5: Powerpoint slides Printable version (black and white, pdf, 1209 kB)
- Lecture MP6: Powerpoint slides Printable version (black and white, pdf, 633 kB)
- Lecture MP7: Powerpoint slides Printable version (black and white, pdf, 374 kB)
- Lecture MP8: Powerpoint slides Printable version (black and white, pdf, 291 kB)
- Lecture MP9: Powerpoint slides Printable version (black and white, pdf, 2068 kB)
- Lecture MP10: Powerpoint slides Printable version (black and white, pdf, 986 kB)
- Lecture MP11: Powerpoint slides Printable version (black and white, pdf, 876 kB)
CodeWarrior
Stationery
The above programs are all based on the following CodeWarrior
stationery:
Metrowerks CodeWarrior Stationery for Dragon12, flat memory model
Metrowerks CodeWarrior Stationery for Dragon12, Revision E, flat memory model
Metrowerks CodeWarrior Stationery for MiniDragon+, flat memory model
Metrowerks CodeWarrior Stationery for DragonFly, flat memory model
Dragon12
sample programs
The following sample programs
accompany the above lab handouts:
Latest modifications and
additions:
| 19/06/07 |
A Free Real-Time Operating System, from www.FreeRTOS.org. The API for FreeRTOS is well documented and available from their website. It has been slightly modified from the HC12 demo port available from the FreeRTOS website, and requires a slightly modified version of the serial port monitor, which is supplied in the zip file. This port can be easily adapted to the MiniDragon+, for more information see the README file inside the zip file. This port is provided by Zebb Prime. |
| 28/09/06 |
Reliable radio communication using Nordic nRF24L01 radio modules (2.4 GHz, nominal data throughput up to 2 MBit/s). A nice little transceiver module can be obtained from SparkFun Electronics: Transceiver MiRF v2 - nRF24L01 Module RP-SMA. The code, provided by Stephen Craig, is extremely robust. Temporary loss of connection is taken care of as well as transmission errors, etc. The top-level functions provide a simple interface, allowing data to be pushed onto the transmission buffer / popped from the reception buffer. The rest is taken care of by the underlying drivers. For more information about this project see the following README file.
|
| 09/05/06 |
PWM revisited, changing channels now works properly (a flag didn't get cleared before), code supplied by Stephen Craig |
| 16/09/05 |
Fixed
channel selection bug in PWM
program |
| 12/08/05 |
Added routines for EEPROM
and Flash ROM access (code written by George
Wong) |
| 08/08/05 |
Added sample code for a
Sonar Range Finder (Devantech, SRF08 –
code written by George Wong) |
| 06/05/05 |
Fixed Pulse-Width
Modulation program (didn’t run properly at faster
rates) |
| 03/05/05 |
Fixed serial
communication at low speeds (now works down to 300
bps) |
| 28/03/05 |
Added sample programs to
demonstrate the use of ring buffer based background
communication |
| 28/03/05 |
Added sample programs to
demonstrate the use of the PWM unit |
| 28/03/05 |
Added sample programs to
demonstrate multi-channel A/D conversions |
| 28/03/05 |
Updated all A/D based
projects to use the corrected A/D complete conditions (CCF0 for single
channel conversions) |
| 17/02/05 |
IIC bus interface of all
projects involving the D/A converters now actually clears the IBIF
flag. |
| 17/02/05 |
Stepper motor driver
program (requires hardware driver circuit). |
| 17/02/05 |
Sample project for the
LCD module (code: Prof. Louis Bertrand,
Durham
University,
Canada). |
| 17/02/05 |
Serial communication
routines for SCI1 now include support for signed and unsigned data
types. |
| 12/08/04 |
Serial communication
tidied up… both ports now work at all baud rates up to 115
kbps. |
Sample Programs:
- Simple
LED program
- Hello
world on SCI0
- Hello
world on SCI1
- Simple
terminal on SCI1
- Simple
terminal on SCI1 using background communications (ring buffer version
1)
- Simple
terminal on SCI1 using background communications (ring buffer version
2)
- Simple
timer (TOC7)
- A/D
conversion using polling
- A/D
conversion using interrupts
- A/D
conversion and timer (1)
- A/D
conversion and timer (2)
- A/D
conversion and timer (3)
- A/D
conversion, data displayed on SCI1
- A/D
multi-channel conversion, data displayed on
SCI1
- A/D
conversion, data displayed on SCI1, data sent to D/A converter
(AN5311, 10-bit, I2C communication
interface)
- A/D
conversion, data sent to D/A converter (AN5311, 10-bit, I2C
communication interface), 3000 Hz
- Pulse-Width
Modulation example (2005)
- Pulse-Width
Modulation, support functions (code by Stephen Craig / Ben Gransden, 2006)
- Simple
FIR filter (128 coefficients)
- Slightly
more efficient FIR filter
- Simple
IIR filter (transfer function realisation)
- Reliable
IIR filter (using second-order sections)
- Fuzzy
logic speed control for a DC motor
- LCD
display (slightly modified copy of Prof. Louis Bertrand’s LCD
code)
- Stepper
motor driver (requires corresponding hardware driver
circuit)
- Sonar
(Devantech Range Finder SRF08, code
written by George Wong)
- Access
routines to EEPROM and Flash ROM (code written by George
Wong)
- RF communications, client (code written by Stephen Craig)
- RF communications, server (code written by Stephen Craig)
- FreeRTOS port for use with the serial monitor (adapted by Zebb Prime)
MiniDragon+
sample programs
The following sample programs
work on the
MiniDragon+ board:
Latest modifications and additions:
| 02/10/06 |
The code of the Underwater Planar Vertical Take-Off and Landing vehicle (PVTOL) project (provided by Zebb Prime) has been added to the web page. This project centred around a control rig under construction for the demonstration of advanced non-linear control theory. Among the modules included in the code of this project are routines for wireless communications using RF 418 MHz transmitters, RF 916 MHz receivers as well as a Microstrain 3DM-GX1 Inertial Measurement Unit (IMU).
|
| 02/10/06 |
Reliable radio communication using Nordic nRF24L01 radio modules (2.4 GHz, nominal data throughput up to 2 MBit/s). A nice little transceiver module can be obtained from SparkFun Electronics: Transceiver MiRF v2 - nRF24L01 Module RP-SMA. The code, provided by Stephen Craig, is extremely robust. Temporary loss of connection is taken care of as well as transmission errors, etc. The top-level functions provide a simple interface, allowing data to be pushed onto the transmission buffer / popped from the reception buffer. The rest is taken care of by the underlying drivers. For more information about this project see the following README file.
|
| 16/05/06 |
Simple radio communication through SCI1 at rates of up to 1200 bps, code written by Stephen Craig. The code has been tested with a set of inexpensive radio modules (transmitter: Laipac TLP434A, receiver: Laipac RLP434A); these Amplitude Shift Key (ASK) radio modules work in the license exempt band around 433 MHz. The code is fairly generic and should work with other modules as well. Ring buffers are used for efficient background communication.
|
| 09/05/06 |
PWM support functions, code written by Stephen Craig
|
| 22/09/05 |
Sonar Range Finder,
calibrated (5 cm – 70
cm, +/- 5%) |
| 22/09/05 |
Simple ‘Hello World’ program |
Sample Programs:
GNU gcc
examples
Frank Wornle
(frank.wornle@adelaide.edu.au)
School of Mechanical Engineering
The University of Adelaide
October, 2005