Hi Paul, I still consider myself a newbie so treat my suggestions accordingly. The way I would tackle it is to use a flip-flop flag that toggles when A0 changes state. Then only update a counter when both the flag is clear and A0 is high. some thing like clrf counter bcf flag,0 Loop1: if (flag == 0 and A0 ==1) bsf flag,0 incf counter,f check for overflow and update a second counter and so on if needed else if(A0 ==0) bcf flag,0 end if end if do divide by 50 update lcd goto Loop1 hope this helps. If you got an lcd to work converting the rough pseudo code above should be straight forward. Interrupt on change may also be an option but I cant remember if '84 supports this. 2009/10/23 Paul & Lynn Tyrer > Hi all. > I am trying to make a switch counter that would put on the lcd screen how > many times /50 the switch has been opened/closed. > > I purchased the Book PIC In Practice and have been successfull in building > the LCD circuit 2x20 and able to put the words i need to the screen. (after > spending hours trying to get it to work) > > What i need and am hopelessly lost at this point, is to count the switch on > A0 and put the amount on to the screen. using the lcd Code in the above > book. > > I beg you, this is not for any other purpose than to count the water gallon > usage in my house using a hall effect switch on the meter. > > Can anyone help me with code/ suggestions etc > > Thanks in advance > > Paul > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist