View previous topic :: View next topic |
Author |
Message |
daniele.baroncini
Joined: 01 Apr 2008 Posts: 4
|
Debug of 18F86J50 |
Posted: Fri Apr 11, 2008 4:08 am |
|
|
i'm tring to debug this code, with 18F86J50 and Microchip ICD2, but i cannot enter debug mode. I use a 16Mhz oscillator and the code works if programmed but not if debugged. Can you help me ?
(the actual code is bigger but i made a simple test code to try debugging)
This is the code:
Code: | #include "main.h"
#bit PLLEN = 0xf9b.6
void main()
{
PLLEN = 1;
setup_adc_ports(ALL_ANALOG|VSS_VDD);
setup_adc(ADC_CLOCK_INTERNAL|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
while(1);
} |
Code: |
#include <18F86J50.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES H4_SW //High speed osc with SW enabled 4x PLL
#FUSES DEBUG //No Debug mode for ICD
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NOPROTECT //Code not protected from reading
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES CCP2E7 //CCP2 input/output multiplexed with RE7
#FUSES NOCPUDIV
#FUSES PLL4 //Divide By 4(16MHz oscillator input)
#use delay(clock=48000000,oscillator=16000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
|
|
Matro Guest
|
|
Posted: Fri Apr 11, 2008 4:26 am |
|
|
Compile with :
To allow ICD2 debugging.
Matro. |
|
|
daniele.baroncini
Joined: 01 Apr 2008 Posts: 4
|
|
Posted: Fri Apr 11, 2008 5:55 am |
|
|
also with
it doesn't work.
Maybe it's not a software problem, but it's weird because if i program the code it works, if i try to debug it it can't enter debug mode. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Apr 11, 2008 6:25 am |
|
|
You didn't tell us which debug tool are you using, because if you are working under:
1) MPLAB you must install the CCS plugin.
2) PCWx IDE - as long as I know - it does not support the ICD2.
Did you do the MCU target detection test prior to try the debugging test?
Humberto |
|
|
daniele.baroncini
Joined: 01 Apr 2008 Posts: 4
|
|
Posted: Fri Apr 11, 2008 7:49 am |
|
|
Humberto wrote: | You didn't tell us which debug tool are you using, because if you are working under:
1) MPLAB you must install the CCS plugin.
2) PCWx IDE - as long as I know - it does not support the ICD2.
Did you do the MCU target detection test prior to try the debugging test?
Humberto |
I'm using MPLAB with ICD2 and plugin (note that other chips goes into debug mode only this one got a problem)
PCWx has a new beta plugin and it works with ICD2, but with this particular IC i can't debug (but i can program it)
On the same board i have another micro (18F2550) and it goes into debug mode ! |
|
|
|