Page 1 of 1

Information needed on S/W WATCHDOG Timer

Posted: Thu Mar 25, 2010 12:14 pm
by keshavamurthy k.c
Hi,
I want to use internel watchdog timer in PIC 16F946 controller using Flow code compiler.
Please provide me information how i need enable, disable and also i want to load value using configuration register.


Regards
Keshav

Re: S/W WATCHDOG Timer

Posted: Thu Mar 25, 2010 1:27 pm
by Benj
Hello,

You can simply enable using the configuration. Then use the C code "clear_wdt();" in your program to prevent the watchdog timing out and resetting your microcontroller.

Re: Information needed on S/W WATCHDOG Timer

Posted: Thu Mar 25, 2010 2:02 pm
by keshavamurthy k.c
Hi,
thanks for replying .If i use clear_wdt(); what time the watch dog timer will reset.
And also i want to know how to change the watch dog reset timing value.

Regards
madhusdhan

Re: Information needed on S/W WATCHDOG Timer

Posted: Thu Mar 25, 2010 3:18 pm
by Benj
Hello,

The watchdog prescaler setting is available as part of the option_reg register.

option_reg = option_reg | 0x08; //Assign prescaler to watchdog
option_reg = option_reg & 0xF8; //Mask off prescaler setting
option_reg = option_reg | 0x07; // Change prescaler setting to 1:128

The bottom line could be replaced with any of these

option_reg = option_reg | 0x07; // Change prescaler setting to 1:128
option_reg = option_reg | 0x06; // Change prescaler setting to 1:64
option_reg = option_reg | 0x05; // Change prescaler setting to 1:32
option_reg = option_reg | 0x04; // Change prescaler setting to 1:16
option_reg = option_reg | 0x03; // Change prescaler setting to 1:8
option_reg = option_reg | 0x02; // Change prescaler setting to 1:4
option_reg = option_reg | 0x01; // Change prescaler setting to 1:2
option_reg = option_reg | 0x00; // Change prescaler setting to 1:1

Again this code will need to be included in a C code icon at the start of your program.

Re: Information needed on S/W WATCHDOG Timer

Posted: Fri Mar 26, 2010 8:37 am
by keshavamurthy k.c
Hi,
I gone through PIC 16F946 data sheet if we want to use both internel watchdog timer and timer0 interupt we need to change configuration by selecting PSA bit.
In my project i want to scan key for every 1msec using timer0 interupt,if i enable watchdog timer also i am not getting Timer0 interupt scan data.
Can you please provide information how i need to handle.


Thanks & Regards
Keshav

Re: Information needed on S/W WATCHDOG Timer

Posted: Fri Mar 26, 2010 11:00 am
by Benj
Hello,

You cannot use timer0 and the watchdog timer in your program without switching one or the other off. You can use the timer 1 instead of timer 0 if you wish, this should work fine.

information needed on capture signal form pin RC5/CCP1

Posted: Sat Mar 27, 2010 6:16 am
by keshavamurthy k.c
HI
I am using pic 16f946 microcontroller.i written custom interrupt for capture signal from input pin rc5/ccp1.
custom interrupt its working fine my problem is i am unable to copy from register ccpr1l and ccpr1h flow code variable.
i written code for copy from register ccpr1l and ccpr1h :
FCV_AVGCCPR=CCPR1L|(8<<CCPR1H);
after copy from ccpr1l and ccpr1h register value into flowcode varaiable AVGCCPRL value moving into UART directely .
i am getting some junk value .

please suggest me how to solve this problem