Hi Leonardo,
Mr E. has done a great job (As usual!) of providing code for you. But if you wired your project as shown in the drawing then this is where you are having the difficulty.
In your .bmp image you show using pull down resistors. This means your inputs are at 0vdc until the button is pressed and when you press the push button you are applying +5vdc. Your code is looking for 0v to create the activity to occur.
"if clreep=0 then ' is ClrEEP pushbutton is pressed
write 0,0 ' Reset the pulse count in EEPROM
led=1 ' LED = ON
pause 1000 ' wait 1 sec
led=0 ' LED=OFF
endif '
Read 0, Apulse ' Read count from internal eeprom
repeat
if clkin=0 then
while clkin=0 : wend
pause 50"
Turn on the internal weak pull ups and tie the other end of your push buttons to ground. To protect the PIC's inputs put 100 ohm resistors in line with the swtich and also tie MCLR to +5vdc through a 1k resistor.
This should solve your problem.
BobK
Bookmarks