4
\$\begingroup\$

I have just downloaded the Proteus ISIS Circuit Simulator and I've noticed that in their samples, they have PIC projects based on C and they could step through the C code in the debuger.

Here is a screenshot from one of their sample videos:

their samples

But I just don't know how to specify my C source files to the simulator.

I can specify source files in assembly under Source>Add/Remove Source Files, however this does not work for C source files. I prefer C to assembly coding and I request for help or a simple tutorial on how to debug a simple C PIC project in Proteus ISIS.

\$\endgroup\$
5
  • \$\begingroup\$ Which C compiler do you use? \$\endgroup\$ Commented Apr 22, 2012 at 9:01
  • \$\begingroup\$ Use MPLAB. It comes with a free debugger and simulator. \$\endgroup\$ Commented Apr 22, 2012 at 12:20
  • \$\begingroup\$ @Olin It is really hard to simulate peripherals on mplabx when you code in C. Proteus isis is a great ease \$\endgroup\$ Commented Apr 22, 2012 at 14:16
  • \$\begingroup\$ @abdullah kahraman. I use hitech c 9.82 professional for PIC10/12/16. \$\endgroup\$
    – Dr Deo
    Commented Apr 23, 2012 at 2:29
  • \$\begingroup\$ @ Olin Lathrop: MPLAB simulator is not even close to proteus. \$\endgroup\$
    – Dr Deo
    Commented Apr 23, 2012 at 2:31

1 Answer 1

4
\$\begingroup\$

Yes, there is a debugger for C source codes in the Proteus ISIS VSM, however since C code will differ with the compiler, only certain compilers are allowed.

In the website, you can see that supported compilers for PICs are:

Third-part logos

  • CCS for PIC (at least V4.107)
  • Hi-Tech C for dsPIC33 (at least V9.60)
  • Hi-Tech C for PIC10/12/16 (at least V9.8)
  • Hi-Tech C for PIC18 (at least V9.63)
  • MPLAB C18 for PIC18 (at least V3.34)
  • MPLAB C30 (at least V3.21)

These compilers each generate a debug file, if enabled in the output options. You have not mentioned your compiler, so I am going to give an example for Hi-Tech C for PIC10/12/16. Your compiler is going to generate a .cof file as well as a .hex file after the compilation, if enabled in the compiler output options.

Double click your PIC in proteus, "Edit Component" dialog will appear. It is the same window that you include your hex file, however this time you are going to include your .cof file:

Edit Component

Click "OK" after you have included, now double click on your crystal if you have any, and click and activate the box labeled "Exclude from Simulation", click "OK", do the same for the capacitors that are connected to that crystal, if any.

Now click on "Advance Simulation by one animation frame" button, shown below:

Step button

Now you can see your source code, and navigate through it via the same button above. If you cannot see the code, and your compiler is not in the list I mentioned, then unfortunately it is not supported. If you cannot see any code window, then activate it by "Debug >> PIC CPU >> Source Code". You can also see your variables with "Debug >> PIC CPU >> Variables".

For more information:

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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