Freescale HCS12 Tower Sample Programs

The Tower system is a new development platform from Freescale allowing the user to stack a CPU module and multiple peripheral modules on top of each other. It has room for one CPU module and 3 peripheral modules. See the following link for more: Freescale Tower System Overview

The HCS12 CPU modules for Tower use the HCS12Gxxx chips. You can purchase the Tower elevator system and the HCS12G128 module from the following website: Freescale purchase options

Make sure you buy the TWR-S12G128-KIT. This $99 Kit comes with both the Tower elevator and the HCS12G128 CPU module. DO NOT Buy the CPU module for $79 since it has only the HCS12 CPU module and does not come with the Tower elevator. You can also buy HCS12 Tower kit from the following: Mouser purchase options

Using CodeWarrior with HCS12 Tower

Testing and Using HCS12G128 MCU Module with Tower with CodeWarrior

HCS12G128 MCU module for Tower is made by Axiom (www.axman.com) for Freescale and comes with Open Source BDM and ready to be used with CodeWarrior. The documents for TWR-HCS12G128 can be found on Axiom website:

The HCS12G128 MCU Module can be powered in several ways and only one of them must be selected via PWR_SEL JP5 jumpers next to the slide switch.

  1. from the USB cable to the HCS12G128 CPU module. We use the MIDDLE jumpers for pins 3 and 4. This is the default and is also called OSBDM (Open Source BDM),
  2. from the Tower system with jumpers for pins 1 and 2,
  3. from external power via the on-board regulator with jumpers for pins 5 and 6. The external power source for this option can come from the V+ LIN input or E1 & E2. Make sure to study the Axiom user guide before you use this option.

MAKE SURE ONLY ONE OF THE ABOVE OPTIONS IS SELECTED (ONLY ONE JUMPER IS SET). WE USE THE MIDDLE OPTION FOR ALL SAMPLE PROGRAMS ON THIS WEBSITE UNLESS IT IS STATED OTHERWISE.

The power through the USB cable is limited to 500mA and used only for controlling digital logic devices. When MCU Module is powered via the USB cable it should NEVER be used to power the power-hungry devices such as stepper and DC motors. The HCS12G128 MCU Module has the following on-board features (a) 4 LEDs (green), (b) 4 push-button switches, (c) a 5K POT (brown), (d) 10-pin connector for serial COM, and so on. To use the on-board features of LEDs, POT, and so on you must set the jumpers. These jumpers release the HCS12G128 CPU signals so they can be accessed by other peripheral modules/boards on the Tower elevator bus. The following sample programs can be used to test the on-board features of HCS12G128 MCU modules.

Make sure the USB power jumper is set in addition to jumpers for LEDS (LED1-LED4), SW1-SW3, and POT. Also, make sure the slide switch is in the "ON" position.

Sample Test Programs in Assembly Language for HCS12G128 Module for Tower

Open CodeWarrior and Create a New project in Assembly. Make sure you choose MC9S12G128 CPU. Under Sources Click on main.asm and bring up the main.asm. Make sure you are in Open Source BDM mode. Now:
(a) Delete everything in main.asm,
(b) Copy and paste any of the following programs into main.asm,
(c) F7(to make), F5(to download), and F5(to run) to execute the program.

Sample Test Programs in C Language for HCS12G128 MCU Modules

Open CodeWarrior and Create a New project in C. Make sure you choose MC9S12G128 CPU. Under Sources Click on main.c and bring up the main.c. Make sure you are in Open Source BDM mode. Now:
(a) Delete everything in main.c,
(b) Copy and paste any of the following programs into main.c,
(c) F7(to make), F5(to download), and F5(to run) to execute the program.

Timer Sample Programs:

Interrupt Sample Programs:

Programming the Axiom Tower Peripheral (TWR-DEV-PERIPH) Board

The TWR-DEV-PERIPH board is made by Axiom (www.axman.com) to be used with the Tower platform. The documents for TWR-DEV-PERIPH can be found on the Axiom website: User Guide and Schematics for Axiom TWR-DEV-PERIPH board

The Axiom Tower Peripheral board comes with on-board LCD, keypad, temperature sensor, and a DAC. The LCD has 3 lines of 16 characters and the keypad is 4x4.
The temperature sensor is MCP9700 and the DAC is an SPI chip using LTC1661. The following are samples program to test them. Make sure you place the TWR-DEV-PERIPH module at the top rack and the HCS12G128 CPU module at a lower rack.

Also make sure the PRIMARY (J1) side of Axiom Peripheral board is connected to the Primary (white) rail of the elevator.