News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Simulator for dsPIC33

Started by SCV, Feb 10, 2021, 04:49 PM

Previous topic - Next topic

SCV

Can anyone recommend a decent code simulator for dsPIC33?
I have an an annoying error with something causing a reset - probably a stack underflow...

Tim.

OG

Isis can simulate some dspics.

v8.8 sp0

dspic.JPG

SCV

I should have included the device...

dsPIC33EP512MC806


top204

I abandoned Isis for any serious work quite a few years ago because they lost interest in Microchip devices, and the devices they do support are not supported with enough quality to justify using it for anything serious. As I've said many times in the past, it is a very expensive "toy". There is desperate need for another system, apart from Microchip's desperately bad simulator. In the late 1990s and early 2000s, the program "Electronics Workbench" was excellent, and was starting to develop into microcontroller simulation with a true, professional, CAD interface, but some semiconductor manufacturer bought it and shelved it for some reason.

To see what is causing the reset, the PIC24 and DSPIC33 devices have exception handling interrupts. See the "Traps.bas" sample file in the "Samples24" directory, and you will see what I mean.

Stephen Moss

I think I cam across an early version of Electronics Workbench, as I recall it looked really good and was the first software I found that did digital simulation.

I have occasionally had a good for PIC simulators, the last time being in lockdown one. Apart from what graphically looked like a Windows 95 era one that supported on a handful of small devices the only thing I have found that is really any good is ISIS which is prohibitively expensive for most people, particularly for only occasional use.

Unfortunately most PCB packages even expensive ones like Eagle appear to still only want to support spice for analogue simulation and maybe some basic logic devices, I don't know how good TINA is these days but price wise is similar to ISIS which again may prove prohibitive to most.

SCV

Thanks for the pointer Les, indeed it is a stack over/underflow. I hijacked an LED and put the stackerror routine in and bingo!

Now to track the culprit down... anyone know how to capture the programme counter (or whatever the P24 equivalent is) so I can get some clues. Is there not a declare that affects the stack?
My program does have many nested GOSUBs.

top204

See page 334 of the compiler's manual.

Declare Stack_Size X increases and decreases the stack size at compile time.

Also make sure you are not Pushing without the relevative Pop, otherwise, the stack will overflow. Also make sure your stack size is larger if you have a few interrupts doing complex things inside them because each interrupt routines uses the stack for context save/restore, so it can grow quite large and overflow.