View previous topic :: View next topic |
Author |
Message |
mbarrett
Joined: 19 Sep 2003 Posts: 8
|
18f458 and ICD2 debug not working |
Posted: Mon Dec 19, 2005 9:04 am |
|
|
Just trying my first 18F device.
using MPlab 7.3
CCS PCH C compiler V3.228
(just brought this in the UK, I realise its not the latest version but couldn't see anything in the changes relating to ICD2)
Here's the first test prog:
Code: | // test.c
#include <18F458.H>
#DEVICE *=16 adc=10 ICD=TRUE
#fuses XT, NOBROWNOUT, NOWDT, DEBUG,NOLVP
#use delay (clock=4000000)
#define led_green 31756 //rb4 PIN_B4
main()
{
do {
output_high(led_green);
delay_ms(500);
output_low(led_green);
delay_ms(500);
} while(true);
}
|
From the .LST file
Code: |
Configuration Fuses:
Word 1: 2100 XT NOOSCSEN
Word 2: 0E0D NOBROWNOUT WDT128 NOWDT BORV20 NOPUT
Word 3: 0000
Word 4: 0001 STVREN DEBUG NOLVP
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTB NOWRTC
Word 7: 400F NOEBTR NOEBTRB
|
If I program it with ICD2 (with NODEBUG and no ICD=TRUE) it works fine and flashes the LED. When I try it with the ICD2 debugger but get the error "ICD0083: Debug: Unable to enter debug mode".
Not sure where my problem is is it to do with CCS or ICD2 or MPLAB. Done lots of programing with 16F series devices and used ICD2 with no problems so am a bit stuck!
Had a look at previous posts on ICD2 but have not found anything that has helped. The PCB layout is the same as I have used for a 16F877 so know that works ok, have even tried different ICD 2's with no help. tried it ICD2 powered and externally powered.
Hope I am missing something simple so any suggestions gratefully received!
thanks
mike
BTW most of problems I have had with CCS have been solved looking at other peoples posts, this is a great resource so thanks for those! |
|
|
mbarrett
Joined: 19 Sep 2003 Posts: 8
|
Re: 18f458 and ICD2 debug not working |
Posted: Mon Dec 19, 2005 10:07 am |
|
|
Just had a look at the .LST file and notice it is not putting in a NOP instruction at the start of the program. Does the 18F need this, I know the 16F devices do when using Debug. the ICD=TRUE should generate this?
Maybe I will update the compiler to the latest version and try again.
mike |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Mon Dec 19, 2005 1:06 pm |
|
|
Go to MPLAB,
Project --> Build Options --> Project --> CCS Compiler
Do you have "Compile for use with ICD Debugger" checked?
For some reason or another, i occasionally get those errors, and playing with those settings eventually gets things working again. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 19, 2005 1:53 pm |
|
|
I just compiled a 18F458 test program and ran it with the ICD2 debugger.
There is no NOP at address 0. There's a GOTO 04.
Code: |
0000 EF02 F000 00001 GOTO 0004
0000 00002 ... #include <18F458.h>
0000 00003 ... /// Standard Header file for the PIC18F458 device ///
0000 00004 ... #device PIC18F458
0000 00389 ...#list
0000 00390 ...
|
My post in this thread has instructions:
http://www.ccsinfo.com/forum/viewtopic.php?t=23151 |
|
|
mbarrett
Joined: 19 Sep 2003 Posts: 8
|
|
Posted: Tue Dec 20, 2005 4:21 am |
|
|
Thanks fixed! Followed the instructions that PCM prog' posted and its all working.
I was being REALLY STUPID! I was compiling the prgram to use debugging but then pressing the run button and getting the errors. What I had forgoten was to download the program into the Pic.....
Only been using PIC's, ICD and MPLAB for years and years...... maybe its time to give up and go off for my Christmas break!
Anyway thanks again.
and all the best for the new year!
Mike
(Cambridge UK). |
|
|
|