1. Alho

    Thread Starter New Member

    Nov 3, 2011
    12
    0
    how can i start timing using TMR0 (PIC16F887) with a pushbutton input?
    how can i write the C code for this using micrC?

    any help?
    thankx
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Set bit0 (TMR0ON) in T0CON register to 1 if the input is high.

    if (pin_x==1) //don't know what the actual command is in microC
    {

    TMR0ON=1; //don't know what the actual command is in microC

    }
     
    Alho likes this.
  3. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Mik3, I believe the register to which you refer (T0CON) does not exist.
     
    Alho likes this.
  4. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Alho likes this.
  5. Alho

    Thread Starter New Member

    Nov 3, 2011
    12
    0
    actually i need to measure time (20 seconds) delay before an output pin goes HIGH.
    the time should start when the button is pressed....
     
Loading...