Designing with Microcomputers -- The 68HCS12

The simulator, SIMHCS12, is part of the Simulator and Textbook CD Package, Designing with Microcontrollers -- the 68HCS12. SIMHCS12 simulates the Freescale Semiconductor 68HCS12, specifically the MC9S12DP256 or MC9S12DG256 microcontrollers which are used in the Wytec Dragon12-Plus board among others. It also simulates the MC9S12C family such as is used in the Wytec DragonFly12 and other boards. Single chip mode is simulated. It will also simulate, to the extent they are compatible, other variations of the 68HCS12.

View a video demonstration (requires Quicktime) at 1024x768 resolution by clicking here.


Image of SIMHCS12

Click on the screen shot for full size view

The user has access to both serial ports via two terminal emulators, as well as the first 10-bit, 8 input Analog to Digital Converter, SPI0, Timer Module (and Port T), and ports A, B, H, J, K, M, and P. The COP timer and Real Time Interrupt, PLL, internal RAM (12K), EEPROM (4K) and Flash EEPROM (256K), and the full instruction set are implemented. The EEPROM can be programed via 68HCS12 code. Instruction timing is emulated.

SIMHCS12 will run Freescale's D-Bug12 debugger and bootloader with the exception that hardware breakpoints and the ability to program the flash memory are not supported nor is the BDM.

The debugging features include the ability to step execution, step over subroutines, set any number of breakpoints, load S19 format files (even into the 256kB Flash EEPROM), and examine and modify registers and memory. The debugger is capable of stopping execution upon invalid memory accesses, uninitialized interrupt vector execution, and invalid instructions. The disassembly of the next instruction to be executed shows the effective address of any index mode operands and the value of any memory source operand. Instruction trace allows looking at program exection backwards from a program crash.


S19 files can be "dragged-and-dropped" to the simulator to load. Assembler source files can also be "dragged-and-dropped" to the simulator to assemble and then automatically load if there are no errors. (This functionality is available under Windows and Mac OS X only.) drag and drop of ASM file with error
Breakpoints can be set or reset in the disassembled code view. Disassembler showing breakpoint
"Run to Return" from subroutine or interrupt routine makes it easier to trace and debug. Single step and step over subroutine calls are also available. run to return button
As an option, the switches and LEDs on the DRAGON12/Dragon12-Plus development boards can be simulated. The LEDs are simulated in three states, on (red), off (black), and not driven (grey). DRAGON12 switch and LED simulation
Configuration options include "MiniDbug12", a simulation of the basic application support features of Freescale Semiconductor's DBUG-12 to handle PLL setup, interupt vectors, and terminal I/O when simulating the MC9S12DP256.

Student Mode for the MC9S12DP256 simulation makes the simulator easier to use for the beginning student by initializing the PC and SP registers, the clock PLL, serial port bit rate, and the PPAGE register. These default values can be changed to match the development board.
Student Mode settings

If using ASM12, the source line can be displayed in the next instruction field and code viewer. Source labels can be used instead of hex addresses in most 16-bit entry fields.
source display
A Console Log viewer views messages sent to the "console" -- port value changes, snapshots, and execution traces. console log

When simulating a MC9S12C32 or MC9S12C128 part, Ports A, B, J, P, T, and AD are accessable, and the ATD, SPI0, SCI0, and the timer are simulated.

Some technical details

An installer program is provided for Microsoft Windows users which includes a Java interpreter. On other platforms, a Java interpreter will be required. The simulator will appear different on different operating systems. Most of the screen shots on this page are of an earlier version of the simulator and have slight differences from the currently shipping version.

I've measured a simulation speed of over 800,000 instructions per second on a 3.2GHz Pentium 4 and Windows XP.

Documentation is provided within the simulator's help menu.


Contact me at