+ Reply to Thread
Results 1 to 2 of 2

Thread: Problem in using timer1 as counter in PIC 16f877

  1. #1
    akj
    akj is offline
    akj Newbie
    Join Date
    Apr 2009
    Posts
    1

    Default Problem in using timer1 as counter in PIC 16f877

    Dear all

    I am using pic16f877 for reading the no. of rotation of encoder. I am using TIMER1 as counter.The problem is that even when I am not connecting the encoder wire to the RC0 or RC1 pin the value of timer register keeps changing. I am sending the value of timer register to UART. I have even tried making TMR1ON=0 but the value kept changing . My current settings of timer are :-(pls. note "//" indicates comment line, btw I am using HiTechC compiler)
    //START OF Configuration of different bits of T1CON
    T1CKPS0=0;
    T1CKPS1=0;//prescaler is 1:1
    T1OSCEN=1;//for pin RC1 as external clock input
    T1SYNC=1;// DO NOT SYNCHRONIZE TO EXTERNAL CLOCK INPUT
    TMR1CS=1;//for external clock as rising edge
    TMR1ON=1;//Stop/start Timer

    //End OF Configuration of different bits of T1CON


    Pls. help urgently.

    I have attached the .c file and uart output for your reference.

    Regs.

    AKJ
    Attached Files


  2. #2
    Russ Hensel Okay
    Join Date
    Sep 2007
    Location
    South Dartmouth
    Posts
    125

+ Reply to Thread

Similar Threads

  1. GPR problem with 16f877
    By kvrajasekar in forum Micro Controllers
    Replies: 3
    Latest: 19th February 2009, 01:50 AM
  2. counter using pic 16f877
    By josi in forum Micro Controllers
    Replies: 17
    Latest: 4th July 2008, 11:32 AM
  3. PIC is Timer1 good for a frequency counter?
    By William At MyBlueRoom in forum Micro Controllers
    Replies: 11
    Latest: 18th June 2006, 02:44 PM
  4. PIC 16F877 Timer1
    By spurnymart in forum Micro Controllers
    Replies: 6
    Latest: 13th November 2004, 02:04 PM
  5. 16F877 communication problem!
    By liupengjian in forum Micro Controllers
    Replies: 3
    Latest: 5th July 2004, 09:47 AM

Tags for this Thread