Maker Pro
Maker Pro

Simulate the software before flashing

I want to simulate my software before actually flashing into the hardware. I am looking into microchip controllers. External tools also ok for me. I want to test my logic since I am finding lots of issues like flags not properly reset and etc. I want to test all the loops. Please suggest.
 

hevans1944

Hop - AC8NS
I don't trust software simulators much, because software that checks "good" in the simulator may fail in the final hardware install, usually because of real-time timing issues. These can be a real bitch-kitty to troubleshoot and correct.

It is okay to use simulation to verify the correctness of your program, but if using MPLAB you will quickly find out whether your program syntax is correct and whether or not the program is ready to download to the target. If it is okay, then you might as well download it so you can test its functionality on the real hardware. After all, the final "test" is whether or not a program performs correctly when downloaded to the target microcontroller or microprocessor.

Most micros use non-volatile FLASH memory technology for program storage. This type of memory can be overwritten hundreds (or even thousands) of times without fear of damage, so it is a good idea, IMO, to routinely download the program to the target during program development, skipping the simulation.

In early phases of program development, especially where timing is important, I normally install breakpoints in the program that use whatever I/O ports are available to let me know how and where the software is executing, removing and replacing these breakpoints as program development proceeds. Of course this is most easy to do in a simulator, but be aware the timing might not be accurate. For me at least, program development is always an iterative process. If simulation makes this process go faster, use it. Unfortunately (perhaps) the Microchip product line is complex. You need to thoroughly review the datasheet and understand ALL the flag and control bits, and learn how to use them to obtain the functionality you desire.

If you get in trouble, you can upload snippets of code to this forum for someone to inspect and perhaps guide you. Ask, if you need help with that.
 
Top