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

PIC18F2523 watchdog issues
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Diode



Joined: 27 Jul 2012
Posts: 35

View user's profile Send private message

PIC18F2523 watchdog issues
PostPosted: Sun Nov 09, 2014 4:09 am     Reply with quote

I'm having some problems with the watchdog in my program. This is the first time I want to use a watchdog. Occasionally my controller stalls due to voltage spikes caused by switching an inductive load. I'm trying to solve it in the hardware but I want an additional safety back up in the form of a watchdog.

The watchdog interval can be set between 4ms and 131 seconds. The problem I face is that my uc resets almost immediately no matter what I set as WDT time.

First the necessary information:
Compiler version: 5.018
Controller: 18F2523
External crystal of 20MHz

As far as I understand the WDT it works as following. I have set the WDT to #FUSES WDT32768 which means a that it should reset after about 130 seconds.
In my program I need to restart the WDT (restart_wdt(); ) to prevent it from resetting my controller.
So if I restart the WDT within the 130 seconds it should not reboot my uc, correct?

I have listed the main routine of my program and skipped all the functions otherwise it becomes quite a piece of code. If these are necessary to list just let me know.

It performs the INIT() routine and enters the "Waarden" case. It shows the data for about a second and restarts.

My questions:
Is my understanding of the watchdog correct?
Why does my controller resets within a few seconds after it has started?

Code:

#include "B:\Software\ORP\ORP met relais.h"
#include <flex_LCD420.c>
#include <float.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#define Relais1_aan (output_high(PIN_c3))// Relais_aan; om relais aan te zetten
#define Relais1_uit (output_low(PIN_c3))
#define MENU (PIN_c5)
#define OP (PIN_c4)
#define NEER (PIN_c6)
#define ENTER (PIN_c7)

// States index.
#define  WAARDEN              1
#define  RELAIS_1             2
#define  RELAIS_1_PARA        3
#define  RELAIS_1_SETP        4
#define  RELAIS_1_HYST        5

#define  CALIBRATIE_ORP      18
#define  CALIBRATIE_ORP_H    19
#define  CALIBRATIE_ORP_L    20



// Index variable.
static unsigned char ind_Menu = WAARDEN; // Zet state van menu structuur op waarden scherm

// Force the FSM to the initial state.
#define Menu_Init() { ind_Menu = WAARDEN; }

int cnti, cntj, cnta, adc_channel, eerste_opstart, eeprom_address, status_relais1;
int8 calh_orp_lowbyte, calh_orp_highbyte, setpoint1_lowbyte, setpoint1_highbyte, call_orp_lowbyte, call_orp_highbyte, hysterese1_lowbyte, hysterese1_highbyte;
int8 meal_orp_lowbyte, meal_orp_highbyte, meah_orp_lowbyte, meah_orp_highbyte;
signed int16 MEETWAARDE1, orp_ruw, setpoint1;
int16 calh_orp, call_orp, meah_orp, meal_orp, hysterese1;
int32 vref;
signed int16 orp;
float slope_orp, offset_orp;

int8 adc_sample_min [3]; // Array for the lowest sample number of the ADC
int8 adc_sample_max [3]; // Array for the highest sample number of the ADC
int16 adc_signal_min [3]; // Array for the lowest signal value of the ADC
int16 adc_signal_max [3]; // Array for the highest signal value of the ADC
int32 adc_value[3]; // Raw data from ADC
int32 adc_millivolt[3]; // Millivolt data of ADC
int32 adc_array[3][20]; // Array for 20 samples of each ADC
int32 average_array [3]; // Array for the average value of the ADC's
int32 mv_value[3]; // Array for the mv value of each adc



void init()
{
Shows some text on the display for 2 seconds and checks if the uc boots for the first time (loading calibration parameters if so)
}

void eeprom()
{
//Periodically saves data
}

void lcd()
{
//Is periodically polled to update the data on the display
}
 
void adc()
{
//Reads two adc channels. takes ten samples, gets rid of the highest and lowest sample and takes the average of the remaining 8 samples.
}

