new arduino emulator - emulare

Hey everyone,

I wrote an emulator for Arduino in C#. It has the following features:

It has full support for the AVR instruction set. It emulates all on board devices of the atmega328p.

These are:

  • AVR memories (data, code, eeprom)
  • Watchdog timer
  • Power management
  • Interrupts (intern and extern)
  • I/O ports
  • 8 bit timer/counter with PWM
  • 16 bit timer/counter with PWM
  • 8 bit timer/counter with PWM and asynchronous operation
  • SPI
  • USART
  • 2-wire serial interface
  • Analog Comparator
  • Analog-to-Digital Converter

It has an GNU GDB RSP interface for debugging using AVR-GDB, or insight.

I have tested it a lot myself, but I was wondering if people here, would be willing to help test it.

You can find it here:

That is pretty cool.

Does it run Bitlash? That would be a pretty comprehensive test.

Bitlash is a tiny interpreted language shell for Arduino. Open source and free, at http://bitlash.net

-br

http://entropymouse.com

Thank you very much for the hint. I will try that :slight_smile:

As I am not a C programmer, can you tell me what I need to get this up and running on a Windows box? I've downloaded all the source files, but don't know how to proceed from here.

Thanks...

Jim

Oh, I noticed where I got it wrong.

Sourceforge has put the source distribution as the main file to download. I still need to look up how to change that.

The file you need is the binary distribution.

Just do "View all files >>" and then emulare_1.0.zip

That has three files in it:

  • the .exe file you can put anywhere on your drive (and is the real emulator). Double clicking on this file will open the emulator.

Then simply do "file -> program" to open the hex file. Then press the play button to start the simulation.

  • it also has a text file and the license.

Idealy I should have made an installer too, but the express edition of visual studio doesn't allow for that :frowning:

You need to have .NET 3.5 installed. But I was thinking about everyone has that these days. Since there are so many .NET applications.

I am really sorry about that.

I fixed the default download now

thanks...I've downloaded the binary distribution and have the .exe file, but I can't seem to locate the .hex file .......

I've looked through both the src distribution zip and the binary distribution zip, but don't see any .hex files.

Care to help out this newbie again? !!

Jim

Press the "Verify" button in the IDE while keeping the "shift" button pressed on the keyboard. In the output window (lower part of the IDE window), you'll see a lo of messages.

The important part is around the last two lines, e.g.:

/tmp/build6654863793956281218.tmp/sketch_jul22b.cpp.hex 
Binary sketch size: 888 bytes (of a 30720 byte maximum)

you'll want to open a terminal window or a file manager window and look into the /tmp/build.....tmp folder. There you'll find the .hex file

HTH

Hi,
I found this very interesting.
Unfortunately, I've not been able to make good use of it.

Here's the sketch I compiled:

void setup() {
    Serial.begin(9600);
    pinMode(13, OUTPUT);
}


void loop() {
    Serial.println("HIGH");
    digitalWrite(13, HIGH);
    delay(1000);
    Serial.println("LOW");
    digitalWrite(13, LOW);
    delay(1000);
}

I loaded it with File -> Program. I opened the terminal and the pin window.
When I hit the "Play" button, nothing comes out on the terminal exept \u0000 sequences, and the pins in the pin window don't change...

For some reason I like this :slight_smile:

I will try and test it for you

I'm curious if this will work under mono; an emulator would be cool to have, but not so cool if it only works under Windows. One reason the Arduino has been so successful is that it is multi-platform; hopefully, this emulator can be ported to Java so that the multi-platform goodness can be retained. I will definitely have to keep an eye on this development. Glad to see it happen, whatever the case.

:slight_smile:

Yes, it runs under Mono right out of the box. I have tested it on my Ubuntu 64bit Linux box.

Thank you for all your response.

I have been testing it mostly with assembly routines from the atmega328p document from atmel.

A lot more testing needs to go in something so complex. Thanks to the link to bitlash I will be able to do that more efficiently.

Thank you for testing this program on mono too. I wasn't sure if it would work.

There is some latency in the update of the screens. This is because of it using winforms :frowning: I have it running on a timer now that updates the screen periodically. I should find something to fix that.

Well, something's not right. The IDE tells me that it has stored the hex file on my c: drive as:

C:\DOCUME~1\JIM~1.HOM\LOCALS~1\Temp\build498819872858574386.tmp\Nikon_remote_lightning.cpp.hex

But when I go to that temp directory, it's empty. There are no subdirectories under the Temp directory. A search does not show that the file exists.

Any ideas?

Yes, it runs under Mono right out of the box. I have tested it on my Ubuntu 64bit Linux box.

Cool. I'll have to this thread in mind for my toolbox once it gets more stable; it would be a useful item for testing.

It happened to me too. I tried to recompile ("Verify") a couple times more and the files re-appeared...

Seems great - and I love the idea that I can do bits of Arduino programming at work, without my actual Arduino board.

But I have to ask a stupid question: I compiled the Blink example and ran it in Emulare... but where do I find a view that would show me the state of pin 13?

but where do I find a view that would show me the state of pin 13?

That's not the point of it...

It doesn't do physical objects. Make the blink pin a serial print of high or low instead then you can see if it's on or not.

Mowcius

Oh. Shame though.

Sorry, I also just noticed mromani posted basically the same question. Wasn't an intentional duplication on my part.