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 support@ccsinfo.com

Is there a cheat sheet for delays we should use

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



Joined: 06 Jan 2014
Posts: 31

View user's profile Send private message

Is there a cheat sheet for delays we should use
PostPosted: Sun Feb 02, 2014 7:32 pm     Reply with quote

Hi,

Is there a cheat sheet for delays that we use after state changes, i2c com., serial com., or after some functions like printf, fprintf etc.

If you can share any usage of delays that you think it is helpful i can arrange all and make a cheat sheet which i think would be awesome and need.

Thanks.
_________________
Hardware-Software Developer
Physics Engineer
Ceo airVision Aerial Video and Photography
Ceo Massive Robotics

ccs c ide version: 4.110
Pic: 16F877
Ttelmah



Joined: 11 Mar 2010
Posts: 19447

View user's profile Send private message

PostPosted: Mon Feb 03, 2014 2:04 am     Reply with quote

It's called the data sheet, for the device you are talking to.... Smile

Nothing universal about delays needed anywhere.
temtronic



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

View user's profile Send private message

PostPosted: Mon Feb 03, 2014 6:27 am     Reply with quote

Entire books could be written about 'delays' in programs.
Important things to remember though are..
1) inline delays like delay_ms(nn) force the PIC to ONLY do the delay and nothing else.

2) it's best to use timers and interrupts for accurate,predictable program flow.

3) all switches 'bounce' and must have 'debounce' either in hardware(caps) or software(delays).Values are based upon the device characteristics

4) peripherals like I2C,UART,etc.can have a 'done' flag which an be polled or best, used as interrupt for faster response

5)the overall purpose of the program dictates whether you can use inline or ISR type delays.Something like an 'alarm system' only needs 1/4second response so inline is fine but a 'laser range finder' needs fast (<1ms) response so ISR is needed.

6) the actual 'need' for the delay is based upon what the software is supposed to do with the hardware so there is no 'one' answer to the question.

hth
jay
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