![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
oscillot Guest
|
restart_cause() not working |
Posted: Tue Dec 03, 2002 6:05 am |
|
|
Hello all,
I'm trying to get the WDT working on my PIC16F877, to no avail. I'm compiling on PIC C 2.71 btw. Right now I'm kind of hoping that someone here can provide me some guidance.
None of the other tips on this message board worked for me. I'm sure there must be something really trivial I am forgetting here. Let me indulge you with some code:
(in the .h file)
#include <16F877.h>
#device ICD=TRUE
#use delay(clock=38400,RESTART_WDT)
#fuses LP,WDT,NOPROTECT,NOPUT,NOBROWNOUT,NOLVP
#use rs232(baud=1200,parity=N,xmit=PIN_C6,rcv=PIN_C7)
(in the .c file)
void main() {
fillIndex=restart_cause();
set_rtcc(0);
....
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_counters(RTCC_INTERNAL,WDT_2304MS);
switch(fillIndex){
case WDT_TIMEOUT:
do stuff
case NORMAL_POWER_UP:void main() {
fillIndex=restart_cause();
set_rtcc(0);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(FALSE);
setup_psp(PSP_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
output_bit(PIN_D2,1); // warm up the TX mux
output_bit(PIN_D3,1);
setup_counters(RTCC_INTERNAL,WDT_2304MS);
switch(fillIndex){
case WDT_TIMEOUT:
{
// do something
}
case NORMAL_POWER_UP:
{
// do something else
}
.....
}
Basically I am trying to cause a WDT reset under certain conditions in the receive buffer. Everything works fine for me when the WDT is disabled, and I even get it to restart when I want it to, but restart_cause() just refuses to do anything but return "NORMAL_POWER_UP." Any ideas?
___________________________
This message was ported from CCS's old forum
Original Post ID: 9719 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: restart_cause() not working |
Posted: Tue Dec 03, 2002 12:54 pm |
|
|
:=Hello all,
:=
:=I'm trying to get the WDT working on my PIC16F877, to no avail. I'm compiling on PIC C 2.71 btw. Right now I'm kind of hoping that someone here can provide me some guidance.
-------------------------------------------------------
Try this simple demo program. (You will have to modify
the #use delay frequency and change HS to LP, etc.)
<a href="http://www.pic-c.com/forum/general/posts/9073.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/9073.html</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 9733 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|