English
Language : 

PIC17C7XX_13 Datasheet, PDF (113/306 Pages) Microchip Technology – High-Performance 8-bit CMOS EPROM Microcontrollers with 10-bit A/D
PIC17C7XX
13.2.3 READING THE CAPTURE
REGISTERS
The Capture overflow status flag bits are double buff-
ered. The master bit is set if one captured word is
already residing in the Capture register and another
“event” has occurred on the CAPx pin. The new event
will not transfer the TMR3 value to the capture register,
protecting the previous unread capture value. When
the user reads both the high and the low bytes (in any
order) of the Capture register, the master overflow bit is
transferred to the slave overflow bit (CAxOVF) and
then the master bit is reset. The user can then read
TCONx to determine the value of CAxOVF.
An example of an instruction sequence to read capture
registers and capture overflow flag bits is shown in
Example 13-1. Depending on the capture source, dif-
ferent registers will need to be read.
EXAMPLE 13-1: SEQUENCE TO READ CAPTURE REGISTERS
MOVLB 3
MOVPF CA2L, LO_BYTE
MOVPF CA2H, HI_BYTE
MOVPF TCON2, STAT_VAL
; Select Bank 3
; Read Capture2 low byte, store in LO_BYTE
; Read Capture2 high byte, store in HI_BYTE
; Read TCON2 into file STAT_VAL
TABLE 13-6: REGISTERS ASSOCIATED WITH CAPTURE
Address
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR,
BOR
MCLR, WDT
16h, Bank 3 TCON1
CA2ED1 CA2ED0 CA1ED1 CA1ED0 T16 TMR3CS TMR2CS TMR1CS 0000 0000 0000 0000
17h, Bank 3 TCON2
CA2OVF CA1OVF PWM2ON PWM1ON CA1/PR3 TMR3ON TMR2ON TMR1ON 0000 0000 0000 0000
16h, Bank 7 TCON3
12h, Bank 2 TMR3L
13h, Bank 2 TMR3H
16h, Bank 1 PIR1
17h, Bank 1 PIE1
10h, Bank 4 PIR2
11h, Bank 4 PIE2
07h, Unbanked INTSTA
— CA4OVF CA3OVF CA4ED1 CA4ED0 CA3ED1 CA3ED0 PWM3ON -000 0000 -000 0000
Holding Register for the Low Byte of the 16-bit TMR3 Register
xxxx xxxx uuuu uuuu
Holding Register for the High Byte of the 16-bit TMR3 Register
xxxx xxxx uuuu uuuu
RBIF TMR3IF TMR2IF TMR1IF CA2IF CA1IF TX1IF RC1IF x000 0010 u000 0010
RBIE TMR3IE TMR2IE TMR1IE CA2IE CA1IE TX1IE RC1IE 0000 0000 0000 0000
SSPIF BCLIF
ADIF
—
CA4IF CA3IF TX2IF RC2IF 000- 0010 000- 0010
SSPIE BCLIE
ADIE
—
CA4IE CA3IE TX2IE RC2IE 000- 0000 000- 0000
PEIF T0CKIF T0IF
INTF
PEIE T0CKIE T0IE
INTE 0000 0000 0000 0000
06h, Unbanked CPUSTA
—
—
STKAV GLINTD
TO
PD
POR
16h, Bank 2 PR3L/CA1L Timer3 Period Register, Low Byte/Capture1 Register, Low Byte
17h, Bank 2 PR3H/CA1H Timer3 Period Register, High Byte/Capture1 Register, High Byte
14h, Bank 3 CA2L
Capture2 Low Byte
15h, Bank 3 CA2H
Capture2 High Byte
12h, Bank 7 CA3L
Capture3 Low Byte
13h, Bank 7 CA3H
Capture3 High Byte
14h, Bank 7 CA4L
Capture4 Low Byte
15h, Bank 7 CA4H
Capture4 High Byte
Legend: x = unknown, u = unchanged, - = unimplemented, read as '0', q = value depends on condition.
Shaded cells are not used by Capture.
BOR
--11 11qq --11 qquu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
 1998-2013 Microchip Technology Inc.
DS30289C-page 113