From: "petrus bitbyter"
Subject: Re: detecting long press 8051 - PCF8574
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
Date: Tue, 15 Oct 2002 08:49:50 GMT
NNTP-Posting-Date: Tue, 15 Oct 2002 10:49:50 MET DST
Organization: chello broadband
Reserve a (one) byte to save the last known status of your switches/buttons.
When an interrupt occurs, you first have to handle bounce. Then you can
compare the actual status with the saved one and continue according to the
changes you found. Don't forget to update the last known status. Among the
actions you can perform on an interrupt are starting, stopping or checking a
timer. So further action does not only depend on the changing of the
switches/buttons but also on the timer status.
"pjoeter" schreef in bericht
> Hello experts,
> I'm making a datalogger to store adc values into a nvram (and
> displaying it on a lcd and ....),
> i have 5 switches (channel select, method, read nvram) and 3 push
> buttons(up, down, start/stop), these are all connected to a i2c
> device: pcf8574
> everytime a status of one of the switches/pushbuttons changes, the
> pcf8574 generates an interrupt and the 8051 jumps to its interrupt
> but now, i want the following: if i press for a relative long time on
> the up-pushbutton the datalogger shows the last value in the nvram, if
> i push a long time on the down-pushbutton -> first value
> if i press both (up & down) for a relative long time: the 8051 will
> erase all the values stored in the nvram
> can i do this all in the interrupt routine? or are there better
> Thanks !!