HAPSIM - Helmi's AVR Periphery Simulator V2.20

LCD (HD44780U), Terminal (USART and TWI), LEDs, Push-Buttons and Keypad Simulator Extension
for the AVR Simulator of Atmel's AVR Studio 4

Table of content:


LCD features:

How to use HAPSIM - Quickstart with Demo-Application 'LCDTest':

Terminal Simulator demo - USART to TWI Converter:

The Terminal Simulation for USART and TWI is a new feature in HAPSIM V2.0.
There is also a small test application for this new contol, namely a USART <-> TWI Converter which is used for this tutorial:

Terminal Simulation demo - redirection to PC's COM ports:

As an alternative to the following here is a nice tutorial written by Oliver Müller which uses the open-source com0com instead of Virtual Serial Port Kit, which I used below...

The used demo application utrans is quite simple: It uses both of the USART interfaces of an ATMega128:
Whatever is received on USART0 is forwarded to USART1 and vice versa.
For this demonstration we need two COM ports of our PC where we can redirect the AVR USARTs. At these COM ports we connect nullmodem cables with terminal programs attached.
So in fact we need two pairs of COM ports each pair looped with a serial cable! Due to the fact that it is unlikely you have 4 COM ports available on your computer you can either use a second computer running the terminal programs or you can use a virtual serial port driver like the Virtual Serial Port Kit (unfortunately there's only a 15 days trial version for free) which I used here:

4x4 Keypad demo - TestKeypd application:

TestKeypad is an application for Atmega16 to test a 4 x 4 keypad connected to PortC.
The program detects the pressed key by reading the row and column. The row is read from the input lines by setting the strobe lines to all 0. Afterwards the column is read by reverting the data direction, set all input lines (now output) to 0 and read the column from the strobe lines (now input). Open input lines are pulled to high by using the AVR internal pullups.
To prevent key bounce keypadtest starts a 25ms timer and retests the button is still pressed.

Running TestKeypad using HAPSIM

The Terminal screen will display a message "Test Keypad Program"
Press the buttons on the keypad or use the Keyboard to activate the hotkey links.
The keys pressed are echoed to the terminal screen.

Known Issues and restrictions:

Thanks and Tribute to:

Andrew Macdonald for programming the 4x4 Keypad control and the corresponding demo-app "TestKeypad", andrew.macdonald@au.fujitsu.com.
Peter Fleury for his LCD library, used by the LCDTest program, http://jump.to/fleury
Iuri Apollonio for the 'CoolMenu' Support, http://www.codeguru.com/Cpp/controls/menu/bitmappedmenus/article.php/c177/
Maurizio Pisano for the MessageBoxTimeout API, http://www.codeproject.com/cpp/MessageBoxTimeout.asp
James Clark for his Expat XML parser library, http://www.libexpat.org and
Tim Smith for the C++ Wrappers for the Expat XML Parser, http://www.codeproject.com/soap/expatimpl.asp
Oliver Müller for his tutorial about "Simulation of Serial Connections in AVR Studio 4", http://www.cogito-ergo-sum.org/com0com-hapsim.shtml.en
And last but not least, Atmel for their AVR microcontrollers which are the reason for all this ;-)
and of course for their free AVR Studio Software, look at http://www.atmel.no/beta_ware/ for the latest (Beta-)Releases.


HAPSIM V2.20, 16.2.2012
138.276 bytes
AVR Demo-Applications
LCD Test program, 21.10.2005
13.287 bytes
USART<->TWI Converter, 21.10.2005
7.325 bytes
Trinary Buttons Demo, 20.10.2005
5.697 bytes
USART redirection Demo, 20.10.2005
7.370 bytes
4x4 Keypad Demo, 21.1.2012
15.832 bytes

Note: Some of these Demo-Applications are using the #define FASTSIM to speed up the simulation.
If you want to run them on 'real' AVR hardware you have to remove the definition of FASTSIM by removing the line
"set DEBUG=-D FASTSIM" from the build.bat batchfiles!

Programmer's Tutorial:

Some internal information on HAPSIM:

If you want to add new functionallity and therefore collaborate in the further development of HAPSIM then read this HAPSIM Programmer's Tutorial.


Licence Information:

HAPSIM is both Freeware and Open Source!
Everyone can use it without any restrictions.
And everyone is invited to extend the functionality of HAPSIM by contributing new controls or features.
In this case I only want to receive the modifications aswell and get the permission to add them completely, or partly, into my "official" HAPSIM release.
The name of the contributing author is then mentioned on the HAPSIM homepage and/or in the program itself.


If you simply like HAPSIM, or even increase your productivity and commercial success by using it, donations to a poor, underpaid programmer are very much appreciated ;-)


Please e-mail any suggestions, complaints and other feedback to

Helmut Wallner, 16.2.2012