Hello mister e,

Excellent the code but like you reset the eeprom from some pin?.

Thanks


Quote Originally Posted by mister_e
to prevent adding any additional hardware to save count result when you remove the power, use the following
Code:
@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _BODEN_ON 

    TRISB=%00000001     ' Set RB0 to input, others to output
    
    OPTION_REG.7=0      ' Enable internal pull-up on PORTB
                           
    LED    VAR PORTB.7  ' connected between RB7 and GND via resistor
    ClkIn  var PORTB.0  ' connected between RB0 and GND
    
    Apulse VAR BYTE     ' store the amount of pulse
    Data @0,0 ' set count @ 0 at programming time
    
    led=0
    Read 0, Apulse ' Read count from internal eeprom

    repeat
        if clkin=0 then
            while clkin=0 : wend
            pause 50
            apulse=apulse+1
            WRITE 0,apulse ' save count in the internal EEPROM
            endif
        until apulse=10
    led=1

Here:
    goto here
this should work