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 CCS Technical Support

PIC18F26K80 strange delay_ms() problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kahnm



Joined: 30 Apr 2007
Posts: 9

View user's profile Send private message

PIC18F26K80 strange delay_ms() problem
PostPosted: Fri Dec 19, 2014 11:10 am     Reply with quote

Processor PIC18F26K80
Compiler Version 4.141

delay_ms(250) seems to work in the following LED blink demo code but delay_ms(500) does not. No blinking occurs.

What's going on?

In other code (not for this processor) I've used more than a byte in delay_ms.

Any help will be greatly appreciated.

Code:

//PIC18F26JK80
#include <18F26K80.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES VREGSLEEP_SW             //Ultra low-power regulator is enabled
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES LP                       //Low power osc < 200 khz
#FUSES NOBROWNOUT               //No brownout reset
#FUSES WDT_NOSLEEP              //Watch Dog Timer, disabled during SLEEP
#FUSES INTRC_IO                  //RA6 & RA7 are IO

#use delay(clock=16000000)

#use FIXED_IO( A_outputs=PIN_A7)



void main()
{

   setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_31250|OSC_PLL_OFF);

   while(1)
   {
   
      OUTPUT_LOW(PIN_A7);
   
      delay_ms(500); 
   
      OUTPUT_HIGH(PIN_A7);
   
      delay_ms(500); 
   
   }

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 19, 2014 11:30 am     Reply with quote

Get rid of the fuse shown in bold below. You are enabling the WDT:
Quote:
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES VREGSLEEP_SW //Ultra low-power regulator is enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES LP //Low power osc < 200 khz
#FUSES NOBROWNOUT //No brownout reset
#FUSES WDT_NOSLEEP //Watch Dog Timer, disabled during SLEEP
#FUSES INTRC_IO //RA6 & RA7 are IO
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Dec 19, 2014 12:07 pm     Reply with quote

also LP. There should only be one oscillator fuse.
kahnm



Joined: 30 Apr 2007
Posts: 9

View user's profile Send private message

PostPosted: Fri Dec 19, 2014 1:09 pm     Reply with quote

Took out the watchdog and that solved it.
Also took out LP.

Thanks a million!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion 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