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.


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?



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.

  • \$\begingroup\$ I did not know about Multisim. Thanks, but that's not a free tool. If you could let your code run agains the provided scripting interface, I don't see why you would not be able to use some motor simulation code. That's is pretty straightforward to conceive. \$\endgroup\$ – djondal Jan 4 '16 at 14:32
  • \$\begingroup\$ Are you really talking about AVR studio.What I mean is that,you can see the working of register,processor,memory etc only.By the register filled during process,you can tell that motor runs or not.I edited the answer again.Check it to see a simulation in AVR studio. \$\endgroup\$ – Aadarsh Jan 5 '16 at 15:48
  • \$\begingroup\$ Yes, I am talking about the AVR Studio IDE. And, I have to say, I was pretty enthusiastic, about the Python scripting interface that I thought would allow anyone to extend the IDE to integrate with custom tools. For example, if you know the equations for a system (like a DC motor), then you can easily write some Python code that would simulate the behaviour of the motor. This physical code could be called every n microseconds depending on the discretization of your motor mathematical model. Please, visit the link to the Python interface, and let me know what you think. Thanks, and Happy Nw Yr! \$\endgroup\$ – djondal Jan 5 '16 at 17:01
  • \$\begingroup\$ From the example program in the answer itself,you can see that ,I done my coding in assembly and not in C also.I don't have any idea about Python language and it's associated.If want to simulate,please download Proteus ISIS and use it.It's also not free but effective tool in simulation.For now download trial version and use it.It's very simple to use and the output displayed is merely real.Thank you friend. \$\endgroup\$ – Aadarsh Jan 5 '16 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.