|
Basic concepts on TMR1 peripheral (PIC18F46K22) |
||
TMR1 - TMR3 - TMR5 have similar architecture
Study peripheral timer TMR1 architecture and configuration possibilities.
a)
b)
c) |
Fig 1. Simplified hardware components (a kind of RTL view) of the TMR1 of the Microchip PIC18F46K22 from its datasheet. a) TMR1 16-bit counter. b) Architecture, c) Secondary oscillator circuit. |
CSD_PICstick design phase #3 shows how to use TMR1 as a counter of external oscillator pulses for timing: a) 1 Hz and b) 12 Hz interrupts. In this application var_CLK_flag is the same as var_TMR1_flag.
|
Fig 2. Interpretation of TMR1 architecture using CSD conventions. Thus, a var_TMR1_flag is generated in the ISR() when the hardware TMR1IF interrupt is set after a timing period TP = TSOSC · N1 · N2 |
T1SOSCEN = 1
SOSCGO = 1