Electronic – How to connect a large exisiting code (some simulator) to the AVR Studio Simulator

avravr-gccbrushless-dc-motorsimulation

Context

I am working on a brushless DC motor controller project.
And I would like to verify that the interrupt timings make sense in simulation before downloading my code to the board.

Challenge

For that, I have already some C code simulating a brushless DC motor and I would like to run that motor simulation code in parallel with my AVR code.

I wish not to run the motor code in the simulator as well because it makes uses of floating point arithmetic: I want this motor code to run on my PC.

[edit]
I found a way to stimulate the editor. Unfortunately, one must create the input sequence before hand in a file.
This is not convenient because my motor simulator must react depending on the AVR code.
It seems that a good approach could leverage Python debug scripting interface.
However, the documentation seems to be lacking information.
Have you got an idea on how to approach this?

Thanks

Best Answer

You cannot simulate thinks like motor,LED,LCD screen or any type of external components in the AVR simulator.You can run the code and see how the code works internally inside the chip.You also cant get response from the simulator like which you like to get response from a device.You can use Multisim simulator to run your code in PC with external components connected but still you may or maynot get response from a output device.In Multisim,simulation with ATmel's 89C51 is possible.I dont have idea on other Mega series of MCU. You can try Proteus ISIS software to get mere expected simulation.It contains lot of microcontrollers and external components.So probably,Proteus will help to solve your problem.

    THe screenshot is attached to configure ATmel studio as simulator
config steps runningHere is how it's looks like,when you run by 'debug with break'.To move next step,click on Stepin(F11 shortcut).To move to a specific line,drag the cursor to the specific line and then stepinto(F11 shortcut).You can see the changes happening in General Purpose registers,I/O pin registers,RAM etc due to your code.