I am a beginner at PIC programming and am trying to get timer0 to work as an event counter on external pin T0CK1.
The basic program structure is:
movlw b'00110000' ; Make TMR0 a counter (pull-ups on
movwf OPTION_REG ; T0CK1 enable, falling edge, no pre-scaler
movf TMR0, w
I have a switch connected to T0CK1 that pulls the pin low when pressed and LEDS connected to PORTC to see TMR0 value. I would expect to see the LEDS increment with each button press, but instead I have to press 256 times to see TMR0 increment. Is this how timer0 is supposed to behave as an event counter on an external pin? I have tried different pre-scaler values and nothing has any effect. I am obviously missing something, can someone help me out,
0 · ·