View previous topic :: View next topic |
Author |
Message |
palyancodr
Joined: 06 Jan 2014 Posts: 31
|
Is there a cheat sheet for delays we should use |
Posted: Sun Feb 02, 2014 7:32 pm |
|
|
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: 19548
|
|
Posted: Mon Feb 03, 2014 2:04 am |
|
|
It's called the data sheet, for the device you are talking to....
Nothing universal about delays needed anywhere. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Mon Feb 03, 2014 6:27 am |
|
|
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 |
|
|
|