void Vref_functie()
{
//Calculates a reference voltage
}

void orp_functie()
{
//calculates an orp signal
}

void relais1_functie()
{
//determines if the relay need to be set
}

#INT_TIMER0
void isr()
{
   eeprom();
}

void main()
{
   setup_adc_ports(AN0_TO_AN2|VSS_VDD);
   setup_adc(ADC_CLOCK_INTERNAL);
   setup_spi(FALSE);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);;
   setup_timer_1(T1_INTERNAL | T1_DIV_BY_4 );
   setup_timer_2(T2_DIV_BY_1,255,16);//124
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   enable_interrupts(INT_TIMER0);
   lcd_init();
   setup_low_volt_detect(FALSE);
   setup_oscillator(False);
   setup_ccp1(CCP_PWM);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   SET_TRIS_A( 0x05 );
   SET_TRIS_C( 0xF0 );
   SET_TRIS_E( 0x00 );
 
   
   INIT();

   ind_menu = waarden;
   eerste_opstart=1;
   enable_interrupts(GLOBAL);

   While (true)
   {
   setup_wdt(WDT_ON);
   restart_wdt();
   switch(ind_Menu)
   {
      case WAARDEN:   //Weergave van waardes
         vref_functie();
         orp_functie();
         relais1_functie();////// staat tijdelijk uit!
         lcd();
         restart_wdt();
         for(cnta=0;cnta<200;cnta++) //For loop om schakelaars af te vangen en 1sec te wachten voor het display verversen.
         {
            if((input(menu)))   //Volgende state bepalen
               {
                  ind_Menu = RELAIS_1;
                  cnta = 198;   //Verlaat for lus direct als de knop menu wordt ingedrukt, anders wordt eerste de gehele lus no doorlopen
               }
              delay_ms(15); // na 200x15ms wordt deze lus verlaten, update frequency is dus 3sec
         }
      break;

      case RELAIS_1:   //Keuze menu instellen relais 1
         lcd_putc('\f');
         lcd_gotoxy(1,1);
         printf(lcd_putc,"Menu\n");
         printf(lcd_putc,"Instellen relais\n");
         delay_ms(100);
         restart_wdt();

         for(cnta=0;cnta<200;cnta++) //For loop om schakelaars af te vangen en 1sec te wachten voor het display verversen.
           {
               if((input(menu)))   // Keer terug naar state menu
               {
                  ind_Menu = WAARDEN;
                  cnta = 198;
               }
               else if((input(enter)))   //Ga naar het instellen van relais 1
               {
                  ind_Menu = RELAIS_1_SETP;
                  cnta = 198;
               }
               else if((input(neer)))   //Ga naar de volgende subgroep van het keuze menu
               {
                   ind_Menu = CALIBRATIE_ORP;
                   cnta = 198;
               }
               else if((input(op)))   //Ga naar de vorige subgroep van het keuze menu
               {
                  ind_Menu =CALIBRATIE_ORP;//////////////////////////////////////////////////////////
                  cnta = 198;
               }
            delay_ms(50);
            }
      break;

      case RELAIS_1_SETP:   //Functie voor instellen van setpoint
         for(cnta=0;cnta<20;cnta++)
         {
            lcd_putc('\f');
            lcd_gotoxy(1,1);
            printf(lcd_putc,"Setpoint: %3.0w mV \n", Setpoint1); // Aan de hand van de gekozen schakelwaarde het setpoint weergeven en aanpassen
            delay_ms(50);
            if (input(op))
            {
               setpoint1++;
               if (setpoint1 > 999)
               {
                  setpoint1 = -999;
               }
            }
            else if (input(neer))
            {
               setpoint1--;
               if (setpoint1 < -999)
               {
                  setpoint1 = 999;
               }
            }
            else if((input(enter)))
            {
               ind_Menu = RELAIS_1_HYST;
               cnta = 18;
            }
            else if((input(menu)))
            {
               ind_Menu = RELAIS_1;
               cnta = 18;
            }
         }
       break;

       case RELAIS_1_HYST:
         lcd_putc('\f');
         lcd_gotoxy(1,1);
         printf(lcd_putc,"Hysterese: %3.0w mV \n", hysterese1); // Aan de hand van de gekozen schakelwaarde het setpoint weergeven en aanpassen
         delay_ms(100);
         if (input(op))
            Hysterese1++;
            if (hysterese1 > 50)
               {
                 hysterese1 = 1;
               }
         else if (input(neer))
            Hysterese1--;
               if (hysterese1 < 1)
               {
                  hysterese1 = 50;
               }
         else if((input(enter)))
            {
               ind_Menu = RELAIS_1;
            }
         else if((input(menu)))
            {
               ind_Menu = RELAIS_1;
            }
       break;


      case CALIBRATIE_ORP:   //Keuze menu calibratie orp
         lcd_putc('\f');
         lcd_gotoxy(1,1);
         printf(lcd_putc,"Menu\n");
         printf(lcd_putc,"Calibratie ORP\n");
         delay_ms(100);
         for(cnta=0;cnta<200;cnta++) //For loop om schakelaars af te vangen en 1sec te wachten voor het display verversen.
         {
            if((input(neer)))
            {
               ind_Menu = RELAIS_1;
               cnta = 198;
            }
            else if((input(op)))
            {
               ind_Menu = RELAIS_1;
               cnta = 198;
            }
            else if((input(enter)))
            {
               ind_Menu = CALIBRATIE_ORP_H;
               cnta = 198;
            }
            else if((input(menu)))
            {
               ind_Menu = WAARDEN;
               cnta = 198;
            }
        delay_ms(50);
        }
     break;

     case CALIBRATIE_ORP_H:   //Instellen van de hoge calibratie waarde van orp
        orp_functie();
        for(cnta=0;cnta<20;cnta++)
        {
           lcd_putc('\f');
           lcd_gotoxy(1,1);
           printf(lcd_putc,"ORP: %3.0w mV \n", ORP_ruw);
           printf(lcd_putc,"Cal. 1: %3.0w mV \n", CalH_ORP);
           delay_ms(100);
           if (input(op))
              CalH_ORP++;
              if (CalH_orp > 999)
              {
                 CalH_orp = 1;
              }
           if (input(neer))
              CalH_ORP--;
              if (CalH_orp == 0)
              {
                 CalH_orp = 999;
              }
           if((input(enter)))
           {
              orp_functie();
              MeaH_ORP = ORP_ruw;
              cnta = 18;
              ind_Menu = CALIBRATIE_ORP_L;
           }
           else if((input(menu)))
           {
              ind_Menu = WAARDEN;
              cnta = 198;
           }
        }
     break;

     case CALIBRATIE_ORP_L:
         orp_functie();
         for(cnta=0;cnta<20;cnta++)
         {
            lcd_putc('\f');
            lcd_gotoxy(1,1);
            printf(lcd_putc,"ORP: %3.0w mV \n", ORP_ruw);
            printf(lcd_putc,"Cal. 2: %3.0w mV \n", CalL_ORP);
            delay_ms(100);
            if (input(op))
               CalL_ORP++;
               if (CalL_orp > 999)
               {
                  CalL_orp = 1;
               }
            if (input(neer))
               CalL_ORP--;
               if (CalL_orp == 0)
               {
                  CalL_orp = 999;
               }
            if((input(enter)))
            {
               orp_functie();
               MeaL_ORP = ORP_ruw;
               cnta = 18;
               ind_Menu = CALIBRATIE_ORP;
            }
            else if((input(menu)))
            {
              ind_Menu = WAARDEN;
              cnta = 198;
            }
         }
      break;
         }
      }
}


