RCFR Guest
|
Problems debugging the PIC24FJ32GA004 |
Posted: Thu Feb 05, 2009 11:14 am |
|
|
Hi all,
I'm having some problems to debug one simple code in the PIC24FJ32GA004.
When i put the clock to work with the PLL, a can't debug anything in the code, it runs like it has no breakpoints. Some times one erro occurs in the PIC C compiler saying: "Invalid clock value from the debugger. Debugger may not be properly communicating to the target..."
I'm using the PIC C compiler and the ICD-U40. The cristal that i'm using is 8MHz.
Above goes the code:
main.c:
#include "C:\users\rcfr\ProjetoSerial115200\main.h"
unsigned int8 a = 0;
unsigned int8 b = 0;
unsigned int8 c;
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_psp(PAR_DISABLE,PAR_DISABLE);
setup_spi(SPI_SS_DISABLED);
setup_timer1(TMR_DISABLED);
setup_timer2(TMR_DISABLED);
setup_timer3(TMR_DISABLED);
setup_timer4(TMR_DISABLED);
setup_timer5(TMR_DISABLED);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
a = 10 + 10;
b = 1 + a;
output_high(PIN_B12);
output_high(PIN_C7);
delay_ms(1000);
output_low(PIN_C7);
delay_ms(1000);
while(1)
{
c = getc();
putc(c);
}
}
main.h:
#include <24FJ32GA004.h>
#device ICD=TRUE
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOJTAG //JTAG disabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES DEBUG //No Debug mode for ICD
#FUSES ICS3 //ICD communication channel 3
#FUSES NOIOL1WAY //Allows multiple reconfigurations of peripheral pins
#FUSES NOWINDIS //Watch Dog Timer in Window mode
#FUSES WPRES128 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS1 //Watch Dog Timer PostScalar 1:1
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES PR_PLL //Primary Oscillator with PLL
#FUSES NOSKSFSM //Clock Switching Mode is disabled
#FUSES NOOSCIO //OSC2 is general purpose output
#FUSES XT //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES I2C1SELD
#use delay(clock=32000000)
#pin_select U2TX=PIN_B11
#pin_select U2RX=PIN_B10
#use rs232(baud=114000, parity=N, xmit=PIN_B11, rcv=PIN_B10, stop=1)
I've read some old post in the forum, but every one is using the MPLAB to debug the code. I'm new using PICs so how should i use the MPLAB?! |
|