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

delay_ms not delaying

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



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

delay_ms not delaying
PostPosted: Thu Jun 15, 2006 12:49 pm     Reply with quote

when i put in delay_ms() code i have no delay
my use command:

Code:

#use delay(clock=4000000)


i also get the 'Interrupts disabled during call to prevent re-entrancy:' warning, but when i comment every delay I have, it only removes one of the warnings, i still have 3 more. all warnings point to the last line of my main code.

my code is basically:
send command
wait n seconds to fill serial buffer
read off buffer etc.

interrupts work, and when i first entered the delay_ms command it did work

what more info should i put? anyone have this problem?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 15, 2006 1:12 pm     Reply with quote

If you feel that you must put a delay inside an isr, and you don't
want to see that warning message, then tell the compiler to create
a 2nd instance of the delay library by adding a 2nd #use delay()
statement as shown in bold below. That way, the isr and the
code in main() (and beyond) will each have their own separate
delay routines.
Quote:
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#int_ext
void int_ext_isr(void)
{

delay_ms(1);
}


#use delay(clock = 4000000)
//======================
void main()
{
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);

while(1)
{
printf("Hello World\n\r");
delay_ms(100);
}

}
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Thu Jun 15, 2006 1:30 pm     Reply with quote

i don't have a delay_ms inside the interrupt, its in a function

i have also commented out all delay_ms commands and still get the warnings

i would like to know why i still get them
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 15, 2006 1:35 pm     Reply with quote

There must be some function that you're calling from inside the isr
and outside as well. It would help if you could post a small but
complete test program.
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Thu Jun 15, 2006 2:05 pm     Reply with quote

recopied all of the code into a new project and that seems to of cleared up the warnings...

it now works
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