Paul & Lynn Tyrer escreveu: > 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. (aft= er > 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 gall= on > usage in my house using a hall effect switch on the meter. > > Can anyone help me with code/ suggestions etc > > Thanks in advance > > Paul > = Hello, I would suggest you to move to a newer PIC, such as 16F628A or 16F88. If you already managed to show a message on the LCD, then you went already 99% of the path. Just make an infinite loop and wait until some pin changes from low-to-high and high-to-low again (or vice-versa), then increase some counter (one byte variable). When your counter reaches 50, clear it to zero and increment another counter (possibly a two-byte variable) and update the value on the LCD. If you are using assembly, you will need to convert the counter value to a string to show on the LCD. If you are using C, then you just can use "printf", it is much easier. If you need further help, let me know. Best regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist