The Embedded Bathroom Control System is an autonomous system using a 68HC11 microcontroller in its heart. It has several temperature captors, humidity captor and presence captor. It displays on an LCD panel the time, date, temperature, humidity and other information. It controls the bathroom fan and light.

Since EBCS is installed in the bathroom, and to help in the development of the software, I wrote a simulator program that simulate EBCS completely. The simulator is composed of two parts:

  • A graphical part based on GNU Gtk is the simulator interface. It simulates the LCD panel, the optical keyboard buttons, the temperature and humidity sensors and show the status of the fan and light controlled by the system.

    The Gtk tool only simulates the I/O boards. It does not simulate the 68HC11.

  • A 68HC11 simulator which is part of GNU GDB. The GDB's simulator is very complete because it simulates all 68HC11 instructions and most of the 68HC11 IO devices (interrupts, I/O ports, timer, SPI, SCI, input/output compare, Analog inputs, eeprom, nvram). It is also accurate in the sense that it takes into account the CPU cycles taken by each instruction.

EBCS Simulator Design

The Gtk frontend and the 68HC11 simulator communicate and synchronize themselves using two mechanisms:

  • A shared memory segment is used to represent the I/O ports
  • A TCP/IP connection is used to synchronize the CPU with the frontend when the CPU writes on an output port.

The CPU always reads input ports in an asynchronous manner, that is, it never waits for the frontend to give the information. Synchronisation only occurs when the CPU changes an output port.

The screen shot below shows the simulator window with EBCS 0.6 running.

EBCS Simulator

The Gtk frontend was designed using Glade, the Gtk window editor.

Date File Description
2002-03-09 ebcssim-0.2.tar.gz Add light simulation, fix some problems, includes gdb-5.2 patch for Ebcs<->Gdb HC11 simulator connection
2001-10-15 ebcssim-0.1.tar.gz First version; simulate LCD, buttons, fan and connects to GDB-68HC11 simulator