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

using delay_ms()

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



Joined: 24 Jul 2012
Posts: 163

View user's profile Send private message

using delay_ms()
PostPosted: Mon Mar 12, 2018 2:45 pm     Reply with quote

Got a simple application where I am doing nothing but monitoring a signal and then sending the calculated frequency via serial. My frequency range is between 1 and 2 hz so very slow relatively speaking.

My question is the event I am watching has some ring to it so to keep from picking up multiple events per event, I merely use a delay_ms(400) to add some time to allow the signal to stabilize. My question is do interrupts like RTCC continue to work while a long delay_ms() call is made? should I break that into say a 10 ms delay and a for loop to get the time?

Comments on this topic welcome.

16F876 running 4mhz mplab 8.91 CCS version 5.064
Ttelmah



Joined: 11 Mar 2010
Posts: 19536

View user's profile Send private message

PostPosted: Mon Mar 12, 2018 3:18 pm     Reply with quote

Interrupts are serviced.

If you look in the manual:
Quote:

The delay time may be longer than requested if an interrupt is serviced during the delay. The time spent in the ISR does not count toward the delay time.


So if your interrupts use a lot of time, you may end up taking longer than 400mSec.
beaker404



Joined: 24 Jul 2012
Posts: 163

View user's profile Send private message

PostPosted: Mon Mar 12, 2018 3:22 pm     Reply with quote

Thanks, my interrupt is very small, only index a variable and return is all. So I should be ok.
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