Below are the FUSE settings in case this is useful
Code:

#include <18F2523.h>
//#device ICD=TRUE
#device adc=16
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT32768                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES PROTECT                //Code not protected from reading
#FUSES BROWNOUT               //No brownout reset    //////////
#FUSES BORV45                   //Brownout reset at 2.1V////////
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                 //Stack full/underflow will not cause reset  ////////
#FUSES DEBUG                    //Debug mode for use with ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOFCMEN                  //Fail-safe clock monitor disabled
#FUSES NOPBADEN                 //PORTB pins are configured as digital I/O on RESET
//#FUSES BBSIZ4K                  //4K words Boot Block size
#FUSES NOWRTC                   //Configuration registers not write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOCPB                    //No Boot Block code protection
#FUSES LPT1OSC                  //Timer1 configured for low-power operation
#FUSES NOMCLR                   //Master Clear pin used for I/O
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)

#use delay(clock=20000000)
temtronic



Joined: 01 Jul 2010
Posts: 9178
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 09, 2014 6:35 am     Reply with quote

hmm....
in your fuses as posted

#FUSES NOWDT //No Watch Dog Timer

needs to be
#FUSES WDT to 'enable' the WDT.


and...

I think that before you enable 'global interrupts' you should do all 'setup code'. Others will know for sure but the PIC might see an interrupt before the rest of the setup is complete, go to the ISR, do 'stuff' and not perform right as some 'setup' variables were not initialized with your default values.
Last thing I do before main() is to enable global interrupts so I've never seen it but it sounds like it could happen.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19383

