CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

ICD_U40??

 
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go
View previous topic :: View next topic  
Author Message
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

ICD_U40??
PostPosted: Wed Feb 08, 2006 5:16 am     Reply with quote

This is just a note;
I had a problem not with programming or even the code I was doing, for what ever reasion, the Micro was not getting programmed correctly. Confused

I found that My PC had glitched internaly, Every was working OK, even the ICD_U40 was operating correctly with programming, just not able to program the micro corectly, (reboot the PC and every thing is now OK) Rolling Eyes

I was almost going to post this as a posible fault/bug?? a little bit of fault finding and all OK Wink


Andrew
_________________
What has been learnt if you make the same mistake? Wink
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

PostPosted: Wed Feb 08, 2006 4:26 pm     Reply with quote

It happened again Sad and I found that it is related to the WDT, switch it off, works OK, switch it on again (Fault), it appears that the WDT is resetting to soon, I have the WDT set to 1:128 (2304ms) I am using timer 0 to reset the WDT and pole a CPU led at 1/2 sec intervals
Code:
/***********************************************************
*    Timer 0 (RTCC) output, CPU led, Reset WDT             *
***********************************************************/
#int_RTCC
RTCC_isr()
{
  CPUled++;             // Increment value of cnt on every interrupt
  if (CPUled == 240) {
      output_toggle(CPU_led);
      CPUled = 0;
      restart_wdt();
      }
}

Code:
void Inilize()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_wdt(WDT_ON);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16|RTCC_8_bit);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   enable_interrupts(INT_RDA);
   enable_interrupts(INT_RTCC);
   enable_interrupts(GLOBAL);
   setup_oscillator(OSC_8MHZ|OSC_INTRC);
}

Code:
#FUSES WDT                    //Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT


This only happens twice to 2 x boards. Confused After doing some code manipulation, I got it to work OK, however when I put the original Code in that had this problem, It all works OK unable to refault. the micro is the 18F1320 and had been erased prior.

Should i have restart_wdt(); in the main program or is it OK where it is.

ANdrew
_________________
What has been learnt if you make the same mistake? Wink
Guest








Don't use restart_wdt() in a timer int
PostPosted: Fri Feb 10, 2006 7:58 am     Reply with quote

Sounds to me like a really bad idea to restart the WDT in a timer interrupt. One of the reasons for having a WDT is to come back if you get stuck in some bad code somewhere in your application.

If you restart the WDT in a timer intrerrupt, I se no reason at all to have WDT enabled.

// Magnus
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group