Drop a symbol for a Microchip micro-controller into a QSpice schematic.
Wire the controller pins up to your desired circuitry.
Write some code for the micro-controller.
Run the simulation and view results when running your micro-controller code.
Change the schematic circuit or micro-controller code and run it again.
While functionally equivalent to the older QMdbSim project, this new version has significant improvements:
Simulations run much, much faster.
Configuration information is now in a user-editable text file.
Multiple devices are included in a Symbol Properties drop-down list.
A few devices are already available:
ATtiny25/45/85 (ATtinyx5)
PIC16F15213/214 (PIC16F1521x)
PIC18F4455/4550 (PIC18F4x5x)
Need something else? There is now a complete tool-chain to create your own device files from a text file that you create from datasheet specifications. The generated symbol, schematic, & DLL code require no editing.
If you fancy heinious, evil, unreliable AI tools, I’ve included Claude prompts that do a pretty good job of generating an initial Pin Definitions file from a datasheet.
Did I mention that the new version is significantly faster?
To be fair, there is a bit of one-time setup:
MPLabX v6.30 installed (for the softare simulator).
A 32-bit Java 8+ JRE/JDK (links in documentation).
The complete project including sources, compiled binaries, and documention is available on the dev branch of my QSpice GitHub repository.
Let me know if you find this useful, have problems or suggestions, etc. In particular, if you create new device files, please share! Send them to me and I’ll post them in the project.
Greetings.
Please is it possible to simulate dsPic chips with this framework?
Meaning can one also burn hex, c, assembly language codes using this framework in Qspice for chips like the DSPic33fj128mc802 Digital signal Controller from microchip? If possible, Please how can one do that?
It will be a great help to be able to do that in Qspice
Thanks
According to Microchip’s list of supported devices, this device is supported. I’ll create the required device-specific files and post them on my repo later today.
You’ll want to read the Overview and follow the Basic User instructions to get your system configured using the Basic Demo. Let me know when you have done that and we’ll walk through creating a test schematic and device program.
Great thanks Robert
It will be great for me to have the device-specific files for the DSPic33fj128mc802. It will be good for me to know when it’s done so that I can use it in some projects.
Great to realize that one can burn c,assembly, hex files in Qspice for free, this shows a free alternative of doing so and enables one to do so without spending alot of money on paid stuff like proteus.
Please is it also possible for one to have a video tutorial(in something like youtube) on how to use this framework step by step? Which enables one to leave from beginner to expert in the simulation of MCU, DSP with hex, c, assembly codes.
OK, I’ve created the basic device-specific files for dsPIC33FJ128MC802 (should also work for dsPIC33FJ128MC202, dsPIC33FJ64MC802, dsPIC33FJ64MC202, and dsPIC33FJ32MC302). They are in the QMdbSim2 project, Devices folder in the dev branch of the repo.
To be clear, you’ll need Microchip’s free MPLabX IDE to create/compile hex/elf files and to burn them onto physical devices.
There is some initial configuration required before we can create a test program for this device. Please follow the Basic User instructions to ensure that everything is ready for that next step.
–robert
PS. I’ve been thinking about a YouTube video. But don’t hold your breath…
Okay thanks.
Since I am still a beginner in this era , I will like to learn by simulating the PIC18F46K22 MCU by using this framework in QSPice before diving in the simulation of dsPIC chips. I will be working with the dsPIC chips surely as from tomorow.
Please is it possible to simulate the PIC18F46K22 MCU in this framework?, Can one have the device-specific files of the PIC18F46K22 in the repository ?, Also please I will like to know how to make the device-specific files for a chip without asking here so that I will be more faster when working.
Please I am still a beginner in these things I cannot make the youtube tutorials but instead the tutorials will be a good help to me.
I’ve added the PIC18F46K22 device files on the dev branch of the repo. In theory, these should work for PIC18F43K22, PIC18F44K22, PIC18F45K22, PIC18F46K22, PIC18LF43K22, PIC18LF44K22, PIC18LF45K22, and PIC18LF46K22. (At least, Claude thinks they will. )
Creating device-specific files is covered in the Device Developer documentation.
Please do ask questions here. This will help me to improve the documentation and find bugs. In particular, I don’t plan to become an expert on each device so I am hoping that users will supply demonstration schematics and device code. Thanks in advance.
So, I went through the process of creating a full demo – MPLabX device source/compiled code and PIC18F46K22_Demo.qsch (Charlie-Plexing LEDs like Basic User and Device Developer examples). The new/revised files are now on the dev branch of the QMdbSim2 project files.
I learned a couple of things:
I had MPLabX v6.30 installed. I had to install the X8, X16, and X32 compilers as well as some of the other tools (e.g., MCC) individually before the IDE would behave.
The full MPLabX feature set now seems to be free. In particular, the compilers appear to have full optimization features without additional licensing costs. (It’s about time. )
Be very certain that the *.hex\*.elf is compiled for the same device selected in the QSpice symbol. If you get “timestep too small” errors, double check this.
Anyway, the PIC18F46K55 is now a properly (albeit minimally) tested device. Please share your experiences.
Okay Thanks greatly for these
I will go through the repository and work with what you sent in the repository and after send what I did. Great thanks for the ressources sent
Bad News: There were problems with some of my code. I’ve sorted through the issues and have working replacement code. It will take a day or two to get it posted on the repository.
Good News: I’ve confirmed that the Microchip software simulator supports the ADC peripheral on the PIC18F46K22 device. Demo code/schematic/etc. will be included on the repository shortly.
Will your system work with an older simpler PIC such as a PIC16F819? And will it work with any C compiler? I mainly use the CCS PCM compiler and only occasionally XC8. Am I right in assuming that your system interfaces with the .hex file that any compiler produces. If so this makes it more flexible. Thanks.
You’ll need device-specific symbol, DLL schematic, and DLL code/binary files. I’ve already created the required files for these devices. Would you like me to create the files for the PIC16(L)F819?
I’ve tested only with Microchip’s toolset so I can’t be certain. However, the hex format (and elf) should be standardized so I feel confident that it should work.
That said, you do have to install Microchip’s free MPLabX IDE even if you don’t use it. The simulator software is packaged with the IDE.
@N.O.Prince, I think that I have all of the fixes/changes sync’d up on the repository. Please give the new version a shot and let me know of any issues. Thanks.
@djsb, you didn’t ask but I did create a PIC16F819 device. It’s on the dev branch of the repository.
The example code/schematic/symbol/etc. demonstrates driving 6 LEDs with Charlie-plexing on RA1-RA3, ADC peripheral input on RA0, and ADC bits output to QSpice DAC on RB0-RB7.
It may be a while before I provide some feedback on this as I have to try out the code on a PIC16F819 (easier as I’m more familiar with this chip). Then I will give the simulator a try-out on MPLABX and then QSpice. It may take me a while to understand how it all works. Thanks.
To clarify
From this directory QSpice/QMdbSim2_Project/Devices/PIC16F819 at dev · robdunn4/QSpice · GitHub
1/ Which specific files from this directory are needed to simulate this device in QSPICE?
2/ Which specific files are needed in order to COMPILE this demo in MPLABX (as I don’t see a .hex file I’ll have to compile that myself. What version of XC8 and MPLABX have you used?).
Which files can I ignore FOR THE TIME BEING if I just want to run the demo? I’m assuming the Visual C++ files can be ignored for now? Sorry for the questions. Just thinking ahead. Thanks.