View user's profile Send private message

PostPosted: Sun Nov 09, 2014 7:57 am     Reply with quote

No, he is enabling the watchdog in software.
On these chips, if disabled in the fuses it can be enabled by the SWDTEN bit (which WDT_ON sets).

Lots of potential problems, and the actual 'killer' at the bottom.

One potential problem is clearing the watchdog after enabling it.
If the watchdog has already triggered, this will result in a restart.
The watchdog needs to be cleared before enabling it.....

Other thing is don't assume the timings will be accurate. On these chips it "isn't bad" (controlled by the internal RC oscillator), but on most chips the 'nominal' time can vary between about 45% and 150%. Ouch.

Old comment applies 'ADC_CLOCK_INTERNAL', is _not_ recommended for use above 1MHz CPU clock rate. Read the data sheet.

Then the 'eeprom' code has me worried. Have you calculated just how quickly the EEPROM (or external EEPROM) can be killed by saving at regular intervals?. Not a good approach. Also what happens while the code is 'stuck' in this interrupt?.

Then the comment applies that was given in another thread. This is _not_ how to use a watchdog. If the chip is glitching, then look at a brownout reset instead. If using a watchdog, the restart_wdt, want to be setup so it can _only_ be reached, if the code is actually running properly. Testing that everything is working, and laid out so it cannot be reached if the code is executing something like a drunkard's walk (which is likely to happen with a brownout failure).

Then you have huge delays scattered around. A 50mSec delay, inside a 200* loop for example. Now this would (of course) give a watchdog restart with any divider less than 4096. Unfortunately, I know that the compiler will not actually program a WDT divider higher than WDT512 for this chip....
Load the LST file, and see what the watchdog timing is set to.
Diode



Joined: 27 Jul 2012
Posts: 35

View user's profile Send private message

PostPosted: Sun Nov 09, 2014 7:58 am     Reply with quote

Thanks for your answer. I was under the assumption that "SETUP_WDT(WDT_ON)" at the begin of the main was sufficient.
Got that out of the following link: http://www.ccsinfo.com/forum/viewtopic.php?t=24055&view=previous

Nevertheless I tried is as you described but it makes no difference.

I don't understand your comments about the global interrupts. All setup/initialization is done before I enable the global interrupt. Or do I miss something here?
Diode



Joined: 27 Jul 2012
Posts: 35

View user's profile Send private message

PostPosted: Sun Nov 09, 2014 8:10 am     Reply with quote

Just missed your answer Ttelmah. My previous comment has more or less be answered by your comment.

About the timings. For my application the timing is not precise. The controller may hang for a few seconds before it is rebooted. But if the WDT can't be higher as 512 then I will have a problem. That would result in a time of ~2 seconds under ideal conditions. My delays are longer...

If I open the list file I find the following:

Code:

