Physics 4DA3/4DB3/4D06
Freescale MC9S08QG8/4
 
Getting Started - Supplementary Information

2011 Dec 19

MC9S08 Resources

MC9S08 Code Examples

Installation

Please note that the DEMO9S08QG8 or APS08QG8SLK requires a PC with a USB connection.

If you have purchased the DEMO9S08QG8 or APS08QG8SLK developmental kit, follow the Quick Start Guide that comes with the kit in order to install CodeWarrior IDE.

Basically, here are the things you need do:

  1. Install the CD labelled CodeWarrior Development Studio for Freescale HC(S)08 Microcontrollers into your PC and follow the instructions.
  2. Install the Service Pack CD. If the CD does not automatically install, go to the CD and open START_HERE.htm. Install the service pack for CW08 QG8.

Metrowerks CodeWarrior and the Service Pack can be downloaded from www.metrowerks.com

You do not need to purchase the developmental kit in order to run the simulator only.

A new license key from Metrowerks is not required if your code is less than 1K bytes long.

(Note: Metrowerks is now part of Freescale Semiconductor).


This information is supplementary to the Getting Started web page.

The information presented here refers to an older version of Metrowerks Codewarrior. Your installation could be somewhat different.

The MC68HC11 LCD display module requires +5V supply:

+5V = RED
GND = BLACK

Apply power to the LCD module and a startup message (different from the one shown) should appear on the LCD screen.

Press the RESET button if a readable message is not displayed.

The MC9S08QG8 development board requires +3.3V supply. Do not connect to the 5V supply. Also do not power the MC9S08QG8 directly from +5V. If 5V tolerant parts are required for your project, MC9S08QD2 and MC9S08QD4 are available in 8-pin DIP packages and MC9S08SH4 and MC9S08SH8 are available in 20-pin packages.

 

If required, the MC9S08QG8 MCU can be powered using a simple voltage divider circuit shown below.

 

Connect MCU pin-3 to +3.3V amd pin-4 to GND.

Connect the 8MHz XTAL between pin-5 and pin-6 of the MCU along with a 22M-ohm resistor in parallel with the XTAL.
(The MCU has an internal RC oscillator. This is not stable enough for serial data transmission. The external XTAL provides a more stable and accurate system clock.)

Connect the WHITE wire from the LCD module to the MCU TXD output at MCU pin-11. Turn on power. A test message should be generated on the LCD. Connect four LEDs to MCU pins 5, 6, 7 and 8 (with cathode to GND via 220-ohm resistors) and observe the LEDs flash.


MC9S08QG8 Pin Diagram

Connect Vss to GND.


Starting Metroworks CodeWarrior

Follow the instructions supplied with the CodeWarrior CD and install the software.

The latest version of CodeWarrior and Updates can be obtained from the Freescale website:

http://www.freescale.com/webapp/sps/site/homepage.jsp?code=CW_HOME

Your version may be different from the one shown:

Metrowerks CodeWarrior IDE 5.6.1

 

Starting a New Project

Select the New icon at the left (second icon) of the control panel:

 

Select the New Poject Wizard and enter a Project name:

 

Setup your project by choosing the following options. The only change from the default setting is made on Page 8.

 

Select both P&E Full Chip Simulation and P&E Hardware Debugging:

 

At the left hand side of the screen in the Project Panel, make sure you select P&E ICD.
P&E FCS - Full Chip Simulator allows you to simulate the code without actual hardware.
P&E ICD - In-Circuit Debugger is required to program the target MCU and run the code.

 

Viewing Code

Click on the + sign at the left of Sources to expand and dropdown the contents of Sources. Double click on main.c to open the source code main.c

 

Connect the MC9S08QG8 Demo board to the PC using the USB cable supplied. The PC should recognise the board automatically. If everything is fine, there should be two GREEN LEDs (VDD, USB) and one YELLOW LED (USB PWR) lit on the board.

Running the program

Click on the Debug icon (GREEN ARROW)

 

Click on Reset and Stop MCU.

 

 

Running and Debugging

Click on the GREEN ARROW - Start/Continue (F5) to begin execution.

 

Occasionally something goes wrong and the IDE fails to find the demo board or the target MCU. The IDE reverts to the P&E FCS mode.
When this happens, select PEDebug... Mode: Full Chip Simulator... In-Circuit Debug/Programming.

 

Writing our first Test Program

We will start from scratch and delete everything in the main.c window.

The first test program will be posted here later...

More to come...


MC9S08QG8 Pin Diagram

Connect Vss to GND


Lab Manual Chapter 2

MC9S08 Resources



2006.11.09 - 2011.12.21