Searching \ for '[OT] Coding Techniques' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=coding+techniques
Search entire site for: 'Coding Techniques'.

Exact match. Not showing close matches.
PICList Thread
'[OT] Coding Techniques'
2010\02\07@165014 by Marcelo Rodrigues

picon face
Hi All

I`m developing a program and it have to do basically 4 tasks:

1 - read 4 push-buttons
2 - process the commands according to the read buttons
3 - load a screen in the internal buffer
4 - write the buffer to the LCD

The push-button read function, once called, takes about 4ms, each button is
read in intervals of 1ms and LCD write function, once called, takes about
32ms, each of the 32 characters are written in intervals of 1ms.

My question is about the hardware interfacing functions (1 and 4), which is
the best frequency to call them?

I`ve already tried to call them in intervals of 100ms, it worked, but is it
the best way to do it? or it is better to call them in the main loop of the
code with no time interval?

--
Marcelo dos Santos Rodrigues

2010\02\07@225510 by Vitaliy

face
flavicon
face
Marcelo Rodrigues wrote:
{Quote hidden}

For a simple application like this, calling the functions in the main loop
as fast as possible seems like the simplest solution. You really only want
to synchronize to a tick when timing is important.

Vitaliy

2010\02\08@012619 by Wouter van Ooijen

face picon face
> I`ve already tried to call them in intervals of 100ms, it worked, but is it
> the best way to do it? or it is better to call them in the main loop of the
> code with no time interval?

AFAIK the 'general wisdom' is that contact bounce lasts no longer than
50 ms, so that determines the maximum frequency (20 Hz). The minimum
frequency is determined by the feeling of responsiveness. If your 10 Hz
feels OK, by all means stick to that.

--

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu

2010\02\08@012808 by Wouter van Ooijen

face picon face
> For a simple application like this, calling the functions in the main loop
> as fast as possible seems like the simplest solution.

But it might complicate contact-bounce handling.

--

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu

2010\02\08@123507 by M. Adam Davis

face picon face
On Sun, Feb 7, 2010 at 4:50 PM, Marcelo Rodrigues <spam_OUTmsrmailTakeThisOuTspamgmail.com> wrote:
> I`ve already tried to call them in intervals of 100ms, it worked, but is it
> the best way to do it? or it is better to call them in the main loop of the
> code with no time interval?

There are good reasons to go one way or the other based on your requirements.

If you have no requirements either way, then you might as well stick
with 100mS intervals as it seems to be suitable, and you won't have
any issues with the user interface response time being variable based
on what the rest of the system is doing.

-Adam

2010\02\08@140057 by Paul Hutchinson

picon face
> -----Original Message-----
> From: .....piclist-bouncesKILLspamspam@spam@mit.edu On Behalf Of Wouter van Ooijen
> Sent: Monday, February 08, 2010 1:26 AM
>
> > I`ve already tried to call them in intervals of 100ms, it
> worked, but is it
> > the best way to do it? or it is better to call them in the main
> loop of the
> > code with no time interval?
>
> AFAIK the 'general wisdom' is that contact bounce lasts no longer than
> 50 ms, so that determines the maximum frequency (20 Hz). The minimum
> frequency is determined by the feeling of responsiveness. If your 10 Hz
> feels OK, by all means stick to that.

A great introduction to debouncing is Jack Ganssle's "A Guide to
Debouncing".
http://www.ganssle.com/debouncing.pdf


Paul Hutch

>
> Wouter van Ooijen
>
> -- -------------------------------------------
> Van Ooijen Technische Informatica: http://www.voti.nl
> consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: http://www.voti.nl/hvu

More... (looser matching)
- Last day of these posts
- In 2010 , 2011 only
- Today
- New search...