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

i use pic16f77 i/p, but repeat reset...

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



Joined: 01 Mar 2005
Posts: 2
Location: korea

View user's profile Send private message Send e-mail MSN Messenger

i use pic16f77 i/p, but repeat reset...
PostPosted: Wed Mar 02, 2005 5:41 am     Reply with quote

my source is

#fuses WDT
#include <16f77.h>
#byte d=8
#use delay(clock=4000000)

main() {
char led;
set_tris_d(0);
led=1;
delay_ms(30);
while(1) {
do{
d=led;
led <<= 1;
if(led==0) led = 1;
}
while(1);
}
}

just led on_off..
why repeat reset?
i don't know. let me know please..
i'm sorry. i'm not good speaking english.
have a good day..
Paolino



Joined: 19 Jan 2004
Posts: 42

View user's profile Send private message

Watch dog
PostPosted: Wed Mar 02, 2005 5:49 am     Reply with quote

Your code uses the WatchDog. It is resetting the PIC. So, insert setup_wdt(WDT_2304MS) and restart_wdt(). Try now.

#fuses WDT
#include <16f77.h>
#byte d=8
#use delay(clock=4000000)

main() {
char led;
set_tris_d(0);

setup_wdt(WDT_2304MS);

led=1;
delay_ms(30);
while(1) {
do{
restart_wdt();
d=led;
led <<= 1;
if(led==0) led = 1;
}
while(1);
}
}


Optimize the code: it is not necessary insert a while-do cycle into a while(1) cycle...

Regards.

Paolo.
ryuinseung



Joined: 01 Mar 2005
Posts: 2
Location: korea

View user's profile Send private message Send e-mail MSN Messenger

thank you for your reply... ^^
PostPosted: Thu Mar 03, 2005 4:10 am     Reply with quote

and the pic-programer wdt-disable(option).
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