• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem in using timer1 as counter in PIC 16f877

Status
Not open for further replies.

akj

New Member
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 :mad:. 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
 

Attachments

Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top