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

PIC12F629 WD+sleepmode no Working

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



Joined: 22 Jan 2011
Posts: 3

View user's profile Send private message

PIC12F629 WD+sleepmode no Working
PostPosted: Mon Nov 13, 2017 9:36 am     Reply with quote

why this line have error in CCS ?
setup_wdt(WDT_ON);

setup_wdt(WDT_2304MS|WDT_DIV_16); //~2.3 s reset


Please send example Source code for PIC12f629 WDT and sleep mode.
temtronic



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

View user's profile Send private message

PostPosted: Mon Nov 13, 2017 9:50 am     Reply with quote

Have a look at the header for that PIC.
12F629.h

Are those 3 options available ??
Ttelmah



Joined: 11 Mar 2010
Posts: 12971

View user's profile Send private message

PostPosted: Mon Nov 13, 2017 11:19 am     Reply with quote

Also look at the data sheet.

What is the longest time the watchdog is quoted to give?. 2304mSec....

Does the watchdog on this chip have an option to disable in software?. No.....

CCS can only give you options the chip actually has.
lpln852



Joined: 22 Jan 2011
Posts: 3

View user's profile Send private message

PostPosted: Mon Nov 13, 2017 11:31 am     Reply with quote

Thanks

How about sleep mode ?
temtronic



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

View user's profile Send private message

PostPosted: Mon Nov 13, 2017 12:08 pm     Reply with quote

Yes that PIC has a sleep mode according to the datasheet, special features chapter. It's also noted in the device header that CCS supplies.
Ttelmah



Joined: 11 Mar 2010
Posts: 12971

View user's profile Send private message

PostPosted: Mon Nov 13, 2017 12:59 pm     Reply with quote

Code:

#include <12F629.h>

#FUSES WDT                      //Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOBROWNOUT               //No brownout reset

#use delay(int=4000000)

void main()
{
   setup_wdt(WDT_2304MS); //program 2 sec (approx)
   setup_comparator(NC_NC);
   while (TRUE)
   {
     output_toggle(PIN_A0);
     sleep();
     delay_cycles(1); //nop instruction after sleep   
   }
}


This will toggle pin A0 just over every couple of seconds (but beware the WDT time is _very_ approximate - about 1.7 secs to about 2.6 secs), while the chip will sleep almost all the time.
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