PIC16F628-04I/P Microchip Technology Inc., PIC16F628-04I/P Datasheet - Page 50

no-image

PIC16F628-04I/P

Manufacturer Part Number
PIC16F628-04I/P
Description
18 PIN, 3.5 KB FLASH, 224 RAM, 16 I/O
Manufacturer
Microchip Technology Inc.
Datasheet

Specifications of PIC16F628-04I/P

Comparators
2
Cpu Speed
5 MIPS
Eeprom Memory
128 Bytes
Input Output
16
Interface
SCI/USART
Memory Type
Flash
Number Of Bits
8
Package Type
18-pin PDIP
Programmable Memory
3.5K Bytes
Ram Size
224 Bytes
Speed
20 MHz
Timers
2-8-bit, 1-16-bit
Voltage, Range
2-5.5 V
Lead Free Status / Rohs Status
RoHS Compliant part Electrostatic Device

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC16F628-04I/P
Quantity:
7
Part Number:
PIC16F628-04I/P
Quantity:
5 510
Part Number:
PIC16F628-04I/P
Manufacturer:
VISHAY
Quantity:
5 510
Part Number:
PIC16F628-04I/P
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
PIC16F62X
7.3
If control bit T1SYNC (T1CON<2>) is set, the external
clock input is not synchronized. The timer continues to
increment asynchronous to the internal phase clocks.
The timer will continue to run during SLEEP and can
generate an interrupt on overflow which will wake-up
the processor. However, special precautions in soft-
ware are needed to read/write the timer (Section 7.3.2).
In Asynchronous Counter mode, Timer1 can not be
used as a time-base for capture or compare
operations.
7.3.1
If control bit T1SYNC is set, the timer will increment
completely asynchronously. The input clock must meet
certain minimum high-time and low-time requirements.
Refer to the appropriate Electrical Specifications
section, Timing Parameters 45, 46, and 47.
7.3.2
Reading TMR1H or TMR1L while the timer is running,
from an external asynchronous clock, will ensure a
valid read (taken care of in hardware). However, the
user should keep in mind that reading the 16-bit timer
in two 8-bit values itself poses certain problems since
the timer may overflow between the reads.
For writes, it is recommended that the user simply stop
the timer and write the desired values. A write
contention may occur by writing to the timer registers
while the register is incrementing. This may produce an
unpredictable value in the timer register.
Reading the 16-bit value requires some care.
Example 7-1 is an example routine to read the 16-bit
timer value. This is useful if the timer cannot be
stopped.
DS40300C-page 48
Timer1 Operation in
Asynchronous Counter Mode
EXTERNAL CLOCK INPUT TIMING
WITH UNSYNCHRONIZED CLOCK
READING AND WRITING TIMER1 IN
ASYNCHRONOUS COUNTER
MODE
Preliminary
EXAMPLE 7-1:
; All interrupts are disabled
;
; TMR1L may have rolled over between the read
; of the high and low bytes. Reading the high
; and low bytes now will read a good value.
;
; Re-enable the Interrupts (if required)
CONTINUE
MOVF
MOVWF
MOVF
MOVWF
MOVF
SUBWF
BTFSC
GOTO
MOVF
MOVWF
MOVF
MOVWF
TMR1H, W
TMPH
TMR1L, W
TMPL
TMR1H, W
TMPH,
STATUS,Z
CONTINUE
TMR1H, W
TMPH
TMR1L, W
TMPL
W
READING A 16-BIT FREE-
RUNNING TIMER
 2003 Microchip Technology Inc.
;Read high byte
;
;Read low byte
;
;Read high byte
;Sub 1st read
; with 2nd read
;Is result = 0
;Good 16-bit read
;Read high byte
;
;Read low byte
;
;Continue with your code

Related parts for PIC16F628-04I/P