Searching \ for '[PIC]:time limited polling ?' 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/microchip/time.htm?key=time
Search entire site for: 'time limited polling ?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:time limited polling ?'
2001\04\17@144746 by pang khong lin

picon face
Hi,

Wonder if anyone has a better idea. The problem is this, I need to poll a
particular bit continuosly for at least 1 min. How can i poll the bit and at
the same time, check for the 1 min limit? The psuedo code looks like this -

Some statements ....

Poll for bit A

if bit A Low then
  check for 1 min limit
  if 1 min over then stop polling and Goto some statements
  if 1 min not over then go back Polling for bit A again
  endif
end if

if bit A high then move forward and execute other statements


the period 1 min does not have to be exact. i am using a pic16f84A-10.
my simple brain tells me to use the Timer0 interrupt, and whenever overflow
occurs, counterA is incremented inside the ISR. CounterB will be incremented
when counterA overflows. For each overflows of counterA there will be a
0.026 sec lapse and for each overflows of counterB, a 6.658 sec lapse. then
another counterC will be needed to achieve a period lapse of at least 1 min.

Can it be simpler? Thanks

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\04\17@180632 by Olin Lathrop

face picon face
> Wonder if anyone has a better idea. The problem is this, I need to poll a
> particular bit continuosly for at least 1 min. How can i poll the bit and
at
> the same time, check for the 1 min limit?

That depends on what "continuously" means.  What is the maximum time you can
tolerate between successive checks of the input pin?

If that time is long enough, you can have the main loop check the pin, then
check the time, then do it all again.  If that results in too long a delay
between successive checks, then you will need some sort of interrupt method.
Note that since you can't afford the cycles to check the time in the event
check loop, you can't afford the same cycles in an interrupt routine either.
In that case, it is the external pin event that needs to be interrupt
driven.  The foreground loop can then do the 1 minute timeout.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


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