.................... 
.................... #list
.................... 
.................... //#device ICD=TRUE
.................... #device adc=16
.................... #FUSES NOWDT                    //No Watch Dog Timer
.................... #FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
.................... #FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
.................... #FUSES PROTECT                //Code not protected from reading
.................... #FUSES BROWNOUT               //No brownout reset    //////////
.................... #FUSES BORV45                   //Brownout reset at 2.1V////////
.................... #FUSES NOPUT                    //No Power Up Timer
.................... #FUSES NOCPD                    //No EE protection
.................... #FUSES STVREN                 //Stack full/underflow will not cause reset  ////////
.................... #FUSES DEBUG                    //Debug mode for use with ICD
.................... #FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOWRT                    //Program memory not write protected
.................... #FUSES NOWRTD                   //Data EEPROM not write protected
.................... #FUSES NOIESO                   //Internal External Switch Over mode disabled
.................... #FUSES NOFCMEN                  //Fail-safe clock monitor disabled
.................... #FUSES NOPBADEN                 //PORTB pins are configured as digital I/O on RESET
.................... //#FUSES BBSIZ4K                  //4K words Boot Block size
.................... #FUSES NOWRTC                   //Configuration registers not write protected
.................... #FUSES NOWRTB                   //Boot block not write protected
.................... #FUSES NOEBTR                   //Memory not protected from table reads
.................... #FUSES NOEBTRB                  //Boot block not protected from table reads
.................... #FUSES NOCPB                    //No Boot Block code protection
.................... #FUSES LPT1OSC                  //Timer1 configured for low-power operation
.................... #FUSES NOMCLR                   //Master Clear pin used for I/O
.................... #FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
.................... 
.................... #use delay(clock=20000000)
*


It seems that it will not go higher as 128??
I have looked at the brownout reset but this doesn't help. My code can run for 1.5 hours and suddenly stall. It might have done 100 relay cycles without any problem.

About the Eeprom, at first this is a test. I might change the program in such a way that the eeprom routine only is called if any settings are changed. That would reduce the write cycles dramatically.

I will look at the datasheet for the ADC comment you gave.


Edit: solved the eeprom issue.
temtronic



Joined: 01 Jul 2010
Posts: 9178
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 09, 2014 10:09 am     Reply with quote

possible problem....

you have #FUSES DEBUG enabled

depending on the programmer you're using, it might 'reconfigure' the 'fuses' to a setup that isn't what you want.

I do not use the 'ICD' and never 'DEBUG' so others can confirm this operation. It has been mentioned before on the forum....

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19383

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 1:24 am     Reply with quote

The limit seems to be 512:

Code:

#fuses WDT1024
Configuration Fuses:
   Word  1: C200   HS FCMEN IESO
   Word  2: 121E   PUT BROWNOUT BORV21 NOWDT WDT512
   Word  3: 8700   CCP2C1 PBADEN LPT1OSC MCLR
   Word  4: 0081   STVREN NOLVP NOXINST NODEBUG
   Word  5: C00F   NOPROTECT NOCPB NOCPD
   Word  6: E00F   NOWRT NOWRTC NOWRTB NOWRTD
   Word  7: 400F   NOEBTR NOEBTRB

I had noted this ages ago, but it didn't matter to me, since if using the watchdog, I'd always use a few mSec, rather than much longer times.
Agree wholeheartedly with temtronic, DEBUG _will_ cause some fuses to be changed unexpectedly.
The fuse list in the .lst file is always 'where to look' to see what is actually being programmed.

I must admit I'd change the whole approach rather, and have the code doing the main loop at speed, and delays being done using a counter in a timer (see the recent thread about long times), and a similar timer for the watchdog. Then have 'status' events, which when they happen advance the count used for the watchdog interval, by a few hundred mSec.
Diode



Joined: 27 Jul 2012
Posts: 35

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 9:38 am     Reply with quote

Ttelmah, were can I find the information you showed? I found it under "C/ ASM List" which gives me a *.lst file. But your code layout seems different then mine.

I have replaced the debug for nodebug.

