16-bit Timer for PIC18F452

Status
Not open for further replies.

angadaria

Junior Member level 2
Joined
Mar 23, 2011
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,434
hi i m trying to learn the timer for PIC18F452...please anyone can help me out about how to configure the timer and how to use TMR1L and TMR1H registers...



many thanks
akshay gadaria
 

Last edited:

hi thank you for your suggestions both of you..
accordingly i tried to write the basic code on my own just to check the overflow of the timer but it is not working. timer overflow flag is not getting set.
i m using PIC16F877A with 8MHz frequency and i m using MikroC PRo for PIC IDE. can u please check the code and let me know what is the error or what is missing?

void main()
{
TRISC=0x00; //configure port c as an o/p port
while(1)
{
PIE1=0x01; //enables the timer1 overflow interrupt
PIR1=0x00; //clear the timer overflow flag
INTCON=0xc0; //enables the global and peripheral interrupt
T1CON |=(1<<TMR1ON); //start the timer
while(TMR1IF==0); //polling the overflow flag
PORTC=0x55;
PIR1=0x00; //clear the interrupt flag
}
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…