PIC 16f877a Data Sheet
PIC 16f877a Data Sheet
Data Sheet
28/40/44-Pin Enhanced Flash
Microcontrollers
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip's Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
MCLR/VPP 1 28 RB7/PGD
RA0/AN0 2 27 RB6/PGC
RA1/AN1 3 26 RB5
PIC16F873A/876A
RA2/AN2/VREF-/CVREF 4 25 RB4
RA3/AN3/VREF+ 5 24 RB3/PGM
RA4/T0CKI/C1OUT 6 23 RB2
RA5/AN4/SS/C2OUT 7 22 RB1
VSS 8 21 RB0/INT
OSC1/CLKI 9 20 VDD
OSC2/CLKO 10 19 VSS
RC0/T1OSO/T1CKI 11 18 RC7/RX/DT
RC1/T1OSI/CCP2 12 17 RC6/TX/CK
RC2/CCP1 13 16 RC5/SDO
RC3/SCK/SCL 14 15 RC4/SDI/SDA
MCLR/VPP
RB7/PGD
RB6/PGC
RA1/AN1
RA0/AN0
28-Pin QFN
RB5
RB4
28
27
26
25
24
23
22
RA2/AN2/VREF-/CVREF 1 21 RB3/PGM
RA3/AN3/VREF+ 2 20 RB2
RA4/T0CKI/C1OUT 3 19 RB1
PIC16F873A
RA5/AN4/SS/C2OUT 4 18 RB0/INT
VSS 5 PIC16F876A 17 VDD
OSC1/CLKI 6 16 VSS
OSC2/CLKO 7 10 15 RC7/RX/DT
12
13
14
11
8
9
RC4/SDI/SDA
RC6/TX/CK
RC2/CCP1
RC3/SCK/SCL
RC5/SDO
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2
44-Pin QFN
RC3/SCK/SCL
RC4/SDI/SDA
RC6/TX/CK
RC2/CCP1
RD3/PSP3
RD2/PSP2
RD1/PSP1
RD0/PSP0
RC5/SDO
44
43
42
41
40
39
38
37
36
35
34
RC7/RX/DT 1 33 OSC2/CLKO
RD4/PSP4 2 32 OSC1/CLKI
RD5/PSP5 3 31 VSS
RD6/PSP6 4 30 VSS
RD7/PSP7 5 29 VDD
VSS
PIC16F874A VDD
6 28
VDD 7 PIC16F877A 27 RE2/CS/AN7
VDD 8 26 RE1/WR/AN6
RB0/INT 9 25 RE0/RD/AN5
RB1 10 24 RA5/AN4/SS/C2OUT
RB2 11 23 RA4/T0CKI/C1OUT
22
12
13
14
15
16
17
18
19
20
21
RA2/AN2/VREF-/CVREF
NC
RB6/PGC
RB7/PGD
RA3/AN3/VREF+
MCLR/VPP
RB3/PGM
RB4
RB5
RA0/AN0
RA1/AN1
40-Pin PDIP
MCLR/VPP 1 40 RB7/PGD
RA0/AN0 2 39 RB6/PGC
RA1/AN1 3 38 RB5
RA2/AN2/VREF-/CVREF 4 37 RB4
RA3/AN3/VREF+ 5 36 RB3/PGM
RA4/T0CKI/C1OUT 6 35 RB2
PIC16F874A/877A
RA5/AN4/SS/C2OUT 7 34 RB1
RE0/RD/AN5 8 33 RB0/INT
RE1/WR/AN6 9 32 VDD
RE2/CS/AN7 10 31 VSS
VDD 11 30 RD7/PSP7
VSS 12 29 RD6/PSP6
OSC1/CLKI 13 28 RD5/PSP5
RA2/AN2/VREF-/CVREF
OSC2/CLKO 14 27 RD4/PSP4
RC0/T1OSO/T1CKI 15 26 RC7/RX/DT
RA3/AN3/VREF+
RC1/T1OSI/CCP2 16 25 RC6/TX/CK
RC2/CCP1 17 24 RC5/SDO
MCLR/VPP
RB7/PGD
RB6/PGC
RC3/SCK/SCL 18 23 RC4/SDI/SDA
RA1/AN1
RA0/AN0
RD0/PSP0 19 22 RD3/PSP3
RB5
RB4
RD1/PSP1 20 21 RD2/PSP2
NC
NC
44-Pin PLCC
6
5
4
3
2
1
44
43
42
41
40
RA4/T0CKI/C1OUT 39 RB3/PGM
7
RA5/AN4/SS/C2OUT 8 38 RB2
RE0/RD/AN5 9 37 RB1
RE1/WR/AN6 10 36 RB0/INT
RE2/CS/AN7 11 PIC16F874A 35 VDD
VDD 12 34 VSS
VSS 13
PIC16F877A 33 RD7/PSP7
OSC1/CLKI 14 32 RD6/PSP6
OSC2/CLKO 15 31 RD5/PSP5
RC0/T1OSO/T1CK1 16 30 RD4/PSP4
NC 17 9 RC7/RX/DT
18
19
20
21
22
23
24
25
26
27
282
RC1/T1OSI/CCP2
RC3/SCK/SCL
RC4/SDI/SDA
RC6/TX/CK
RC2/CCP1
RD3/PSP3
RD2/PSP2
RD1/PSP1
RD0/PSP0
RC5/SDO
RC1/T1OSI/CCP2
RC2/CCP1
RC3/SCK/SCL
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RC5/SDO
NC
RC4/SDI/SDA
RC6/TX/CK
NC
44-Pin TQFP
44
43
42
41
40
39
38
37
36
35
34
RC7/RX/DT 1 33 NC
RD4/PSP4 2 32 RC0/T1OSO/T1CKI
RD5/PSP5 3 31 OSC2/CLKO
RD6/PSP6 4 30 OSC1/CLKI
RD7/PSP7 5 PIC16F874A 29 VSS
VSS 6 28 VDD
VDD 7
PIC16F877A 27 RE2/CS/AN7
RB0/INT 8 26 RE1/WR/AN6
RB1 9 25 RE0/RD/AN5
RB2 10 24 RA5/AN4/SS/C2OUT
RB3/PGM 11 23 RA4/T0CKI/C1OUT
12
13
14
15
16
17
18
19
20
21
22
RB4
RB5
RA0/AN0
RA1/AN1
RA2/AN2/VREF-/CVREF
NC
NC
RB6/PGC
RB7/PGD
RA3/AN3/VREF+
MCLR/VPP
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
• The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (include liter-
ature number) you are using.
Synchronous Voltage
Data EEPROM CCP1,2 USART Comparator Reference
Serial Port
PORTE
RE1/WR/AN6
RE2/CS/AN7
Timer2 Parallel
Timer0 Timer1 10-bit A/D Slave Port
Synchronous Voltage
Data EEPROM CCP1,2 USART Comparator Reference
Serial Port
PC<12:0> PC<12:0>
13 CALL, RETURN 13
CALL, RETURN
RETFIE, RETLW RETFIE, RETLW
Stack Level 1
Stack Level 1
Stack Level 2
Stack Level 2
17FFh
1800h
Page 3
1FFFh
1FFFh
Indirect addr.(*) 00h Indirect addr.(*) 80h Indirect addr.(*) 100h Indirect addr.(*) 180h
TMR0 01h OPTION_REG 81h TMR0 101h OPTION_REG 181h
PCL 02h PCL 82h PCL 102h PCL 182h
STATUS 03h STATUS 83h STATUS 103h STATUS 183h
FSR 04h FSR 84h FSR 104h FSR 184h
PORTA 05h TRISA 85h 105h 185h
PORTB 06h TRISB 86h PORTB 106h TRISB 186h
PORTC 07h TRISC 87h 107h 187h
PORTD(1) 08h TRISD(1) 88h 108h 188h
PORTE(1) 09h TRISE(1) 89h 109h 189h
PCLATH 0Ah PCLATH 8Ah PCLATH 10Ah PCLATH 18Ah
INTCON 0Bh INTCON 8Bh INTCON 10Bh INTCON 18Bh
PIR1 0Ch PIE1 8Ch EEDATA 10Ch EECON1 18Ch
PIR2 0Dh PIE2 8Dh EEADR 10Dh EECON2 18Dh
TMR1L 0Eh PCON 8Eh EEDATH 10Eh Reserved(2) 18Eh
TMR1H 0Fh 8Fh EEADRH 10Fh Reserved(2) 18Fh
T1CON 10h 90h 110h 190h
TMR2 11h SSPCON2 91h 111h 191h
T2CON 12h PR2 92h 112h 192h
SSPBUF 13h SSPADD 93h 113h 193h
SSPCON 14h SSPSTAT 94h 114h 194h
CCPR1L 15h 95h 115h 195h
CCPR1H 16h 96h 116h 196h
CCP1CON 17h 97h General 117h General 197h
Purpose Purpose
RCSTA 18h TXSTA 98h Register 118h Register 198h
TXREG 19h SPBRG 99h 16 Bytes 119h 16 Bytes 199h
RCREG 1Ah 9Ah 11Ah 19Ah
CCPR2L 1Bh 9Bh 11Bh 19Bh
CCPR2H 1Ch CMCON 9Ch 11Ch 19Ch
CCP2CON 1Dh CVRCON 9Dh 11Dh 19Dh
ADRESH 1Eh ADRESL 9Eh 11Eh 19Eh
ADCON0 1Fh ADCON1 9Fh 11Fh 19Fh
20h A0h 120h 1A0h
General General General
Purpose Purpose Purpose
General Register Register Register
Purpose
Register 80 Bytes 80 Bytes 80 Bytes
Indirect addr.(*) 00h Indirect addr.(*) 80h Indirect addr.(*) 100h Indirect addr.(*) 180h
TMR0 01h OPTION_REG 81h TMR0 101h OPTION_REG 181h
PCL 02h PCL 82h PCL 102h PCL 182h
STATUS 03h STATUS 83h STATUS 103h STATUS 183h
FSR 04h FSR 84h FSR 104h FSR 184h
PORTA 05h TRISA 85h 105h 185h
PORTB 06h TRISB 86h PORTB 106h TRISB 186h
PORTC 07h TRISC 87h 107h 187h
PORTD(1) 08h TRISD(1) 88h 108h 188h
PORTE(1) 09h TRISE(1) 89h 109h 189h
PCLATH 0Ah PCLATH 8Ah PCLATH 10Ah PCLATH 18Ah
INTCON 0Bh INTCON 8Bh INTCON 10Bh INTCON 18Bh
PIR1 0Ch PIE1 8Ch EEDATA 10Ch EECON1 18Ch
PIR2 0Dh PIE2 8Dh EEADR 10Dh EECON2 18Dh
TMR1L 0Eh PCON 8Eh EEDATH 10Eh Reserved(2) 18Eh
TMR1H 0Fh 8Fh EEADRH 10Fh Reserved(2) 18Fh
T1CON 10h 90h 110h 190h
TMR2 11h SSPCON2 91h
T2CON 12h PR2 92h
SSPBUF 13h SSPADD 93h
SSPCON 14h SSPSTAT 94h
CCPR1L 15h 95h
CCPR1H 16h 96h
CCP1CON 17h 97h
RCSTA 18h TXSTA 98h
TXREG 19h SPBRG 99h
RCREG 1Ah 9Ah
CCPR2L 1Bh 9Bh
CCPR2H 1Ch CMCON 9Ch
CCP2CON 1Dh CVRCON 9Dh
ADRESH 1Eh ADRESL 9Eh
ADCON0 1Fh ADCON1 9Fh
120h 1A0h
20h A0h
General General
Purpose Purpose accesses accesses
Register Register
20h-7Fh A0h - FFh
96 Bytes 96 Bytes 16Fh 1EFh
170h 1F0h
bit 7 IRP: Register Bank Select bit (used for indirect addressing)
1 = Bank 2, 3 (100h-1FFh)
0 = Bank 0, 1 (00h-FFh)
bit 6-5 RP1:RP0: Register Bank Select bits (used for direct addressing)
11 = Bank 3 (180h-1FFh)
10 = Bank 2 (100h-17Fh)
01 = Bank 1 (80h-FFh)
00 = Bank 0 (00h-7Fh)
Each bank is 128 bytes.
bit 4 TO: Time-out bit
1 = After power-up, CLRWDT instruction or SLEEP instruction
0 = A WDT time-out occurred
bit 3 PD: Power-down bit
1 = After power-up or by the CLRWDT instruction
0 = By execution of the SLEEP instruction
bit 2 Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit 1 DC: Digit carry/borrow bit (ADDWF, ADDLW,SUBLW,SUBWF instructions)
(for borrow, the polarity is reversed)
1 = A carry-out from the 4th low order bit of the result occurred
0 = No carry-out from the 4th low order bit of the result
bit 0 C: Carry/borrow bit (ADDWF, ADDLW,SUBLW,SUBWF instructions)
1 = A carry-out from the Most Significant bit of the result occurred
0 = No carry-out from the Most Significant bit of the result occurred
Note: For borrow, the polarity is reversed. A subtraction is executed by adding the two’s
complement of the second operand. For rotate (RRF, RLF) instructions, this bit is
loaded with either the high, or low order bit of the source register.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note: When using Low-Voltage ICSP Programming (LVP) and the pull-ups on PORTB are
enabled, bit 3 in the TRISB register must be cleared to disable the pull-up on RB3
and ensure the proper operation of the device
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
The INDF register is not a physical register. Addressing EXAMPLE 2-2: INDIRECT ADDRESSING
the INDF register will cause indirect addressing. MOVLW 0x20 ;initialize pointer
Indirect addressing is possible by using the INDF reg- MOVWF FSR ;to RAM
ister. Any instruction using the INDF register actually NEXT CLRF INDF ;clear INDF register
accesses the register pointed to by the File Select Reg- INCF FSR,F ;inc pointer
ister, FSR. Reading the INDF register itself, indirectly BTFSS FSR,4 ;all done?
GOTO NEXT ;no clear next
(FSR = 0) will read 00h. Writing to the INDF register
CONTINUE
indirectly results in a no operation (although status bits : ;yes continue
may be affected). An effective 9-bit address is obtained
by concatenating the 8-bit FSR register and the IRP bit
(Status<7>) as shown in Figure 2-6.
Data
Memory(1)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
To read a data memory location, the user must write the 1. If step 10 is not implemented, check the WR bit
address to the EEADR register, clear the EEPGD con- to see if a write is in progress.
trol bit (EECON1<7>) and then set control bit RD 2. Write the address to EEADR. Make sure that the
(EECON1<0>). The data is available in the very next address is not larger than the memory size of
cycle in the EEDATA register; therefore, it can be read the device.
in the next instruction (see Example 3-1). EEDATA will 3. Write the 8-bit data value to be programmed in
hold this value until another read or until it is written to the EEDATA register.
by the user (during a write operation). 4. Clear the EEPGD bit to point to EEPROM data
The steps to reading the EEPROM data memory are: memory.
1. Write the address to EEADR. Make sure that the 5. Set the WREN bit to enable program operations.
address is not larger than the memory size of 6. Disable interrupts (if enabled).
the device. 7. Execute the special five instruction sequence:
2. Clear the EEPGD bit to point to EEPROM data • Write 55h to EECON2 in two steps (first
memory. to W, then to EECON2)
3. Set the RD bit to start the read operation. • Write AAh to EECON2 in two steps (first
4. Read the data from the EEDATA register. to W, then to EECON2)
• Set the WR bit
EXAMPLE 3-1: DATA EEPROM READ 8. Enable interrupts (if using interrupts).
BSF STATUS,RP1 ; 9. Clear the WREN bit to disable program
BCF STATUS,RP0 ; Bank 2 operations.
MOVF DATA_EE_ADDR,W ; Data Memory
10. At the completion of the write cycle, the WR bit
MOVWF EEADR ; Address to read
is cleared and the EEIF interrupt flag bit is set.
BSF STATUS,RP0 ; Bank 3
BCF EECON1,EEPGD ; Point to Data (EEIF must be cleared by firmware.) If step 1 is
; memory not implemented, then firmware should check
BSF EECON1,RD ; EE Read for EEIF to be set, or WR to clear, to indicate the
BCF STATUS,RP0 ; Bank 2 end of the program cycle.
MOVF EEDATA,W ; W = EEDATA
EXAMPLE 3-2: DATA EEPROM WRITE
BSF STATUS,RP1 ;
3.4 Writing to Data EEPROM Memory BSF STATUS,RP0
To write an EEPROM data location, the user must first BTFSC EECON1,WR ;Wait for write
write the address to the EEADR register and the data to GOTO $-1 ;to complete
BCF STATUS, RP0 ;Bank 2
the EEDATA register. Then the user must follow a
MOVF DATA_EE_ADDR,W ;Data Memory
specific write sequence to initiate the write for each byte. MOVWF EEADR ;Address to write
The write will not initiate if the write sequence is not MOVF DATA_EE_DATA,W ;Data Memory Value
exactly followed (write 55h to EECON2, write AAh to MOVWF EEDATA ;to write
EECON2, then set WR bit) for each byte. We strongly BSF STATUS,RP0 ;Bank 3
recommend that interrupts be disabled during this BCF EECON1,EEPGD ;Point to DATA
;memory
code segment (see Example 3-2).
BSF EECON1,WREN ;Enable writes
Additionally, the WREN bit in EECON1 must be set to
enable write. This mechanism prevents accidental BCF INTCON,GIE ;Disable INTs.
writes to data EEPROM due to errant (unexpected) MOVLW 55h ;
Sequence
code execution (i.e., lost programs). The user should MOVWF EECON2 ;Write 55h
Required
MOVLW AAh ;
keep the WREN bit clear at all times, except when
MOVWF EECON2 ;Write AAh
updating EEPROM. The WREN bit is not cleared
BSF EECON1,WR ;Set WR bit to
by hardware ;begin write
After a write sequence has been initiated, clearing the BSF INTCON,GIE ;Enable INTs.
WREN bit will not affect this write cycle. The WR bit will BCF EECON1,WREN ;Disable writes
be inhibited from being set unless the WREN bit is set.
At the completion of the write cycle, the WR bit is
cleared in hardware and the EE Write Complete
Interrupt Flag bit (EEIF) is set. The user can either
enable this interrupt or poll this bit. EEIF must be
cleared by software.
;
NOP
NOP ; Any instructions here are ignored as program
; memory is read in second cycle after BSF EECON1,RD
;
BCF STATUS, RP0 ; Bank 2
MOVF EEDATA, W ; W = LS Byte of Program EEDATA
MOVWF DATAL ;
MOVF EEDATH, W ; W = MS Byte of Program EEDATA
MOVWF DATAH ;
14 14 14 14
Program Memory
Data Latch
Data Bus D Q 1
N I/O pin(1)
WR PORTA CK Q 0
WR TRISA Schmitt
CK Q Trigger
Input
Buffer
RD TRISA
Q D
ENEN
RD PORTA
TMR0 Clock Input
Data Latch
Data Bus 1 VDD
D Q
WR PORTA P
CK Q 0
RD TRISA
Q D
ENEN
RD PORTA
Note: When using the SSP module in SPI Slave mode and SS enabled, the A/D converter must be set to one of
the following modes, where PCFG3:PCFG0 = 0100, 0101, 011x, 1101, 1110, 1111.
Q D
Four of the PORTB pins, RB7:RB4, have an interrupt- RD Port
From other
on-change feature. Only pins configured as inputs can RB7:RB4 pins EN
cause this interrupt to occur (i.e., any RB7:RB4 pin Q3
configured as an output is excluded from the interrupt- RB7:RB6
on-change comparison). The input pins (of RB7:RB4) In Serial Programming Mode
are compared with the old value latched on the last Note 1: I/O pins have diode protection to VDD and VSS.
read of PORTB. The “mismatch” outputs of RB7:RB4 2: To enable weak pull-ups, set the appropriate TRIS
are OR’ed together to generate the RB port change bit(s) and clear the RBPU bit (OPTION_REG<7>).
interrupt with flag bit RBIF (INTCON<0>).
CKE
FIGURE 4-6: PORTC BLOCK DIAGRAM SSPSTAT<6>
(PERIPHERAL OUTPUT
Note 1: I/O pins have diode protection to VDD and VSS.
OVERRIDE) RC<2:0>, 2: Port/Peripheral Select signal selects between port data
RC<7:5> and peripheral output.
3: Peripheral OE (Output Enable) is only activated if
Peripheral Select is active.
Port/Peripheral Select(2)
Data Latch
I/O
D Q pin(1)
WR TRIS CK Q N
TRIS Latch
VSS
RD TRIS
Schmitt
Trigger
Peripheral
OE(3) Q D
EN
RD Port
Peripheral Input
RD
TRIS
Q D
ENEN
RD Port
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
CLKO (= FOSC/4)
Data Bus
8
M 1
0
RA4/T0CKI U M Sync
pin X U
1 0 2 TMR0 Reg
X Cycles
T0SE
T0CS
PSA Set Flag bit TMR0IF
on Overflow
PRESCALER
0
M 8-bit Prescaler
U
Watchdog 1 X 8
Timer
0 1
WDT Enable bit
MUX PSA
WDT
Time-out
bit 7 RBPU
bit 6 INTEDG
bit 5 T0CS: TMR0 Clock Source Select bit
1 = Transition on T0CKI pin
0 = Internal instruction cycle clock (CLKO)
bit 4 T0SE: TMR0 Source Edge Select bit
1 = Increment on high-to-low transition on T0CKI pin
0 = Increment on low-to-high transition on T0CKI pin
bit 3 PSA: Prescaler Assignment bit
1 = Prescaler is assigned to the WDT
0 = Prescaler is assigned to the Timer0 module
bit 2-0 PS2:PS0: Prescaler Rate Select bits
Bit Value TMR0 Rate WDT Rate
000 1:2 1:1
001 1:4 1:2
010 1:8 1:4
011 1 : 16 1:8
100 1 : 32 1 : 16
101 1 : 64 1 : 32
110 1 : 128 1 : 64
111 1 : 256 1 : 128
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note: To avoid an unintended device Reset, the instruction sequence shown in the
PICmicro® Mid-Range MCU Family Reference Manual (DS33023) must be exe-
cuted when changing the prescaler assignment from Timer0 to the WDT. This
sequence must be followed even if the WDT is disabled.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
T1CKI
(Default High)
T1CKI
(Default Low)
6.3 Timer1 Operation in Synchronized If T1SYNC is cleared, then the external clock input is
Counter Mode synchronized with internal phase clocks. The synchro-
nization is done after the prescaler stage. The
Counter mode is selected by setting bit TMR1CS. In prescaler stage is an asynchronous ripple counter.
this mode, the timer increments on every rising edge of
In this configuration, during Sleep mode, Timer1 will not
clock input on pin RC1/T1OSI/CCP2 when bit
increment even if the external clock is present since the
T1OSCEN is set, or on pin RC0/T1OSO/T1CKI when
synchronization circuit is shut-off. The prescaler,
bit T1OSCEN is cleared.
however, will continue to increment.
Note 1: When the T1OSCEN bit is cleared, the inverter is turned off. This eliminates power drain.
to generate a TMR2 interrupt (latched in flag bit, Note 1: TMR2 register output can be software selected by the
TMR2IF (PIR1<1>)). SSP module as a baud clock.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
TMR1H TMR1L
CCP1CON<3:0>
Qs
EQUATION 8-1:
Duty Cycle
Resolution =
( FOSC
log FPWM ) bits
TMR2 = PR2 log(2)
TMR2 = Duty Cycle
Note: If the PWM duty cycle value is longer than
TMR2 = PR2
the PWM period, the CCP1 pin will not be
cleared.
SSPM3:SSPM0
9.2 Control Registers
( )
SMP:CKE 4
TMR2 Output
2 2
The MSSP module has three associated registers. Edge
These include a status register (SSPSTAT) and two Select Prescaler TOSC
control registers (SSPCON and SSPCON2). The use RC3/SCK/SCL 4, 16, 64
of these registers and their individual configuration bits
differ significantly, depending on whether the MSSP Data to TX/RX in SSPSR
TRIS bit
module is operated in SPI or I2C mode.
Additional details are provided under the individual
sections.
Note: When the SPI is in Slave mode with SS pin
9.3 SPI Mode control enabled (SSPCON<3:0> = 0100),
the state of the SS pin can affect the state
The SPI mode allows 8 bits of data to be synchronously read back from the TRISC<5> bit. The
transmitted and received simultaneously. All four Peripheral OE signal from the SSP mod-
modes of SPI are supported. To accomplish ule in PORTC controls the state that is
communication, typically three pins are used: read back from the TRISC<5> bit (see
• Serial Data Out (SDO) – RC5/SDO Section 4.3 “PORTC and the TRISC
• Serial Data In (SDI) – RC4/SDI/SDA Register” for information on PORTC). If
Read-Modify-Write instructions, such as
• Serial Clock (SCK) – RC3/SCK/SCL
BSF, are performed on the TRISC register
Additionally, a fourth pin may be used when in a Slave while the SS pin is high, this will cause the
mode of operation: TRISC<5> bit to be set, thus disabling the
• Slave Select (SS) – RA5/AN4/SS/C2OUT SDO output.
Figure 9-1 shows the block diagram of the MSSP
module when operating in SPI mode.
REGISTER 9-1: SSPSTAT: MSSP STATUS REGISTER (SPI MODE) (ADDRESS 94h)
R/W-0 R/W-0 R-0 R-0 R-0 R-0 R-0 R-0
SMP CKE D/A P S R/W UA BF
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
SDO SDI
Write to
SSPBUF
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
4 Clock
SCK Modes
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
SDO
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
(CKE = 0)
SDO
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
(CKE = 1)
SDI
(SMP = 0)
bit 7 bit 0
Input
Sample
(SMP = 0)
SDI
(SMP = 1)
bit 7 bit 0
Input
Sample
(SMP = 1)
SSPIF
Next Q4 Cycle
SSPSR to after Q2↓
SSPBUF
While in Sleep mode, the slave can transmit/receive 2: If the SPI is used in Slave Mode with CKE
data. When a byte is received, the device will wake-up set, then the SS pin control must be
from Sleep. enabled.
When the SPI module resets, the bit counter is forced
9.3.7 SLAVE SELECT to ‘0’. This can be done by either forcing the SS pin to
SYNCHRONIZATION a high level or clearing the SSPEN bit.
The SS pin allows a Synchronous Slave mode. The To emulate two-wire communication, the SDO pin can
SPI must be in Slave mode with SS pin control enabled be connected to the SDI pin. When the SPI needs to
(SSPCON<3:0> = 04h). The pin must not be driven low operate as a receiver, the SDO pin can be configured
for the SS pin to function as an input. The data latch as an input. This disables transmissions from the SDO.
must be high. When the SS pin is low, transmission and The SDI can always be left as an input (SDI function)
reception are enabled and the SDO pin is driven. When since it cannot create a bus conflict.
SS
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSPBUF
SDI bit 0
(SMP = 0)
bit 7 bit 7
Input
Sample
(SMP = 0)
SSPIF
Interrupt
Flag
Next Q4 Cycle
SSPSR to
after Q2↓
SSPBUF
SS
Optional
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSPBUF
SDI
(SMP = 0)
bit 7 bit 0
Input
Sample
(SMP = 0)
SSPIF
Interrupt
Flag
Next Q4 Cycle
SSPSR to after Q2↓
SSPBUF
SS
Not Optional
SCK
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
Write to
SSPBUF
SDI
(SMP = 0)
bit 7 bit 0
Input
Sample
(SMP = 0)
SSPIF
Interrupt
Flag
Next Q4 Cycle
after Q2↓
SSPSR to
SSPBUF
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note: For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the Idle mode,
this bit may not be set (no spooling) and the SSPBUF may not be written (or writes
to the SSPBUF are disabled).
DS39582B-page 86
PIC16F87XA
SDA A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCL 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
SSPIF
Bus master
(PIR1<3>) terminates
transfer
BF (SSPSTAT<0>)
Cleared in software
SSPBUF is read
SSPOV (SSPCON<6>)
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
Data in SCL held low P
sampled while CPU
responds to SSPIF
SSPIF (PIR1<3>)
BF (SSPSTAT<0>)
Cleared in software Cleared in software
From SSPIF ISR From SSPIF ISR
SSPBUF is written in software SSPBUF is written in software
CKP
I2C SLAVE MODE TIMING (TRANSMISSION, 7-BIT ADDRESS)
DS39582B-page 87
PIC16F87XA
FIGURE 9-10:
DS39582B-page 88
Clock is held low until Clock is held low until
update of SSPADD has update of SSPADD has
taken place taken place
Receive First Byte of Address Receive Second Byte of Address Receive Data Byte Receive Data Byte
R/W = 0 ACK
SCL 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
Bus master
terminates
SSPIF transfer
(PIR1<3>)
Cleared in software Cleared in software Cleared in software
Cleared in software
BF (SSPSTAT<0>)
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
UA (SSPSTAT<1>)
Bus master
terminates
Clock is held low until Clock is held low until transfer
update of SSPADD has update of SSPADD has Clock is held low until
SCL 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S Sr P
SSPIF
(PIR1<3>)
Cleared in software Cleared in software Cleared in software
BF (SSPSTAT<0>)
DS39582B-page 89
PIC16F87XA
PIC16F87XA
9.4.4 CLOCK STRETCHING 9.4.4.3 Clock Stretching for 7-bit Slave
Both 7 and 10-bit Slave modes implement automatic Transmit Mode
clock stretching during a transmit sequence. 7-bit Slave Transmit mode implements clock stretching
The SEN bit (SSPCON2<0>) allows clock stretching to by clearing the CKP bit after the falling edge of the ninth
be enabled during receives. Setting SEN will cause clock, if the BF bit is clear. This occurs regardless of the
the SCL pin to be held low at the end of each data state of the SEN bit.
receive sequence. The user’s ISR must set the CKP bit before transmis-
sion is allowed to continue. By holding the SCL line
9.4.4.1 Clock Stretching for 7-bit Slave low, the user has time to service the ISR and load the
Receive Mode (SEN = 1) contents of the SSPBUF before the master device can
In 7-bit Slave Receive mode, on the falling edge of the initiate another transmit sequence (see Figure 9-9).
ninth clock at the end of the ACK sequence, if the BF Note 1: If the user loads the contents of SSPBUF,
bit is set, the CKP bit in the SSPCON register is setting the BF bit before the falling edge of
automatically cleared, forcing the SCL output to be the ninth clock, the CKP bit will not be
held low. The CKP bit being cleared to ‘0’ will assert cleared and clock stretching will not occur.
the SCL line low. The CKP bit must be set in the user’s
ISR before reception is allowed to continue. By holding 2: The CKP bit can be set in software
the SCL line low, the user has time to service the ISR regardless of the state of the BF bit.
and read the contents of the SSPBUF before the
9.4.4.4 Clock Stretching for 10-bit Slave
master device can initiate another receive sequence.
This will prevent buffer overruns from occurring (see Transmit Mode
Figure 9-13). In 10-bit Slave Transmit mode, clock stretching is con-
trolled during the first two address sequences by the
Note 1: If the user reads the contents of the
state of the UA bit, just as it is in 10-bit Slave Receive
SSPBUF before the falling edge of the
mode. The first two addresses are followed by a third
ninth clock, thus clearing the BF bit, the
address sequence, which contains the high order bits
CKP bit will not be cleared and clock
of the 10-bit address and the R/W bit set to ‘1’. After
stretching will not occur.
the third address sequence is performed, the UA bit is
2: The CKP bit can be set in software not set, the module is now configured in Transmit
regardless of the state of the BF bit. The mode and clock stretching is controlled by the BF flag
user should be careful to clear the BF bit as in 7-bit Slave Transmit mode (see Figure 9-11).
in the ISR before the next receive
sequence in order to prevent an overflow
condition.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
SDA DX DX-1
SCL
Master device
asserts clock
CKP
Master device
deasserts clock
WR
SSPCON
DS39582B-page 92
Clock is not held low
because buffer full bit is
clear prior to falling edge Clock is held low until Clock is not held low
PIC16F87XA
SDA A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCL 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
SSPIF
Bus master
(PIR1<3>) terminates
transfer
BF (SSPSTAT<0>)
Cleared in software
SSPBUF is read
SSPOV (SSPCON<6>)
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
CKP
CKP
If BF is cleared written
prior to the falling to ‘1’ in
edge of the 9th clock, software
CKP will not be reset BF is set after falling
to ‘0’ and no clock edge of the 9th clock,
stretching will occur CKP is reset to ‘0’ and
clock stretching occurs
I2C SLAVE MODE TIMING WITH SEN = 1 (RECEPTION, 7-BIT ADDRESS)
SSPIF
Bus master
(PIR1<3>) terminates
Cleared in software Cleared in software Cleared in software transfer
Cleared in software
BF (SSPSTAT<0>)
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
UA (SSPSTAT<1>)
DS39582B-page 93
PIC16F87XA
PIC16F87XA
9.4.5 GENERAL CALL ADDRESS If the general call address matches, the SSPSR is
SUPPORT transferred to the SSPBUF, the BF flag bit is set (eighth
bit) and on the falling edge of the ninth bit (ACK bit), the
The addressing procedure for the I2C bus is such that
SSPIF interrupt flag bit is set.
the first byte after the Start condition usually determines
which device will be the slave addressed by the master. When the interrupt is serviced, the source for the inter-
The exception is the general call address which can rupt can be checked by reading the contents of the
address all devices. When this address is used, all SSPBUF. The value can be used to determine if the
devices should, in theory, respond with an Acknowledge. address was device specific or a general call address.
The general call address is one of eight addresses In 10-bit mode, the SSPADD is required to be updated
reserved for specific purposes by the I2C protocol. It for the second half of the address to match and the UA
consists of all ‘0’s with R/W = 0. bit is set (SSPSTAT<1>). If the general call address is
sampled when the GCEN bit is set, while the slave is
The general call address is recognized when the Gen-
configured in 10-bit Address mode, then the second
eral Call Enable bit (GCEN) is enabled (SSPCON2<7>
half of the address is not necessary, the UA bit will not
set). Following a Start bit detect, 8 bits are shifted into
be set and the slave will begin receiving data after the
the SSPSR and the address is compared against the
Acknowledge (Figure 9-15).
SSPADD. It is also compared to the general call
address and fixed in hardware.
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
SSPIF
BF (SSPSTAT<0>)
Cleared in software
SSPBUF is read
SSPOV (SSPCON<6>) ‘0’
Internal SSPM3:SSPM0
Data Bus SSPADD<6:0>
Read Write
SSPBUF Baud
Rate
Generator
SDA Shift
Clock Arbitrate/WCOL Detect
SDA In Clock
SSPSR
(hold off clock source)
MSb LSb
Receive Enable
Acknowledge
Generate
SCL
SSPM3:SSPM0 SSPADD<6:0>
SDA DX DX-1
BRG decrements on
Q2 and Q4 cycles
BRG
03h 02h 01h 00h (hold off) 03h 02h
Value
SCL
TBRG
S
Set S (SSPSTAT<3>)
Write to SSPCON2
SDA = 1,
occurs here, At completion of Start bit,
SDA = 1, SCL = 1
hardware clears RSEN bit
SCL (no change) and sets SSPIF
1st Bit
SDA
Falling edge of ninth clock, Write to SSPBUF occurs here
end of Xmit
TBRG
SCL TBRG
Sr = Repeated Start
DS39582B-page 102
Write SSPCON2<0> SEN = 1 ACKSTAT in
Start condition begins SSPCON2 = 1
From Slave, clear ACKSTAT bit SSPCON2<6>
SEN = 0
Transmitting Data or Second Half
PIC16F87XA
SDA A7 A6 A5 A4 A3 A2 A1 ACK = 0 D7 D6 D5 D4 D3 D2 D1 D0
BF (SSPSTAT<0>)
PEN
R/W
I 2C MASTER MODE WAVEFORM (TRANSMISSION, 7 OR 10-BIT ADDRESS)
Write to SSPCON2<4>
to start Acknowledge sequence,
SDA = ACKDT (SSPCON2<5>) = 0
Write to SSPCON2<0> (SEN = 1),
begin Start condition Set ACKEN, start Acknowledge sequence,
Master configured as a receiver ACK from master
by programming SSPCON2<3> (RCEN = 1) SDA = ACKDT = 0 SDA = ACKDT = 1
SEN = 0
Bus master
ACK is not sent
terminates
transfer
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
SCL S P
Data shifted in on falling edge of CLK Set SSPIF at end
of receive Set SSPIF interrupt
Set SSPIF interrupt at end of Acknow-
Set SSPIF interrupt ledge sequence
at end of receive at end of Acknowledge
SSPIF sequence
Set P bit
SDA = 0, SCL = 1 Cleared in software Cleared in software Cleared in software Cleared in software Cleared in (SSPSTAT<4>)
while CPU software and SSPIF
responds to SSPIF
BF
(SSPSTAT<0>) Last bit is shifted into SSPSR and
contents are unloaded into SSPBUF
SSPOV
ACKEN
I 2C MASTER MODE WAVEFORM (RECEPTION, 7-BIT ADDRESS)
DS39582B-page 103
PIC16F87XA
PIC16F87XA
9.4.12 ACKNOWLEDGE SEQUENCE 9.4.13 STOP CONDITION TIMING
TIMING A Stop bit is asserted on the SDA pin at the end of a
An Acknowledge sequence is enabled by setting the receive/transmit by setting the Stop Sequence Enable
Acknowledge Sequence Enable bit, ACKEN bit, PEN (SSPCON2<2>). At the end of a receive/
(SSPCON2<4>). When this bit is set, the SCL pin is transmit, the SCL line is held low after the falling edge
pulled low and the contents of the Acknowledge data bit of the ninth clock. When the PEN bit is set, the master
are presented on the SDA pin. If the user wishes to gen- will assert the SDA line low. When the SDA line is sam-
erate an Acknowledge, then the ACKDT bit should be pled low, the Baud Rate Generator is reloaded and
cleared. If not, the user should set the ACKDT bit before counts down to 0. When the Baud Rate Generator
starting an Acknowledge sequence. The Baud Rate times out, the SCL pin will be brought high and one
Generator then counts for one rollover period (TBRG) TBRG (Baud Rate Generator rollover count) later, the
and the SCL pin is deasserted (pulled high). When the SDA pin will be deasserted. When the SDA pin is sam-
SCL pin is sampled high (clock arbitration), the Baud pled high while SCL is high, the P bit (SSPSTAT<4>) is
Rate Generator counts for TBRG. The SCL pin is then set. A TBRG later, the PEN bit is cleared and the SSPIF
pulled low. Following this, the ACKEN bit is automatically bit is set (Figure 9-24).
cleared, the baud rate generator is turned off and the
MSSP module then goes into Idle mode (Figure 9-23). 9.4.13.1 WCOL Status Flag
If the user writes the SSPBUF when a Stop sequence
9.4.12.1 WCOL Status Flag is in progress, then the WCOL bit is set and the con-
If the user writes the SSPBUF when an Acknowledge tents of the buffer are unchanged (the write doesn’t
sequence is in progress, then WCOL is set and the occur).
contents of the buffer are unchanged (the write doesn’t
occur).
SCL 8 9
SSPIF
SDA ACK
P
TBRG TBRG TBRG
SCL brought high after TBRG
SDA asserted low before rising edge of clock
to setup Stop condition
Data changes SDA line pulled low Sample SDA. While SCL is high,
while SCL = 0 by another source data doesn’t match what is driven
by the master. Bus collision has occurred.
SDA released
by master
SDA
BCLIF
SDA
SCL
Set SEN, enable Start SEN cleared automatically because of bus collision.
condition if SDA = 1, SCL = 1 SSP module reset into Idle state.
SEN
SSPIF
SDA = 0, SCL = 1
TBRG TBRG
SDA
FIGURE 9-28: BRG RESET DUE TO SDA ARBITRATION DURING START CONDITION
SDA = 0, SCL = 1
Set S Set SSPIF
Less than TBRG
TBRG
SCL S
SCL pulled low after BRG
time-out
SEN
Set SEN, enable Start
sequence if SDA = 1, SCL = 1
BCLIF ‘0’
SSPIF
SDA = 0, SCL = 1, Interrupts cleared
set SSPIF in software
SDA
SCL
Sample SDA when SCL goes high.
If SDA = 0, set BCLIF and release SDA and SCL.
RSEN
BCLIF
Cleared in software
S ‘0’
SSPIF ‘0’
TBRG TBRG
SDA
SCL
S ‘0’
SSPIF
PEN
BCLIF
P ‘0’
SSPIF ‘0’
SDA
SCL goes low before SDA goes high,
Assert SDA
set BCLIF
SCL
PEN
BCLIF
P ‘0’
SSPIF ‘0’
REGISTER 10-1: TXSTA: TRANSMIT STATUS AND CONTROL REGISTER (ADDRESS 98h)
R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0 R-1 R/W-0
CSRC TX9 TXEN SYNC — BRGH TRMT TX9D
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
RC7/RX/DT
Pin Buffer Data
and Control Recovery RX9
Interrupt RCIF
Data Bus
RCIE
RCIF
(Interrupt Flag)
OERR bit
CREN
Note: This timing diagram shows three words appearing on the RX input. The RCREG (Receive Buffer) is read after the third word,
causing the OERR (Overrun Error) bit to be set.
When setting up an Asynchronous Reception, follow 6. Flag bit RCIF will be set when reception is com-
these steps: plete and an interrupt will be generated if enable
1. Initialize the SPBRG register for the appropriate bit RCIE is set.
baud rate. If a high-speed baud rate is desired, 7. Read the RCSTA register to get the ninth bit (if
set bit BRGH (Section 10.1 “USART Baud enabled) and determine if any error occurred
Rate Generator (BRG)”). during reception.
2. Enable the asynchronous serial port by clearing 8. Read the 8-bit received data by reading the
bit SYNC and setting bit SPEN. RCREG register.
3. If interrupts are desired, then set enable bit 9. If any error occurred, clear the error by clearing
RCIE. enable bit CREN.
4. If 9-bit reception is desired, then set bit RX9. 10. If using interrupts, ensure that GIE and PEIE
5. Enable the reception by setting bit CREN. (bits 7 and 6) of the INTCON register are set.
RC7/RX/DT
Pin Buffer Data
and Control RX9
Recovery
SPEN
RX9 Enable
ADDEN Load of
RX9 Receive
Buffer
ADDEN
RSR<8> 8
Interrupt RCIF
Data Bus
RCIE
Load RSR
Bit 8 = 0, Data Byte Bit 8 = 1, Address Byte Word 1
RCREG
Read
RCIF
Note: This timing diagram shows a data byte followed by an address byte. The data byte is not read into the RCREG (Receive Buffer)
because ADDEN = 1.
Load RSR
Bit 8 = 1, Address Byte Bit 8 = 0, Data Byte Word 1
RCREG
Read
RCIF
Note: This timing diagram shows a data byte followed by an address byte. The data byte is not read into the RCREG (Receive Buffer)
because ADDEN was not updated and still = 0.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1Q2Q3 Q4Q1Q2Q3 Q4Q1 Q2 Q3 Q4 Q3 Q4 Q1Q2 Q3Q4 Q1Q2 Q3Q4 Q1Q2 Q3 Q4Q1 Q2 Q3Q4 Q1Q2 Q3 Q4 Q1 Q2Q3 Q4
RC7/RX/DT
pin bit 0 bit 1 bit 2 bit 7 bit 0 bit 1 bit 7
Word 1 Word 2
RC6/TX/CK
pin
Write to
TXREG reg
Write Word 1 Write Word 2
TXIF bit
(Interrupt Flag)
TRMT bit
‘1’ ‘1’
TXEN bit
Note: Sync Master mode; SPBRG = 0. Continuous transmission of two 8-bit words.
RC6/TX/CK pin
Write to
TXREG Reg
TXIF bit
TRMT bit
TXEN bit
RC7/RX/DT
pin bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7
RC6/TX/CK
pin
Write to
bit SREN
SREN bit
RCIF bit
(Interrupt)
Read
RXREG
Note: Timing diagram demonstrates Sync Master mode with bit SREN = 1 and bit BRG = 0.
10.4 USART Synchronous Slave Mode When setting up a Synchronous Slave Transmission,
follow these steps:
Synchronous Slave mode differs from the Master mode
in the fact that the shift clock is supplied externally at 1. Enable the synchronous slave serial port by set-
the RC6/TX/CK pin (instead of being supplied internally ting bits SYNC and SPEN and clearing bit
in Master mode). This allows the device to transfer or CSRC.
receive data while in Sleep mode. Slave mode is 2. Clear bits CREN and SREN.
entered by clearing bit, CSRC (TXSTA<7>). 3. If interrupts are desired, then set enable bit
TXIE.
10.4.1 USART SYNCHRONOUS SLAVE 4. If 9-bit transmission is desired, then set bit TX9.
TRANSMIT 5. Enable the transmission by setting enable bit
The operation of the Synchronous Master and Slave TXEN.
modes is identical, except in the case of the Sleep mode. 6. If 9-bit transmission is selected, the ninth bit
If two words are written to the TXREG and then the should be loaded in bit TX9D.
SLEEP instruction is executed, the following will occur: 7. Start transmission by loading data to the TXREG
a) The first word will immediately transfer to the register.
TSR register and transmit. 8. If using interrupts, ensure that GIE and PEIE
b) The second word will remain in TXREG register. (bits 7 and 6) of the INTCON register are set.
c) Flag bit TXIF will not be set.
d) When the first word has been shifted out of TSR,
the TXREG register will transfer the second word
to the TSR and flag bit TXIF will now be set.
e) If enable bit TXIE is set, the interrupt will wake
the chip from Sleep and if the global interrupt is
enabled, the program will branch to the interrupt
vector (0004h).
bit 7-6 ADCS1:ADCS0: A/D Conversion Clock Select bits (ADCON0 bits in bold)
ADCON1 ADCON0
Clock Conversion
<ADCS2> <ADCS1:ADCS0>
0 00 FOSC/2
0 01 FOSC/8
0 10 FOSC/32
0 11 FRC (clock derived from the internal A/D RC oscillator)
1 00 FOSC/4
1 01 FOSC/16
1 10 FOSC/64
1 11 FRC (clock derived from the internal A/D RC oscillator)
bit 5-3 CHS2:CHS0: Analog Channel Select bits
000 = Channel 0 (AN0)
001 = Channel 1 (AN1)
010 = Channel 2 (AN2)
011 = Channel 3 (AN3)
100 = Channel 4 (AN4)
101 = Channel 5 (AN5)
110 = Channel 6 (AN6)
111 = Channel 7 (AN7)
Note: The PIC16F873A/876A devices only implement A/D channels 0 through 4; the
unimplemented selections are reserved. Do not select any unimplemented
channels with these devices.
bit 2 GO/DONE: A/D Conversion Status bit
When ADON = 1:
1 = A/D conversion in progress (setting this bit starts the A/D conversion which is automatically
cleared by hardware when the A/D conversion is complete)
0 = A/D conversion not in progress
bit 1 Unimplemented: Read as ‘0’
bit 0 ADON: A/D On bit
1 = A/D converter module is powered up
0 = A/D converter module is shut-off and consumes no operating current
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note: On any device Reset, the port pins that are multiplexed with analog functions (ANx)
are forced to be an analog input.
111
RE2/AN7(1)
110
RE1/AN6(1)
101
RE0/AN5(1)
100
RA5/AN4
VAIN
(Input Voltage) 011
RA3/AN3/VREF+
A/D 010
Converter RA2/AN2/VREF-
001
VDD RA1/AN1
000
VREF+ RA0/AN0
(Reference
Voltage)
PCFG3:PCFG0
VREF-
(Reference
Voltage)
VSS
PCFG3:PCFG0
= TAMP + TC + TCOFF
= 2 µs + TC + [(Temperature – 25°C)(0.05 µs/°C)]
TC = CHOLD (RIC + RSS + RS) In(1/2047)
= - 120 pF (1 kΩ + 7 kΩ + 10 kΩ) In(0.0004885)
= 16.47 µs
TACQ = 2 µs + 16.47 µs + [(50°C – 25°C)(0.05 µs/°C)
= 19.72 µs
Note 1: The reference voltage (VREF) has no effect on the equation since it cancels itself out.
2: The charge holding capacitor (CHOLD) is not discharged after each conversion.
3: The maximum recommended impedance for analog sources is 2.5 kΩ. This is required to meet the pin
leakage specification.
CHOLD
VA CPIN ILEAKAGE = DAC Capacitance
5 pF VT = 0.6V ± 500 nA = 120 pF
VSS
TABLE 11-1: TAD vs. MAXIMUM DEVICE OPERATING FREQUENCIES (STANDARD DEVICES (F))
AD Clock Source (TAD)
Maximum Device Frequency
Operation ADCS2:ADCS1:ADCS0
2 TOSC 000 1.25 MHz
4 TOSC 100 2.5 MHz
8 TOSC 001 5 MHz
16 TOSC 101 10 MHz
32 TOSC 010 20 MHz
64 TOSC 110 20 MHz
RC(1, 2, 3) x11 (Note 1)
Note 1: The RC source has a typical TAD time of 4 µs but can vary between 2-6 µs.
2: When the device frequencies are greater than 1 MHz, the RC A/D conversion clock source is only
recommended for Sleep operation.
3: For extended voltage devices (LF), please refer to Section 17.0 “Electrical Characteristics”.
TCY to TAD TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
Conversion starts
Set GO bit
ADRES is loaded
GO bit is cleared
ADIF bit is set
Holding capacitor is connected to analog input
11.4.1 A/D RESULT REGISTERS Format Select bit (ADFM) controls this justification.
Figure 11-4 shows the operation of the A/D result
The ADRESH:ADRESL register pair is the location
justification. The extra bits are loaded with ‘0’s. When
where the 10-bit A/D result is loaded at the completion
an A/D result will not overwrite these locations (A/D dis-
of the A/D conversion. This register pair is 16 bits wide.
able), these registers may be used as two general
The A/D module gives the flexibility to left or right justify
purpose 8-bit registers.
the 10-bit result in the 16-bit result register. The A/D
10-bit Result
ADFM = 1 ADFM = 0
7 2107 0 7 0765 0
0000 00 0000 00
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
A VIN- D VIN-
RA1/AN1 RA1/AN1
A VIN+ C2 Off (Read as ‘0’) D VIN+ C2 Off (Read as ‘0’)
RA2/AN2 RA2/AN2
A VIN-
RA1/AN1 A VIN-
RA1/AN1
A VIN+ C2 C2OUT C2OUT
RA2/AN2 A VIN+ C2
RA2/AN2
RA5/AN4/SS/C2OUT
Two Common Reference Comparators Two Common Reference Comparators with Outputs
CM2:CM0 = 100 CM2:CM0 = 101
A VIN- A VIN-
RA0/AN0 RA0/AN0
A VIN+ C1 C1OUT A VIN+ C1 C1OUT
RA3/AN3 RA3/AN3
RA4/T0CKI/C1OUT
A VIN-
RA1/AN1
C2 C2OUT A VIN-
RA2/AN2 D VIN+ RA1/AN1
D VIN+ C2 C2OUT
RA2/AN2
RA5/AN4/SS/C2OUT
One Independent Comparator with Output Four Inputs Multiplexed to Two Comparators
CM2:CM0 = 001 CM2:CM0 = 110
A VIN- A
RA0/AN0 RA0/AN0 CIS = 0 VIN-
A VIN+ C1 C1OUT RA3/AN3 A CIS = 1
RA3/AN3 VIN+ C1 C1OUT
RA4/T0CKI/C1OUT A
RA1/AN1 CIS = 0 VIN-
A CIS = 1
RA2/AN2 C2 C2OUT
D VIN- VIN+
RA1/AN1
D VIN+ C2 Off (Read as ‘0’)
RA2/AN2 CVREF From Comparator
VREF Module
A = Analog Input, port reads zeros always. D = Digital Input. CIS (CMCON<3>) is the Comparator Input Switch.
MULTIPLEX
+ -
CxINV
To RA4 or
RA5 Pin
Bus Q D
Data
Read CMCON EN
Set
CMIF Q D
bit From
Other EN
Comparator
CL Read CMCON
Reset
VDD
VT = 0.6 V RIC
RS < 10K
AIN
CPIN ILEAKAGE
VA VT = 0.6 V ±500 nA
5 pF
VSS
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
VDD
16 Stages
CVREN
8R R R R R
8R CVRR
RA2/AN2/VREF-/CVREF
CVROE
CVR3
CVREF CVR2
16:1 Analog MUX
Input to CVR1
Comparator CVR0
Legend:
R = Readable bit P = Programmable bit U = Unimplemented bit, read as ‘0’
- n = Value when device is unprogrammed u = Unchanged from programmed state
External
Reset
MCLR
Sleep
WDT WDT
Module Time-out
Reset
VDD Rise
Detect
Power-on Reset
VDD
Brown-out
Reset S
BODEN
OST/PWRT
OST
Chip_Reset
10-bit Ripple Counter R Q
OSC1
(1) PWRT
On-chip
RC OSC 10-bit Ripple Counter
Enable PWRT
Enable OST
Note 1: This is a separate oscillator from the RC oscillator of the CLKI pin.
XT, HS, LP 72 ms + 1024 TOSC 1024 TOSC 72 ms + 1024 TOSC 1024 TOSC
RC 72 ms — 72 ms —
FIGURE 14-6: TIME-OUT SEQUENCE ON POWER-UP (MCLR TIED TO VDD VIA RC NETWORK)
VDD
MCLR
Internal POR
TPWRT
OST Time-out
Internal Reset
VDD
MCLR
Internal POR
TPWRT
OST Time-out
Internal Reset
FIGURE 14-8: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 2
VDD
MCLR
Internal POR
TPWRT
OST Time-out
Internal Reset
FIGURE 14-9: SLOW RISE TIME (MCLR TIED TO VDD VIA RC NETWORK)
5V
VDD 0V 1V
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
EEIF
EEIE
PSPIF(1)
PSPIE(1)
ADIF
ADIE
Wake-up (If in Sleep mode)
RCIF TMR0IF
RCIE TMR0IE
INTF
TXIF
INTE
TXIE Interrupt to CPU
RBIF
SSPIF RBIE
SSPIE
CCP1IF PEIE
CCP1IE
GIE
TMR2IF
TMR2IE
TMR1IF
TMR1IE
CCP2IF
CCP2IE
BCLIF
BCLIE
CMIF
CMIE
0
M Postscaler
1 U
WDT Timer
X 8
0 1
MUX PSA
WDT
Time-out
2007h Config. bits (1) BODEN(1) CP1 CP0 PWRTE(1) WDTE FOSC1 FOSC0
81h, 181h OPTION_REG RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0
Legend: Shaded cells are not used by the Watchdog Timer.
Note 1: See Register 14-1 for operation of these bits.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
CLKO(4) TOST(2)
INT pin
INTF Flag
(INTCON<1>) Interrupt Latency(2)
GIE bit
(INTCON<7>) Processor in
Sleep
INSTRUCTION FLOW
PC PC PC+1 PC+2 PC+2 PC + 2 0004h 0005h
Instruction
Fetched Inst(PC) = Sleep Inst(PC + 1) Inst(PC + 2) Inst(0004h) Inst(0005h)
Instruction Inst(PC - 1) Sleep Inst(PC + 1) Dummy cycle Dummy cycle
Executed Inst(0004h)
Note: Additional information on the mid-range instruction set is available in the PICmicro® Mid-Range MCU
Family Reference Manual (DS33023).
6.0V
5.5V
5.0V
PIC16F87XA
4.5V
Voltage
4.0V
3.5V
3.0V
2.5V
2.0V
20 MHz
Frequency
6.0V
5.5V
5.0V
4.5V
Voltage
4.0V PIC16LF87XA
3.5V
3.0V
2.5V
2.0V
4 MHz 10 MHz
Frequency
FMAX = (6.0 MHz/V) (VDDAPPMIN – 2.0V) + 4 MHz
Note 1: VDDAPPMIN is the minimum voltage of the PICmicro® device in the application.
Note 2: FMAX has a maximum frequency of 10 MHz.
Param
Sym Characteristics Min Typ Max Units Comments
No.
D300 VIOFF Input Offset Voltage — ± 5.0 ± 10 mV
D301 VICM Input Common Mode Voltage* 0 - VDD – 1.5 V
D302 CMRR Common Mode Rejection Ratio* 55 - — dB
300 TRESP Response Time*(1) — 150 400 ns PIC16F87XA
300A 600 ns PIC16LF87XA
301 TMC2OV Comparator Mode Change to — — 10 µs
Output Valid*
* These parameters are characterized but not tested.
Note 1: Response time measured with one comparator input at (VDD – 1.5)/2 while the other input transitions from
VSS to VDD.
Spec
Sym Characteristics Min Typ Max Units Comments
No.
D310 VRES Resolution VDD/24 — VDD/32 LSb
D311 VRAA Absolute Accuracy — — 1/2 LSb Low Range (VRR = 1)
— — 1/2 LSb High Range (VRR = 0)
D312 VRUR Unit Resistor Value (R)* — 2k — Ω
310 TSET Settling Time*(1) — — 10 µs
* These parameters are characterized but not tested.
Note 1: Settling time measured while VRR = 1 and VR<3:0> transitions from ‘0000’ to ‘1111’.
RL
CL CL
Pin Pin
VSS VSS
RL = 464Ω
CL = 50 pF for all pins except OSC2, but including PORTD and PORTE outputs as ports,
15 pF for OSC2 output
Note: PORTD and PORTE are not implemented on PIC16F873A/876A devices.
OSC1
1 3 3 4 4
2
CLKO
Q4 Q1 Q2 Q3
OSC1
10 11
CLKO
13 12
19 18
14 16
I/O pin
(Input)
17 15
20, 21
Note: Refer to Figure 17-3 for load conditions.
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out
32
OSC
Time-out
Internal
Reset
Watchdog
Timer
Reset
31
34
34
I/O pins
VDD VBOR
35
TABLE 17-5: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER
AND BROWN-OUT RESET REQUIREMENTS
Param
Symbol Characteristic Min Typ† Max Units Conditions
No.
RA4/T0CKI
40 41
42
RC0/T1OSO/T1CKI
45 46
47 48
TMR0 or TMR1
RC1/T1OSI/CCP2
and RC2/CCP1
(Capture Mode)
50 51
52
RC1/T1OSI/CCP2
and RC2/CCP1
(Compare or PWM Mode)
53 54
RE2/CS
RE0/RD
RE1/WR
65
RD7:RD0
62
64
63
Note: Refer to Figure 17-3 for load conditions.
SS
70
SCK
(CKP = 0)
71 72
78 79
SCK
(CKP = 1)
79 78
80
75, 76
SS
81
SCK
(CKP = 0)
71 72
79
73
SCK
(CKP = 1)
80
78
75, 76
74
SS
70
SCK
(CKP = 0) 83
71 72
78 79
SCK
(CKP = 1)
79 78
80
75, 76 77
74
73
82
SS
70
SCK
83
(CKP = 0)
71 72
SCK
(CKP = 1)
80
75, 76 77
SDI
MSb In Bit 6 - - - -1 LSb In
74
SCL
91 93
90 92
SDA
Start Stop
Condition Condition
90 TSU:STA Start condition 100 kHz mode 4700 — — ns Only relevant for Repeated Start
Setup time 400 kHz mode 600 — — condition
91 THD:STA Start condition 100 kHz mode 4000 — — ns After this period, the first clock pulse
Hold time 400 kHz mode 600 — — is generated
SDA
Out
91 THD:STA Start Condition Hold 100 kHz mode 4.0 — µs After this period, the first clock
Time 400 kHz mode 0.6 — µs pulse is generated
RC6/TX/CK
pin 121
121
RC7/RX/DT
pin
120
122
RC6/TX/CK
pin 125
RC7/RX/DT
pin
126
ADIF
GO DONE
Sampling Stopped
SAMPLE
Note: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the SLEEP
instruction to be executed.
130 TAD A/D Clock Period PIC16F87XA 1.6 — — µs TOSC based, VREF ≥ 3.0V
PIC16LF87XA 3.0 — — µs TOSC based, VREF ≥ 2.0V
PIC16F87XA 2.0 4.0 6.0 µs A/D RC mode
PIC16LF87XA 3.0 6.0 9.0 µs A/D RC mode
131 TCNV Conversion Time (not including S/H time) — 12 TAD
(Note 1)
132 TACQ Acquisition Time (Note 2) 40 — µs
FIGURE 18-1: TYPICAL IDD vs. FOSC OVER VDD (HS MODE)
7
5 5.0V
4.5V
4
IDD (mA)
4.0V
3 3.5V
3.0V
2
2.5V
2.0V
0
4 6 8 10 12 14 16 18 20
FOSC (MHz)
FIGURE 18-2: MAXIMUM IDD vs. FOSC OVER VDD (HS MODE)
8
4.5V
5
4.0V
IDD (mA)
4
3.5V
3.0V
3
2.5V
2 2.0V
0
4 6 8 10 12 14 16 18 20
FOSC (MHz)
1.2 4.5V
4.0V
1.0
IDD (mA)
3.5V
0.8 3.0V
2.5V
0.6
2.0V
0.4
0.2
0.0
0 500 1000 1500 2000 2500 3000 3500 4000
FOSC (MHz)
FIGURE 18-4: MAXIMUM IDD vs. FOSC OVER VDD (XT MODE)
2.5
5.5V
5.0V
1.5
4.5V
IDD (mA)
4.0V
3.5V
1.0
3.0V
2.5V
2.0V
0.5
0.0
0 500 1000 1500 2000 2500 3000 3500 4000
FOSC (MHz)
50 5.0V
4.5V
40
IDD (uA)
4.0V
3.5V
30
3.0V
2.5V
20
2.0V
10
0
20 30 40 50 60 70 80 90 100
FOSC (kHz)
FIGURE 18-6: MAXIMUM IDD vs. FOSC OVER VDD (LP MODE)
120
4.5V
80
4.0V
IDD (uA)
60 3.5V
3.0V
2.5V
40
2.0V
20
0
20 30 40 50 60 70 80 90 100
FOSC (kHz)
4.5
5.1 kOhm
3.5
3.0
Freq (MHz)
2.5
10 kOhm
2.0
1.5
1.0
0.5
100 kOhm
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
2.5
2.0
3.3 kOhm
1.5
Freq (MHz)
5.1 kOhm
1.0
10 kOhm
0.5
100 kOhm
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
0.9
0.8
3.3 kOhm
0.7
0.6
5.1 kOhm
Freq (MHz)
0.5
0.4
10 kOhm
0.3
0.2
0.1
100 kOhm
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 18-10: IPD vs. VDD, -40°C TO +125°C (SLEEP MODE, ALL PERIPHERALS DISABLED)
100
Max (125°C)
10
Max (85°C)
1
IPD (uA)
0.1
0.01
Typ (25°C) Typical: statistical mean @ 25°C
Maximum: mean + 3σ (-40°C to +125°C)
Minimum: mean – 3σ (-40°C to +125°C)
0.001
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
14
Max
Max(+70°C)
(70C)
10
8
(µA)
IPD (uA)
Typ
Typ(+25°C)
(25C)
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 18-12: TYPICAL AND MAXIMUM ∆IWDT vs. VDD OVER TEMPERATURE (WDT ENABLED)
100
10 Max (+125°C)
Max (+85°C)
IPD (uA)
Typ (+25°C)
0.1
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
1,000
Max (125°C)
Typ (25°C)
Device in
Indeterminant Sleep
State
Device in
Reset
IDD (µA)
100
10
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 18-14: TYPICAL, MINIMUM AND MAXIMUM WDT PERIOD vs. VDD (-40°C TO +125°C)
50
45
Typical: statistical mean @ 25°C
Maximum: mean + 3σ (-40°C to +125°C)
40 Minimum: mean – 3σ (-40°C to +125°C)
35
Max
(125°C)
WDT Period (ms)
30
25
Typ
(25°C)
20
Min
15
(-40°C)
10
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
50
45
Typical: statistical mean @ 25°C
Maximum: mean + 3σ (-40°C to +125°C)
Minimum: mean – 3σ (-40°C to +125°C)
40
125°C
35
85°C
WDT Period (ms)
30
25°C
25
20
-40°C
15
10
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 18-16: TYPICAL, MINIMUM AND MAXIMUM VOH vs. IOH (VDD = 5V, -40°C TO +125°C)
5.5
5.0
4.5
4.0
Max
3.5
Typ (25°C)
3.0
VOH (V)
2.5
Min
2.0
0.5
0.0
0 5 10 15 20 25
IOH (-mA)
3.5
2.5
Max
2.0
VOH (V)
Typ (25°C)
1.5
Min
1.0
0.5
0.0
0 5 10 15 20 25
IOH (-mA)
FIGURE 18-18: TYPICAL, MINIMUM AND MAXIMUM VOL vs. IOL (VDD = 5V, -40°C TO +125°C)
1.0
0.9
Max (125°C)
Typical: statistical mean @ 25°C
0.8 Maximum: mean + 3σ (-40°C to +125°C)
Minimum: mean – 3σ (-40°C to +125°C)
0.7
0.5
Typ (25°C)
0.4
0.3
Min (-40°C)
0.2
0.1
0.0
0 5 10 15 20 25
IOL (-mA)
3.0
Max (125°C)
2.5 Typical: statistical mean @ 25°C
Maximum: mean + 3σ (-40°C to +125°C)
Minimum: mean – 3σ (-40°C to +125°C)
2.0
VOL (V)
1.5
Max (85°C)
1.0
Typ (25°C)
0.5
Min (-40°C)
0.0
0 5 10 15 20 25
IOL (-mA)
FIGURE 18-20: MINIMUM AND MAXIMUM VIN vs. VDD (TTL INPUT, -40°C TO +125°C)
1.5
1.4
Typical: statistical mean @ 25°C
Maximum: mean + 3σ (-40°C to +125°C)
Minimum: mean – 3σ (-40°C to +125°C)
1.3
VTH Max (-40°C)
1.2
1.1
VTH Typ (25°C)
VIN (V)
1.0
0.8
0.7
0.6
0.5
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
4.0
2.5
2.0
1.5
0.5
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 18-22: MINIMUM AND MAXIMUM VIN vs. VDD (I2C INPUT, -40°C TO +125°C)
3.5
VIH Max
Typical: statistical mean @ 25°C
3.0 Maximum: mean + 3σ (-40°C to +125°C)
Minimum: mean – 3σ (-40°C to +125°C)
2.5
2.0
V
VIL Max
ILMax
VIN (V)
VIH Min
1.5
1.0
VIL Min
0.5
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
3.5
-40°C
-40C
Differential or Integral Nonlinearity (LSB)
+25°C
25C
2.5
+85°C
85C
2
1.5
0.5
+125°C
125C
0
2 2.5 3 3.5 4 4.5 5 5.5
VDD and VREFH (V)
FIGURE 18-24: A/D NONLINEARITY vs. VREFH (VDD = 5V, -40°C TO +125°C)
3
2.5
Differential or Integral Nonlinearilty (LSB)
1.5
Max
Max (-40°C
(-40C toto125C)
+125°C)
Typ
Typ (+25°C)
(25C)
0.5
0
2 2.5 3 3.5 4 4.5 5 5.5
VREFH (V)
XXXXXXXXXXXXXXXXXX PIC16F877A/P
XXXXXXXXXXXXXXXXXX 0310017
XXXXXXXXXXXXXXXXXX
YYWWNNN
XXXXXXXXXX PIC16F877A
XXXXXXXXXX /PT
XXXXXXXXXX 0310017
YYWWNNN
XXXXXXXXXX PIC16F877A
XXXXXXXXXX -20/L
XXXXXXXXXX 0310017
YYWWNNN
Note: In the event the full Microchip part number cannot be marked on one line, it will
be carried over to the next line thus limiting the number of available characters
for customer specific information.
* Standard PICmicro device marking consists of Microchip part number, year code, week code, and
traceability code. For PICmicro device marking beyond this, certain price adders apply. Please check
with your Microchip Sales Office. For QTP devices, any special marking adders are included in QTP
price.
XXXXXXXXXX PIC16F877A
XXXXXXXXXX -I/ML
XXXXXXXXXX 0310017
YYWWNNN
XXXXXXXXXXXXXXXXX PIC16F876A/SP
XXXXXXXXXXXXXXXXX 0310017
YYWWNNN
XXXXXXXXXXXXXXXXXXXX PIC16F876A/SO
XXXXXXXXXXXXXXXXXXXX 0310017
XXXXXXXXXXXXXXXXXXXX
YYWWNNN
XXXXXXXXXXXX PIC16F876A/
XXXXXXXXXXXX SS
YYWWNNN 0310017
XXXXXXXX 16F873A
XXXXXXXX -I/ML
YYWWNNN 0310017
E1
2 α
n 1
A A2
L
c
β B1
A1
eB B p
E
E1
#leads=n1
D1 D
2
1
B
n
CH x 45 °
α
A
φ
β A1 A2
L
(F)
E
E1
#leads=n1
D1 D
n 1 2
CH2 x 45 ° CH1 x 45 °
A3 α
A2 A
35°
B1
c
B A1
β
p
E2 D2
E EXPOSED
METAL
PAD
D D2
2 B
1
n
OPTIONAL PIN 1 PIN 1
INDEX ON E2
INDEX ON
TOP MARKING EXPOSED PAD L
A
A1
A3
2
n 1 α
E A2
L
c
β A1 B1
eB B p
E
E1
p
B
2
n 1
h
α
45°
c
A A2
φ
β L A1
E1
p
B
2
n 1
α
A
c
A2
φ A1
L
β
E EXPOSED
METAL
E1 PADS
D1 D D2
p
2
1 B
n
R
E2
CH X 45° L
TOP VIEW BOTTOM VIEW
α
A2 A
A1
A3
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________ FAX: (______) _________ - _________
Application (optional):
Would you like a reply? Y N
Questions:
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
4. What additions to the document do you think would enhance the structure and subject?
5. What deletions from the document could be made without affecting the overall usefulness?