Your last comment I can not completely follow (perhaps because English is not my native language, and programming is quite hard for me).
If I understood correct you would the change the program. Mainly the for loops which are responsible for "reading" the switches (Enter, Op, Neer)?

@Jay, thanks for the tip, I replaced it as mentioned above.
Ttelmah



Joined: 11 Mar 2010
Posts: 19383

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 9:44 am     Reply with quote

The actual output fuses display right at the bottom of the file.
The input fuses display right at the top.

So I cut the several hundred lines between these.
Diode



Joined: 27 Jul 2012
Posts: 35

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 9:50 am     Reply with quote

Found it;
Code:
Configuration Fuses:
   Word  1: 0200   HS NOFCMEN NOIESO
   Word  2: 0E07   NOPUT BROWNOUT BORV45 NOWDT WDT128
   Word  3: 0500   CCP2C1 NOPBADEN LPT1OSC NOMCLR
   Word  4: 0001   STVREN NOLVP NOXINST DEBUG
   Word  5: C000   PROTECT NOCPB NOCPD
   Word  6: E00F   NOWRT NOWRTC NOWRTB NOWRTD
   Word  7: 400F   NOEBTR NOEBTRB


WDT is 128 while I declared it as 512?!?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 11:53 am     Reply with quote

Are you guys sure about this ? I installed vs. 5.018 and compiled a
simple program with the fuses shown in the first post, and I got this in
the .LST file. It's showing WDT32768.
Code:

Configuration Fuses:
   Word  1: 0200   HS NOFCMEN NOIESO
   Word  2: 1E07   NOPUT BROWNOUT BORV45 NOWDT WDT32768
   Word  3: 0500   CCP2C1 NOPBADEN LPT1OSC NOMCLR
   Word  4: 0001   STVREN NOLVP NOXINST DEBUG
   Word  5: C000   PROTECT NOCPB NOCPD
   Word  6: E00F   NOWRT NOWRTC NOWRTB NOWRTD
   Word  7: 400F   NOEBTR NOEBTRB

I tried your 2nd test and changed it to WDT512. It shows WDT512 in
the .LST file. Maybe re-install your compiler.

Test program:
Code:

#include <18F2523.h>
//#device ICD=TRUE
#device adc=16
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT32768                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES PROTECT                //Code not protected from reading
#FUSES BROWNOUT               //No brownout reset    //////////
#FUSES BORV45                   //Brownout reset at 2.1V////////
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                 //Stack full/underflow will not cause reset  ////////
#FUSES DEBUG                    //Debug mode for use with ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOFCMEN                  //Fail-safe clock monitor disabled
#FUSES NOPBADEN                 //PORTB pins are configured as digital I/O on RESET
//#FUSES BBSIZ4K                  //4K words Boot Block size
#FUSES NOWRTC                   //Configuration registers not write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOCPB                    //No Boot Block code protection
#FUSES LPT1OSC                  //Timer1 configured for low-power operation
#FUSES NOMCLR                   //Master Clear pin used for I/O
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)

#use delay(clock=20000000)

//============================
void main()
{

setup_wdt(WDT_ON);

while(TRUE);
}
 
Diode



Joined: 27 Jul 2012
Posts: 35

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 12:30 pm     Reply with quote

More strange things happen. I changed the oscillator from HS to INTRC but in the LST file nothing changes after compiling and rebuilding the project.
The time stamp at the top of the LST file does change.
temtronic



Joined: 01 Jul 2010
Posts: 9178
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 12:54 pm     Reply with quote

...
#FUSES DEBUG //Debug mode for use with ICD

...

I'd change to NODEBUG and see what happens...

also HOW are you programming the PIC? What device/software gets the code into the PIC? THAT software could be changing 'stuff' !!

jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 1:01 pm     Reply with quote

Un-install the compiler. Then re-install it and let it use the default paths.
Diode



Joined: 27 Jul 2012
Posts: 35

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 1:03 pm     Reply with quote

Jay, I did change the program as you described. I'm programming the PIC via CCSload and a ICD-U64.

@PCM, will give it a try.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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