0% found this document useful (0 votes)
104 views

Timer1 Module: Pic 16F877 Lecture Series

The document describes the Timer1 module of the PIC16F877 microcontroller. It has a 16-bit timer/counter, two 8-bit registers to store the timer value, and a prescaler. Timer1 can operate as a timer that increments each instruction cycle or as a counter that increments on each rising edge of an external clock. It also describes the Timer1 control register and associated registers, and provides an example of using Timer1 in timer and counter modes with interrupts.

Uploaded by

Guru Moorthi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views

Timer1 Module: Pic 16F877 Lecture Series

The document describes the Timer1 module of the PIC16F877 microcontroller. It has a 16-bit timer/counter, two 8-bit registers to store the timer value, and a prescaler. Timer1 can operate as a timer that increments each instruction cycle or as a counter that increments on each rising edge of an external clock. It also describes the Timer1 control register and associated registers, and provides an example of using Timer1 in timer and counter modes with interrupts.

Uploaded by

Guru Moorthi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

TIMER1 MODULE

PIC 16F877 LECTURE SERIES


TIMER 1 FEATURES
16 BIT TIMER/ COUNTER 2

TWO 8-BIT REGISTERS (TMR1H AND TMR1L)


WHICH ARE READABLE AND WRITABLE

DEDICATED PRESCALER

CAN WORK ON INTERNAL OR EXTERNAL


CLOCK
TIMER1 CAN OPERATE IN ONE OF TWO
MODES:
• As a Timer
• As a Counter

In Timer mode, Timer1 increments every instruction


cycle. In Counter mode, it increments on every rising
edge of the external clock input on pin T1CKI.
TMR1 IN TIMER MODE
TIMER1 IN COUNTER MODE
TIMER1 CONTROL REGISTER –
T1CON
T1CON contd..
T1CON contd..
REGISTERS ASSOCIATED WITH TIMER1
AS A TIMER/COUNTER
IN Enable Master Interrupt BSF INTCON,

TI GIE
BSF INTCON,
PEIE
M Load Count TMR1H:
TMR1L
MOVLW,
MOVWF

E *RELOAD COUNT
IN TMR1H:TMR1L BSF PIE1,
Enable Timer 1 Interrupt
R *CLEAR TMR1IF
TMR1IE

M *RETFIE Configure T1CON


uu PS1 PS0 oscen
/SYNC tmr1cs
TMR1ON
O
D INT
Set
YE
S
PIR1<TMR1IF>
SET

E- ? Go to ISR –
LOCATION 0X04

IN
T END
TIM
CLEAR TMR1H:TMR1L
ER1 CLRF

AS SETUP PORTC AS INPUT USE TRISC


ASY
NC CONFIGURE T1CON TMRCS =1, /SYNC =
1
CO
SWITCH ON TIMER1
UNT BSF T1CON,
TMR1ON
ER – CLEAR TMR1IF
CLEAR
POL T1CKI =
0
POLL
TMR1I
T1CKI =
1
TMR1H:TMR1L
GOTO SUB_R
LIN
POLL BTFSS PIR1,TMR1IF
F

G GOTO POLL END

You might also like