Timer1 can operate in three modes:
• Synchronous Timer Mode
• Synchronous Counter Mode
• Asynchronous Counter Mode
Timer1 in timer mode
Clear TMR1CS (T1CON<1>) to select TMR1 in timer mode. In this mode, the input clock of the timer is the internal clock frequency divided by 4 (FOSC/4). Because the internal clock is always synchronized, the synchronization control bit T1SYNC (T1CON<2>) has no effect at this time.
Timer1 in Synchronous Counter Mode
Set TMR1CS (T1CON<1>) to 1 to select TMR1 in counter mode. In this mode, the counter increments on every rising edge of the input clock at pin T1OSI (when T1OSCEN is set to 1) or T1OSO/T1CK (when T1OSCEN is cleared to 0). If the T1SYNC bit is cleared to 0, the external clock input is synchronized with the internal phase clock, and the synchronization is done after the prescaler. The prescaler is an asynchronous ripple counter. In synchronous counter mode, when operating in sleep mode, even if an external clock is used, Timer1 will not increment because the synchronization circuit is turned off, but the prescaler continues to increment. When Timer1 operates in synchronous counter mode, the external input clock signal must meet certain requirements, mainly because it must be synchronized with the internal phase clock (TOSC). After synchronization, there will be a certain delay between the actual increment count of Timer1 and the external clock edge. When the prescaler ratio is 1:1, the external input clock and the prescaler output are the same. T1CKI is synchronized with the internal phase clock by sampling the prescaler output at two adjacent Tosc internal phase clocks. Therefore, the high and low levels of the signal on the T1CKI pin are required to be at least 2Tosc (plus a small RC delay) respectively. When the prescaler ratio is other than 1:1, the external input clock signal must first be divided by the asynchronous ripple counter prescaler to make the prescaler output symmetrical. In order for the external clock to meet the sampling requirements, the ripple counter must be taken into account
. Therefore, the signal on the T1CKI pin is required to be at least 4Tosc (plus a small RC delay) for the prescaler to divide. In addition, the clock signal on the T1CKI pin must also meet the minimum pulse width requirements for the high and low levels.
Timer1 in Asynchronous Counter Mode
When T1SYNC (T1CON<2>) is set, the external clock input is not synchronized. Timer1 continues to count up asynchronously to the internal phase clock. In sleep mode, Timer1 will continue to run and generate an interrupt when it overflows to wake up the processor. However, special attention should be paid to the reading and writing of Timer1 in software. The asynchronous counter can work when the device is in sleep mode, so Timer1 can be used to implement a real-time clock. In asynchronous counter mode, Timer1 cannot be used as a working time base for capture or comparator.
Timer1 Oscillator
The crystal oscillator circuit is internally connected between the T1OSI (amplifier input) and T1OSO (amplifier output) pins and is enabled by setting the T1OSCEN control bit (T1CON<3>). This oscillator is a low power oscillator with a frequency of up to 200kHz. It can continue to operate in sleep mode. The generally recommended frequency is 32kHz, which is an ideal frequency for generating a real-time clock. Table 12-1 shows the external capacitors required for different crystal oscillator frequencies. The Timer1 oscillator is a low speed low power (LP) oscillator. The user should use a
certain software delay when the Timer1 oscillator starts to work to ensure that the oscillator starts reliably first.
Table 12-1: Capacitor selection table for Timer1 oscillator
Note: This allows the counter to continue to work (increment) in sleep mode, so Timer1 can be used to generate a real-time clock.
Oscillator Type
Tested crystals:
32.768 kHz Epson C-001R32.768K-A ± 20 PPM
100 kHz Epson C-2 100.00 KC-P ± 20 PPM
200 kHz STD XTL 200.000 kHz ± 20 PPM
Note 1: Increasing the capacitance improves the stability of the oscillator, but also increases the start-up time of the oscillator.
2: Since each resonator/crystal has its own characteristics, the user should consult the resonator/crystal manufacturer for appropriate external component values.
Registers related to Timer1
Previous article:PIC16F877 Timer2 and CCP module PWM
Next article:Timer0 of PIC16F877
Recommended ReadingLatest update time:2024-11-16 15:23
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- MSP430 MCU Development Record (3)
- Free draw! Tektronix will build your first oscilloscope in your life, and there are also speakers, wireless chargers, and telescopes waiting for you!
- 【K210 Series】1. Show off the K210 development board
- FPGA Practice (II) 8 LED Lights on and off and Flowing Lights
- Helping startups~21 Maxim evaluation boards are here! Free redemption in progress!
- Commonly used algorithms for drones - Kalman filter (XI)
- How to choose 18650 charging IC?
- Questions about AD9361
- New breakthrough: Domestic chip BAC201 challenges small size, low power consumption, low cost and high integration
- CC2530 key flow