simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] simulAVR UI


From: iOS Dev
Subject: Re: [Simulavr-devel] simulAVR UI
Date: Thu, 21 May 2015 13:06:38 +0000 (UTC)

Hi Marcus,

I looked at the links you gave, however those dont really show how to interface 
with the simulator.

As a simple exercise, just so that I can learn how the code works, I was going 
to add a command line interface to simulavr main.cpp, that runs in a separate 
thread allowing me to read or write any AVR pin during the simulation, like 
this c++ pseudo code below...

simulavr/main.cpp

main(...)
{
...
dman->start(); // start dump session

// create new command line thread
pthread_create(&thread1,NULL,command_line_ui,NULL); // create my command line 
UI thread
...
} /* end main


void command_line_ui(void *arg)
{
//Create a new net for all AVR pins
net_pin1 = new Net();
net_pin2 = new Net();
net_pin3 = new Net();
.....

//then add each AVR pin to each net
net_pin1.Add(dev->GetPin("D0"));
net_pin2.Add(dev->GetPin("D1"));
net_pin3.Add(dev->GetPin("D2"));


// When i want to change pins from the UI
dev->GetPin("D0").SetNewValueFromUI('H'); // set AVR pin D0 to high
dev->GetPin("D1").SetNewValueFromUI('L'); // set AVR pin D1 to low
dev->GetPin("D2").SetAnalogValue(33); // sets the analog ADC input pin

//when I want to read the state of a AVR pin
float analogState=dev->GetPin("D0").GetAnalog(); // read analog value of pin
int digitalState=dev->GetPin("D1").GetPin(); // read digital value of pin
} // end command_line_ui


Does this look correct? 


Thanks
 



     On Wednesday, May 20, 2015 7:53 PM, Markus Hitter <address@hidden> wrote:
   

 Am 21.05.2015 um 01:40 schrieb iOS Dev:
 
> Did you know there is already a windows version of simulavr
> https://github.com/Traumflug/simulavr

Thank you for advertising my fork, but this is certainly not more 
Windows-specific than the original distribution. It mostly adds SIMINFO, a 
mechanism to ease running firmwares without GUI, TCL, Python, whatever, by 
adding the neccessary bits of information into the firmware binary.

For an example see here:

http://reprap.org/wiki/Teacup_Firmware#Teacup_in_SimulAVR

An example of how it's done is here:

https://github.com/Traumflug/simulavr/tree/traumflug/examples/simple_serial


Markus

-- 
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. (FH) Markus Hitter
http://www.jump-ing.de/

_______________________________________________
Simulavr-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/simulavr-devel


   

reply via email to

[Prev in Thread] Current Thread [Next in Thread]