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

WDT not working on PIC16F723A

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



Joined: 02 Jun 2010
Posts: 74

View user's profile Send private message

WDT not working on PIC16F723A
PostPosted: Wed Nov 23, 2011 8:28 am     Reply with quote

Code:
#INCLUDE<16F723A.h>
#FUSES WDT, HS, NOPLLEN,BORV25,  PROTECT
#USE DELAY(clock = 4000000)
#USE FAST_IO(ALL)

void main(void){
    setup_WDT(WDT_18MS);
    delay_ms(500);
    while(1){
        output_bit(PIN_B0, !input(PIN_B0));
        delay_ms(250);
    }

}


The code should never reach while(1) part because WDT should reset it during the delay portion. however, it still goes to while(1) to toggle the port pin. I don't know if it is compiler error? or am I doing something wrong? I am using compiler version 4.127 Thanks
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Wed Nov 23, 2011 9:00 am     Reply with quote

You're using fast io, but you don't set any io pins to output. That means your pin won't toggle. So therefore I'm wondering how you know its got into the while loop. Must be you're using a debugger. I have a very strong feeling that the watchdog is disabled automatically while debugging....

So how are you determining what's happening?

While the CCS compiler certainly has some bugs. and they can be pretty annoying, it should hardly be the first call for program malfunctions. Put another way, always assume you've made the error until you've proved beyond any doubt that you haven't. I've found CCS bugs, and noted changes, but I've tested and tested until I'm absolutely sure I can blame the compiler before ever mentioning it to anyone. I know my programs contain my bugs: some of them really subtle, some of them downright stupid programming 101 head-palm [spam]-ups, but at least I'm sure they are all mine.

RF Developer
hello188



Joined: 02 Jun 2010
Posts: 74

View user's profile Send private message

PostPosted: Thu Nov 24, 2011 7:23 am     Reply with quote

Sorry, It was curtailed version of the original program. The original program sets the pins as output using set_tris function.
I found the problem was that I compiled the code using DEBUG option on MPLAB IDE. Changing that to RELEASE solved the problem.

Thank you for your attention.
temtronic



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

View user's profile Send private message

PostPosted: Thu Nov 24, 2011 10:59 am     Reply with quote

hello188

You can have MPLAB default the build configuration to 'release' instead of 'debug'.
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