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
Information needed on S/W WATCHDOG Timer
-
- Posts: 18
- Joined: Fri Feb 26, 2010 5:05 am
Information needed on S/W WATCHDOG Timer
Last edited by keshavamurthy k.c on Thu Mar 25, 2010 1:58 pm, edited 1 time in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: S/W WATCHDOG Timer
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 18
- Joined: Fri Feb 26, 2010 5:05 am
Re: Information needed on S/W WATCHDOG Timer
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Information needed on S/W WATCHDOG Timer
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 18
- Joined: Fri Feb 26, 2010 5:05 am
Re: Information needed on S/W WATCHDOG Timer
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Information needed on S/W WATCHDOG Timer
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 18
- Joined: Fri Feb 26, 2010 5:05 am
information needed on capture signal form pin RC5/CCP1
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
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