 myself Ravindra Chauhan, Assistant Professor, Department of Electronics Engineering, Valshand Dilsthoff, Technology, Solapur. So in this session, we will going to discuss how the timer one in peak 16F 877 microcontroller operates and how it can be used for the different applications. Coming from this session, at the end of this session, student can demonstrate the operation of timer one in peak 16F 877 microcontroller. Student can also implement the timer one functionality in different applications. Outline of this session, the first part, the special function registers which are associating with the timer one operation, then how the timer one operates and lastly the how timer one can be configured for the different modes of operation. In peak 16F 877, there are three timers called the timer zero, timer one and timer two. The timer zero is the eight-bit and it can be used as a timer or as a counter. Timer one is of 16-bit and it also can be used as a timer or as a counter while timer two is eight-bit and only we can operate in the timer mode. The major features of the timer one in peak 16F 877 are it is the 16-bit timer and counter means the timer registers are of 16-bit and this value will increment from its initial count and goes up to its maximum value that is F F F F and from that it rolls over to the zero zero. Timer one can be used as a timer or as a counter. Timer mode is to be used to get the required time delay and timer one has to operate in the counter mode when there is a need to count some external events. So timer one can operate on internal clock or on external clock. The timer registers we can read and also we can write. That's why the timer registers we are saying as a readable and writable. So the timer one is having pre-scaler at the input clock is pre-scaler mainly it is used to change the frequency of the clock and pre-scaler can be used to get the more amount of delay by keeping the same clock frequency and same initial count. The timer one can also operate on internal clock or external clock. Interrupt on overflow from F F F F to zero zero zero means when timer registers value is changing from its maximum that is the F F F F to zero zero timer one interrupt is occur. The special function registers associating with the timer one. The timer one module is a 16 bit timer slash counter which consists of two 8 bit registers namely TMR1H and TMR1L means timer one higher byte and timer one lower byte. These two registers are readable and writable and the TMR1 register is formed by the 8 bit registers TMR1H and TMR1L and this timer one registers increments from its initial count it may be a zero zero zero or the required count to F F F F and rolls over to zero zero zero H and timer interrupt will be occurred. T1 con register that is the timer one control register is to be used to control the operation of timer one. This is the specified bit format of the timer one control register. The higher two bits MSB bits are not defined for any functionality. The next two higher bits which are called the input clock prescale select bits means these are associating with the prescalar which will decide the prescale rate or accordingly the frequency of the input clock will be changed. Now when the two bits that is the timer one clock prescalar one and prescalar zero when these two bits are zero zero the prescale value will be one as to one means whatever the input clock to the prescalar that will be remain same. When these two bits are zero one then the prescale value will be one as to two means whatever the input clock that will be gets divided by two and so on for one zero the prescale value is one as to four and for one one it is one as to eight. Then the next bit is called the timer one oscillator enable control bit so this timer one is having its own internal oscillator which can be enabled or disabled as per the requirement. So when this timer oscillator enable bit is one the oscillator will be enabled and to disable the internal oscillator then timer one oscillator enable bit should be reset. Then the next bit is timer one synchronization bit. So this bit can be used to synchronize the external clock input. So this bit is having the meaning when we are selecting the external clock external clock for the timer one. So when this T1 sync bit is one the do not synchronize the external clock input means the timer one will operate on unsynchronized clock and when zero we will get the synchronized external clock. Now timer one clock source select bit is to be used to select either external clock or internal clock. Now external clock should be selected when we are going to operate the timer one in counter mode and when there is need to operate in the timer mode the timer one CS bit must be zero. So when timer one CS is set the timer will be operate on external clock applied on port cpin rc0 and in timer mode to select the internal clock timer one CS bit must be reset. Now to turn on and off the one bit is provided that is called the timer one on bit. So when this timer one on bit is one the timer will be enable or it will be run and to stop the timer one reset the timer one on bit. Now how the timer one operates? So timer one is increment either on every instruction cycle or on external clock applied at rc0 slash timer one clock input. Now you pause the video and think how to select timer or counter mode of timer one. Now to select the timer or counter mode use timer one clock select bit from timer one control register. Now for the timer mode make timer one CS equal to zero and to operate in the counter mode you set the bit timer one CS and the timer one will operate on external clock. This is the working block diagram of the timer one. So here the timer one oscillator is shown which accepts the external clock applied on the pin rc0. Now this oscillator can be turned on or off by making the bit timer one oscillator enable. If oscillator will be enable then the oscillator output will be goes to the this first multiplexer. Now this first multiplexer is used to select either the internal clock that is the oscillator frequency divided by four or the external clock applied on rc0 pin. And this multiplexer is controlled by the bit timer one CS. If timer one CS is zero internal clock will goes to the prescalar or if it is one then external clock will go to the prescalar. Now this prescalar can be operate on the clock prescalar bits and the rate is decided by the value of these two bits. Then here we are getting the synchronized and unsynchronized clock and one of this will be get selected by making the timer one sync bit and when timer one is on then on each clock cycle this timer one register will increment and when it rolls over the timer one interrupt flag will be set. Now for setup of timer one first select the timer or counter mode then use the prescalar bits to select prescalar rate then put the initial count in timer register turn on the timer one by making the use of timer one on bit then the timer register will increment and rolls over from ff to 00 and timer one interrupt flag will set. The references used for this the peak data sheet and microcontrollers by Ajay Deshmukh. Thank you.