Joined: 18 Jul 2010
|Posted: Sat Jan 22, 2011 3:44 pm
I would need some expert here to help me out from my problem.
I am using PIC 16LF1936 and lately I bought the ICD-U64 debugger. My application need to use internal oscillator with less than 500KHz to give a 500mSec flashing.
Now, my code run with no problem in normal run time mode but when I compile it to debugging mode, I notice that the debugger go into no response after execute my code that to change the internal frequency down from the default 500KHz to 125KHz.
The debugger window show PC=1FFFF, W=FF. Can anyone tell me why this happen?
After that, I try to set my internal oscillator frequency to 500KHz and 1MHz to check the same problem. But suprisingly, it has no problem at all.
Another problem, if I set my main peripheral clock source to Timer1, T1OSO and T1OSI, same problem occur but this time, the compiler even pop up an error messages to me by saying
"Could not start target: No response from the ICD Check the target oscillator and MCLR. Make sure the target clock match the clock fuse and the target is oscillating. Use View| Valid fuses to find the correct clock fuse."
Does anyone has this sort of problems?
Here is my code:
|"This is <CCS Debugging Test.h> "
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOCPD //No EE protection
#FUSES BROWNOUT //Reset when brownout detected
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOCLKOUT //Output clock on OSC2
#FUSES NOWRT //Program memory not write protected
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES DEBUG //Debug mode for use with ICD
#use delay(int=500000,RESTART_WDT) //The debugger ok
//#use delay(int=125000,RESTART_WDT) //The debugger no response
//#use delay(int=1000000,RESTART_WDT) //The debugger ok
//#use delay(int=250000,RESTART_WDT) //The debugger no response
|#include <CCS Debugging Test.h>
#define LED PIN_C3
#define LED2 PIN_C2
//Reset Timer1 to minimum base value
//setup_oscillator(OSC_125KHZ|OSC_INTRC|OSC_PLL_OFF); //Debugger become no response after this code of line
setup_oscillator(OSC_500KHZ|OSC_INTRC|OSC_PLL_OFF); //Debugger will runs with no problem!!!
//setup_oscillator(OSC_1MHZ|OSC_INTRC|OSC_PLL_OFF); //Debugger will runs with no problem!!!
//setup_oscillator(OSC_250KHZ|OSC_INTRC|OSC_PLL_OFF); //Debugger become no response after this code of line
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
//Enable ALL Interrupt
setup_timer_1(T1_EXTERNAL|T1_ENABLE_SOSC|T1_DIV_BY_1); //Use T1 oscillator
//Example blinking LED program