How to Use AVR-Controller App - A simulated AVR ATmega328 CPU for Arduino Uno systems

If you want to build your own controller device, you could leverage an Android device and the AVR-Controller app to simulate an Arduino Uno.

To use AVR-Controller, start by downloading the Android app to your Android smartphone.

Link to AVR-Controller for Android smartphones

AVR-Controller is a simulated AVR CPU that might be helpful to the teacher, student, or hobbyist who wishes to develop and debug code for an AVR ATmega328 CPU which is the CPU in an Arduino Uno board.

Select compatible board

Arduino IDE

If you don't already have Arduino IDE installed, download it and install it. You might also want to leverage VisualINO if you want a visual programming model instead of the C or C++ programming languages.

Once installed, start Arduino IDE as you normally would as if you had an Arduino Uno board attached to your PC.

AVR-Controller is compatible with an ATmega328 which is the CPU in an Arduino Uno, so select that as your board type in Arduino IDE under the Tools menu.

Compile code

Arduino IDE

To create an AVR (Arduino Uno) program to run in AVR-Controller you will develop the program on another device such as a Window or Linux PC or laptop. See this Arduino Controller example for code that will flash AVR-Controller digital outputs on and off. Otherwise pick almost any of the numerous pieces of example code that come with Arduino IDE.

Once you think you're ready to compile and upload your code to an Arduino Uno, instead of uploading to an Arduino Uno board you will select to export compiled binary. This command under the Sketch menu will create a file on your computer with a *.hex extension in the same directory as your Arduino IDE project.

Load machine code

AVR-Controller AVR-Controller

After installing AVR-Controller, start AVR-Controller. You can then load the *.hex memory file into the simulated AVRs main program memory space. Load the *.hex memory file that has the machine code you want to run by loading it through the file open menu.

Run machine code


Once you've opened the AVR (Arduino Uno) program stored in a *.hex file, you should be at the main AVR-Controller view.

From the main AVR-Controller view, select Go/Run from the menu to execute the AVR (Arduino Uno) program. The Go/Run command will run the code just like if you had uploaded it to an Arduino Uno board. The window displays a simple representation of the Arduino Uno input and output pins. As your program runs the pins will be white or colored indicating the pin would be at 0 volts or 5 volts. If the program is designed to run forever, you can stop it by selecting Stop from the menu.

Digital outputs will show bits that are on as colored buttons and bits that are off as white buttons. Digital inputs can be clicked on to toggle between if the input is on (colored) or off (white). Clicking on a bit configured as digital output will not change it's state. Analog inputs are controlled by entering a numerical value. Buttons that are grey are there to represent pins that you would see on an Arduino board. Any text that the Ardunio is programmed to send to its serial output port will show up in a simulated 5 line LCD display below the digital and analog controls.

With AVR-Controller Pro, digital outputs from pin 4 through pin 11 will also be real outputs on a USB to parallel port adapter if you wire up the Advanced latch circuit . Specifically Arduino pins 4 through 7 or PD4 through PD7 are mapped to parallel pins D4 through D7, and Arduino pins 8 through 11 or PB0 through PB3 are mapped to parallel pins D0 through D3. Note that you need the latch circuit since AVR-Controller simulation can not pulse real output pins fast enough for a PWM circuit to work. In this way you could use AVR-Controller to act as a substitute for a Arduino Uno to control real electronics.

Link to AVR-Controller for Android smartphones

teraKUHN solutions
Hardware Setup Control System Hardware Abstraction Development Tools
Smartphone Controller
(with PWM or advanced latch circuit)
USB-Controller teraKUHN IO System (KIOS) Debug Z80 KCC80 KPC80
Smartphone Controller
(with advanced latch circuit)
AVR-Controller C & C++ coding abstraction macros Debug AVR Arduino C++
Arduino Controller
N/A C & C++ coding abstraction macros Debug AVR Arduino C++

Here are some architecture characteristics that can be demonstrated by these two control solutions. These differences can be used for teaching processor and microcontroller concepts.

control solutions
Z80 custom with KIOS AVR Arduino
von Neumann architecture Harvard architectures
Run-time software abstraction layer Compile time coding abstraction macros
custom electonics board pre built Arduino board

Copyright (C) 2021 R. J. Kuhn. Please note that you are not allowed to reproduce or rehost this page without written permission.