| Electronic Components Datasheet Search |
|
PIC16C781 Datasheet(PDF) 53 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16C781 Datasheet(HTML) 53 Page - Microchip Technology |
|
53 / 186 page ![]() 2001 Microchip Technology Inc. Preliminary DS41171A-page 51 PIC16C781/782 5.0 TIMER0 MODULE The Timer0 module timer/counter has the following features: • 8-bit timer/counter • Readable and writable • Internal or external clock select • Edge select for external clock • 8-bit software programmable prescaler • Interrupt on overflow from FFh to 00h Figure 5-1 is a simplified block diagram of the Timer0 module. Additional information on timer modules is available in the PICmicro™ Mid-Range Reference Manual, (DS33023). 5.1 Timer0 Operation Timer0 can operate as either a timer or a counter. Programming Timer0 is via the OPTION register (see Register 2-2). Timer0 mode is selected by clearing/setting the bit T0CS (OPTION_REG<5>). In Timer mode (T0CS = 0), the Timer0 module increments every instruction cycle (without prescaler). If the TMR0 register is written, the increment is inhibited for the following two instruction cycles. The user can work around this by writing an adjusted value to the TMR0 register. Counter mode is selected by setting bit T0CS (OPTION_REG<5>). In Counter mode, Timer0 increments either on every rising, or falling edge of pin RA4/T0CKI. The incrementing edge is determined by the Timer0 Source Edge Select bit T0SE (OPTION_REG<4>). Clearing bit T0SE selects the ris- ing edge, setting selects the falling edge. Restrictions on the external clock input are discussed below. When an external clock input is used for Timer0, it must meet certain requirements. The requirements ensure the external clock can be synchronized with the internal system clock. Also, there is a delay in the actual incre- menting of Timer0 after synchronization. Additional information on external clock requirements is available in the PICmicro™ Mid-Range Reference Manual, (DS33023). EXAMPLE 5-1: INITIALIZING TIMER0 ;* This code block will configure Timer0 ;* for Polling, internal clock & 1:16 ;* prescaler ;* ;* Wait for TMR0 overflow code included BANKSEL TMR0 ; Select Bank 0 CLRF TMR0 ; Clear Timer0 ; Register BANKSEL OPTION_REG ; Select Bank 1 MOVLW B’11000011’ ; INT on L2H MOVWF OPTION_REG ; Internal clk, ; pscaler 1:16 ******************************************** ;* Wait for TMR0 overflow ;* T0_OVFL_WAIT TBFSS INTCON,T0IF ; Check for TMR0 ; overflow GOTO T0_OVFL_WAIT ; If clear, test ; again BCF INTCON,T0IF ; Clear interrupt FIGURE 5-1: TIMER0 BLOCK DIAGRAM Note 1: T0CS, T0SE, PSA, PS<2:0> (OPTION_REG<5:0>). 2: The prescaler is shared with Watchdog Timer (refer to Figure 5-2 for detailed block diagram). RA4/T0CKI T0SE 0 1 1 0 pin T0CS FOSC/4 Programmable Prescaler Sync with Internal Clocks TMR0 PSOUT (2 TCY Delay) PSOUT Data Bus 8 PSA PS<2:0> Set Interrupt Flag bit T0IF on Overflow 3 |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |