QUESTIONS & ANSWERS
Mailbag Continued ...
detect a complete cycle from push to release could be
used before entering the code to be acted upon.
Contact bounce, of course, brings in its own little
problems that can be solved either with hardware or in
software. For those not familiar with contact bounce, it
is the mechanical “bounce” of the metal contacts as
they first hit until they settle down in a continuous
closed contact. Computers are fast enough to see this
as several closing and opening cycles of the switch. If
not compensated for, software will be all over the place
when one intention is a single event. In software, one
would detect the first contact closure, wait a short time
for bounce to stop, then if desired, wait for the first
nonclosure, and again a short debounce delay, and then
continue on with code for a momentary pushed button
as desired in this project. Other projects may need to
operate only as long as the button is closed. Hope this
helps someone out there.
Sorry if this got a little long, but there are issues
here in real time code that programmers should be
aware of if they want their systems to behave as they
intended and to interact with humans in a user friendly
manner.
— Evan Wasserman
Thanks very much for taking the time to analyze the
code. Looking at it now, I don’t understand why it
worked (just as I don’t understand why it doesn’t work
sometimes). Your suggestion for the HOLD loop is a
good one. I should have thought of that. I am aware of
the contact bounce problem but figured that the PAUSE
1000 would take care of it. The code could have been
better, as you pointed out, but I am still learning. The
program that I use (Microcode Studio) automatically
puts reserved words in bold.
Dear Russell: Re: Irrigation Timer August ‘ 10, Page
22.
I always read your column with great interest. I was
wondering whether the circuit needs to be protected
from indirect surges. My sprinkler timer (the Champion
PR-90) has protection (a MOV) at each terminal block. A
ribbon cable runs from each terminal block to the PCB
in the controller (a surge will hit the MOV before it hits
the solid-state components). There could also be some
additional protection on the PCB. Also, the PR-90
sprinkler timer allows the times to be digitally adjusted
from 10% to 300% to change watering times depending
upon the temperature, humidity, etc. The PR-90 sprinkler
timer allows each zone time to be adjusted from 10
seconds to one minute in five second increments; one
minute to one hour in one minute increments; and one
hour to 12 hours in 10 minute increments which seems
adequate to fulfill the needs for the drip irrigation
system without any additional circuitry.
— Alan Sciacca
Response: Thanks for the info, Alan. Readers may
be interested to know a commercial unit is available.
November 2010 29