Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
PIC 16f684 timer0 question
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 · ·