AC-Sim: AudioCommander's Simulator for MIOS Applications. This has been named after it's creator but hopefully all MIDIBoxers will feel free to contribute to and share their code.
Please see Release_and_Developer_Notes for version info.
If you add something make sure, you note it here, otherwise your submissions might get overwritten!
AC-Sim allows you to compile your MIDIBox Application as a command-line application on your Mac or PC (should also run fine with Linux). Input such as knobs, sliders, buttons (ie AIN and DIN) and MIDI Input can be simulated by entering commands, and the output of the LCD and MIDI Out will be displayed in the console. Please refer to the section “Usage (Manual)” to see what inputs are currently accepted and how to use it.
But you'll discover the real strength of the simulator once you are going to use the graphical debugging interface of your IDE → you can inspect all the variables and their contents!
It reduced my number of application uploads dramatically and to be able to use a graphical debugger to watch some variables is quite helpful… Look at that (Pic shows Xcode's GDB-Debugger window):
Isn't that nice?
The Simulator currently consists of these files:
|ACSim_console (Console based input, main runloop)||Adaption required!|
|ACSim_console.h||Hardware related defines||Change #defines to reflect your settings|
|ACSim_console.c||Main runloop||Add additional c. source-files here|
|ACSim_mios (MIOS Emulation)||No changes required|
|ACSim_mios.h||pic18f452.h typedefs and global vars||No changes required|
|ACSim_mios.c||MIOS functions for simulation||No changes required|
|ACSim_tools (Tools & Helpers)||No changes required|
|ACSim_toolbox.h||Hexview config||No changes required|
|ACSim_toolbox.c||Helpers like random generators and hex-view||No changes required|
|ACMidiDefines.h||Midi Defintion listing||No changes required|
You can download the files in a .zip file here. If you make any updates, please send them to sstryd_one and he will update the zip for you.
SCM Code News
To implement the ACSim files into your applicaton, you just have to follow the setup guide to:
When running/debugging, Main() calls:
For detailed step-by-step instructions see Setup Guide below!
These input commands are currently available:
If you haven't setup your IDE, please follow these links for your system first:
Then proceed by configuring your main.c, and .h files:
Minor modifications are required to your MIOS Application's main.c file.
#include "cmios.h" #include "pic18f452.h"
#ifndef _DEBUG_C #include "cmios.h" #include "pic18f452.h" #endif
#ifdef _DEBUG_C // export functions that are called from within debug_mios.c // (e.g. to trigger DISPLAY_Init after sending...) extern void DISPLAY_Init(void); #endif
If you have more than just main.c, you have to add the source to these .c files (c only, no headers, else you will get a bunch of compile errors. See the comments in the ACSim_console.c file for details.
These files don't need to be changed, just add them to your project.
This entry is still in work. It is very incomplete! Especially beginners should be aware of that it's not yet easy to use. This code is mainly intended to simulate and debug new applications. However, if you know C just a bit, you are welcome to try it!
Everyone is welcome to add lines and code! Change anything! Don't be afraid; I don't see this as _my_ work, I hope the code gets completed piece by piece until we finally have a nice simulator/debugging environment built by the mb-community! audiocommander
Update 0.0.4: now works on MS Windows with GCC (and probably other compilers too) stryd_one
Update 0.0.5: splitted code to seperate wiki-documents, code cleanup, cleaned namespaces, added MIOS_ICC and MIOS_HLP functions audiocommander
Update 0.0.5-r1: Splitted ACSim_toolbox into header and source audiocommander
Update 0.0.5-r2: 2007 January 17 improved MIOS_IIC for SpeakJet debugging audiocommander
Update 0.0.6: 2007 January 21 added MIDI-Merger, INTCONbits (MIDI-Clock support) audiocommander
Update 0.0.7: 2007 January 26 added MIDI-Debug Messages, improved Timer() calls, added Tick() calls audiocommander
Notes to developers
Some MIOS_function parameters have slightly been changed due to compile errors. If you have questions or would like to try it, you can ask in the forum! I'll give my best to help you using ACSim. It's a bit troublesome in the first three hours, but once you got it, it really helps developing MIOS-apps dramatically!!!