View previous topic :: View next topic |
Author |
Message |
Charles Linquist
Joined: 07 May 2005 Posts: 28 Location: Campbell, CA
|
Microchip ICD2 |
Posted: Sun Jun 05, 2005 1:32 pm |
|
|
In the 'Debug' options of the CCS compiler, they mention the use of the ICD. Do they mean Microchip's ICD2 or CCS's ICD?
I have a Microchip ICD2, and when I tell the CCS compiler to use an ICD, I get an "FTDxx driver error".
Is there some way to use the hardware I already have as a debugger? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jun 05, 2005 2:24 pm |
|
|
Download MPLAB 7.10 (or later) from the Microchip website.
Compile your CCS files within the MPLAB IDE, and use MPLAB
to control the Microchip ICD2 debugger. |
|
|
Jack S Guest
|
|
Posted: Sun Jun 12, 2005 10:59 pm |
|
|
Charles-
Any luck using ICD2 and MPLAB to debug your code compiled with CCS compiler?
I have not found a way to run MPLAB-ICD2 debugger on my CCS-compiled code successfully yet.
Basically, the code compiled OK. Somthing got programmed into the device memory OK when it's suppose to be debug support and app code. The PIC18F6520 that I used does not seem to be toggling a pin like it's suppose to.
I will post a again if I made any progress. |
|
|
Charles Linquist
Joined: 07 May 2005 Posts: 28 Location: Campbell, CA
|
|
Posted: Sun Jun 12, 2005 11:15 pm |
|
|
I have to admit that I haven't tried too hard. I tried to use the MPLAB "environment" to build my code, but after several unsuccesful attempts, I gave up.
I should give it a try again, though, because I would really like to use a linker, and it looks like MPLAB can provide that functionality for me.
Maybe I should RTFM! |
|
|
Jack S Guest
|
|
Posted: Sun Jun 12, 2005 11:34 pm |
|
|
If you use Project Wizard in MPLAB IDE and select CCS C-compiler as the tool suite that you want to use, then add the source file you want to be in the project, you should be good.
I noticed though that the compiler hangs up when using it through MPLAB with a source file that has major errors in it. Like missing braces. I had to compile it using CCS IDE to find what the error was and then everything was OK.
I havn't tried to use the linker so not sure what's involved there. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 13, 2005 12:13 am |
|
|
There are full instructions for using CCS with MPLAB at the following link,
including screen-shots. There is no linker. Scroll down to the end
of the page at this link and read the last paragraph.
http://www.ccsinfo.com/faq/?54 |
|
|
Charles Linquist
Joined: 07 May 2005 Posts: 28 Location: Campbell, CA
|
|
Posted: Mon Jun 13, 2005 12:27 am |
|
|
BUMMER! I think a linker should come before any other compiler update. |
|
|
Paolino
Joined: 19 Jan 2004 Posts: 42
|
|
Posted: Mon Jun 13, 2005 3:23 am |
|
|
I just want to share with you my personal experience. I just want to say that I can work with CCS embedded in MPLAB, but moving from MPLAB 6.xx to 7.xx I had to reinstall the CCS-to-MPLAB interface, otherwise I could not work. I was looking in the forum if someone had a similar problems, but maybe I have lost some thread and/or my search activity was not so cool...!
Anyway, the problem was that I got an error (BUILD ERROR) during the compiling operation, even if I set-up correctly path and toolsuite locations.
Best regards.
Paolo. |
|
|
RobM
Joined: 29 Apr 2005 Posts: 13 Location: Santa Cruz, CA
|
|
Posted: Tue Jun 14, 2005 10:14 am |
|
|
Jack S wrote: | Charles-
Any luck using ICD2 and MPLAB to debug your code compiled with CCS compiler?
|
I installed following the somewhat convoluted instructions carefully. It was working, but for some reason the USB setup went funny, and I was getting a new hardware message at boot. I re-installed and it is working.
Compiling, programming and running are now done in two clicks, but occaionally the debugger software seems to lose track of where the hardware is, but selecting ICD2 programmeer then ICD@ debugger seems to get it all working again.
I have a PICDEM2 and I was able to assemble the demo into a PIC16F877, as well as modify, compile and program the csRTOS software I found in the code section of this site.
I was very happy with MPLAB simulator, and was able to get some complex and large assembly programs running. I am not having so much luck with C, I can't even figure out how to watch C variables!
More on this later. _________________ Rob
_______ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 14, 2005 11:26 am |
|
|
Quote: | I am not having so much luck with C, I can't even figure out how to watch C variables! |
I assume you want to use the ICD2 in debugger mode, and watch
variables as you step through the code. It's really simple.
1. Create a project in MPLAB 7.10. Use the program shown below,
which just increments a variable.
2. In the Debugger menu, go to Select Tool, and choose MPLAB ICD2.
3. Click on the Compile button to compile to program.
4. In the Debugger menu, select Connect. You should see several
messages in the Output window which shows that you connected
OK to the ICD2.
5. Now press the Program button (or select Program in the Debug menu).
At this point, you've programmed the PIC with your program and
with the "Debug Executive" code, which MPLAB puts up near the end
of the ROM memory in your PIC. (This Debug Executive is not
programmed into your PIC when you use the ICD2 in Program mode.)
6. Now go to the View menu and select item 6, Watch. A little
watch window will pop up.
7. In the Watch window, there's a drop-down box at the top right.
It says CCP_1. Scroll down in it and select "my_var". Now
click on the Add Symbol button. "my_var" will now be in the
watch list. Initially it will say "out of scope". Don't worry about
that. The key point is that you have to select the variable AND
click on the Add Symbol button to add it to the Watch list.
8. Arrange the windows on your screen so the Watch window will always
be visible. Maybe shrink the Output window down in size to make
room for the Watch window.
9. Now press the F7 key to step through the code. Eventually the
code in the while() loop will execute and you will see "my_var"
start incrementing each time you press F7.
Here is the test program:
Code: |
#include <16f877.h>
#fuses HS, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay(clock=20000000)
void main()
{
char my_var;
my_var = 0;
while(1)
{
my_var++;
}
}
|
|
|
|
Guest
|
|
Posted: Tue Jun 14, 2005 4:04 pm |
|
|
Thanks for the detailed answer, it turns out that this tip was what I needed :
[quote="PCM programmer"] Quote: |
5. Now press the Program button (or select Program in the Debug menu).
At this point, you've programmed the PIC with your program and
with the "Debug Executive" code, which MPLAB puts up near the end
of the ROM memory in your PIC. (This Debug Executive is not
programmed into your PIC when you use the ICD2 in Program mode.)
|
Now I am able to watch my variables.
Thanks,
RobM |
|
|
|