Escolar Documentos
Profissional Documentos
Cultura Documentos
com
• Os produtos Microchip atendem às especificações contidas em sua Folha de Dados Microchip específica.
• A Microchip acredita que sua família de produtos é uma das famílias do gênero mais seguras do mercado hoje, quando utilizada da maneira
pretendida e em condições normais.
• Existem métodos desonestos e possivelmente ilegais usados para violar o recurso de proteção do código. Todos esses métodos, até onde sabemos, requerem o
uso dos produtos Microchip de uma maneira fora das especificações operacionais contidas nas Folhas de Dados da Microchip. Muito provavelmente, a pessoa
que o faz está envolvida em roubo de propriedade intelectual.
• A Microchip está disposta a trabalhar com o cliente que está preocupado com a integridade de seu código.
• Nem a Microchip nem qualquer outro fabricante de semicondutor pode garantir a segurança de seu código. A proteção do código não
significa que estamos garantindo o produto como “inquebrável”.
A proteção do código está em constante evolução. Nós, da Microchip, estamos comprometidos em melhorar continuamente os recursos de proteção de código de nossos produtos. As tentativas de
quebrar o recurso de proteção de código da Microchip podem ser uma violação da Lei de Direitos Autorais do Milênio Digital. Se tais atos permitirem o acesso não autorizado ao seu software ou outro
trabalho protegido por direitos autorais, você pode ter o direito de entrar com um processo para obter reparação nos termos dessa lei.
• Ampla faixa de tensão de operação. (2,0 - 5,5 V) • Temporizador 1: temporizador / contador de 16 bits com capacidade de
• Flash de alta resistência / célula EEPROM • Timer2: temporizador / contador de 8 bits com registro
de período de 8 bits, prescaler e postscaler
- Resistência de gravação de 100.000 Flash
• Módulo de captura, comparação, PWM
- 1.000.000 de gravação de resistência EEPROM
- Captura / comparação de 16 bits
- 100 anos de retenção de dados
- PWM de 10 bits
• Receptor / transmissor universal endereçável
síncrono / assíncrono USART / SCI
Programa
Memória de Dados
Memória PCC Cronômetros
Dispositivo I/O USART Comparadores
Clarão SRAM EEPROM (PWM) 8/16 bits
PP
ICIC
RA4 / TOCKI / CMP2 3 16 RA7 / OSC1 / CLKIN
16
16F62
4
F 62
RA5 / MCLR / VPP 15 RA6 / OSC2 / CLKOUT
77AA
VWL 5 14 VDD
/6/2
68
28
RB0 / INT 6 13 RB7 / T1OSI / PGD
AA
/6/4
68
RB1 / RX / DT 7 12 RB6 / T1OSO / T1CKI / PGC
48AA
RB2 / TX / CK 8 11 RB5
RB7/T1OSI/PGD
RA4/T0CKI/CMP2
RA3/AN3/CMP1
RB4/PGM
RA1/AN1
RA0/AN0
RA2/AN2/VREF
RB5
VDD
VDD
RA1/AN1
RA0/AN0
25 NC
22 NC
11
20
19
18
17
16
15
14
13
12
28
27
26
24
23
PIC16F648A
1
2
3
4
5
6
7
8
9
VWL 5 17 VDD
NC 6 16 RB7 / T1OSI / PGD
RB0 / INT 7 15 RB6 / T1OSO / T1CKI / PGC
10
NC 11
12
13
NC 14
8
9
RB0/INT
VSS
VSS
RA3/AN3/CMP1
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
RA4/TOCKI/CMP2
RA2/AN2/VREF
RA5/MCLR/VPP
RB5
RB4/PGM
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
Se você tiver dúvidas ou comentários sobre esta publicação, entre em contato com o Departamento de Comunicação de Marketing por e-mail em
docerrors@mail.microchip.com ou envie por fax Formulário de Resposta do Leitor no verso desta folha de dados para (480) 792-4150.
Agradecemos seu feedback.
Errata
Uma folha de errata, descrevendo pequenas diferenças operacionais da folha de dados e soluções alternativas recomendadas, pode existir para os dispositivos
atuais. Conforme os problemas do dispositivo / documentação forem conhecidos por nós, publicaremos uma folha de errata. A errata especificará a revisão do
silício e a revisão do documento ao qual se aplica.
Para determinar se existe uma folha de errata para um dispositivo específico, verifique com um dos seguintes:
• Site mundial da Microchip; http://www.microchip.com
• O escritório de vendas local da Microchip (consulte a última página)
Memória Memória de dados RAM 224 224 256 224 224 256
(bytes)
EEPROM Data Mem- 128 128 256 128 128 256
ory (bytes)
Módulo (s) de temporizador TMR0, TMR1, TMR0, TMR1, TMR0, TMR1, TMR0, TMR1, TMR0, TMR1, TMR0, TMR1,
TMR2 TMR2 TMR2 TMR2 TMR2 TMR2
Comparador (es) 2 2 2 2 2 2
Periféricos Capturar / Comparar / 1 1 1 1 1 1
Módulos PWM
Comunicações Seriais USART USART USART USART USART USART
Tensão Interna sim sim sim sim sim sim
Referência
Fontes de interrupção 10 10 10 10 10 10
Pinos I / O 16 16 16 16 16 16
Recursos Faixa de tensão (Volts) 3,0-5,5 3,0-5,5 3,0-5,5 2,0-5,5 2,0-5,5 2,0-5,5
Redefinição de Brown-out sim sim sim sim sim sim
Pacotes DIP de 18 pinos, DIP de 18 pinos, DIP de 18 pinos, DIP de 18 pinos, DIP de 18 pinos, DIP de 18 pinos,
SOIC, 20 pinos SOIC, 20 pinos SOIC, 20 pinos SOIC, 20 pinos SOIC, 20 pinos SOIC, 20 pinos
SSOP, SSOP, SSOP, SSOP, SSOP, SSOP,
28 pinos QFN 28 pinos QFN 28 pinos QFN 28 pinos QFN 28 pinos QFN 28 pinos QFN
Todos os dispositivos da família PICmicro® têm Power-on Reset, Watchdog Timer selecionável, Code Protect selecionável e capacidade de alta corrente de E / S. Todos os
dispositivos da família PIC16F627A / 628A / 648A usam programação serial com pino de relógio RB6 e pino de dados RB7.
3,0 VISÃO GERAL DA ARQUITETURA A ALU tem largura de 8 bits e é capaz de operações de adição,
subtração, deslocamento e lógicas. A menos que seja
O alto desempenho da família PIC16F627A / 628A / 648A mencionado de outra forma, as operações aritméticas são o
pode ser atribuído a uma série de recursos arquitetônicos complemento de dois por natureza. Em instruções de dois
comumente encontrados em microprocessadores RISC. operandos, normalmente um operando é o registro de trabalho
Para começar, o PIC16F627A / 628A / 648A usa uma (registro W). O outro operando é um registro de arquivo ou uma
arquitetura Harvard, na qual o programa e os dados são constante imediata. Em instruções de operando único, o
acessados de memórias separadas usando barramentos operando é o registrador W ou um registrador de arquivo.
separados. Isso melhora a largura de banda em relação à
O registro W é um registro de trabalho de 8 bits usado para
arquitetura Von Neumann tradicional, onde o programa e
operações ALU. Não é um registro endereçável.
os dados são obtidos da mesma memória. A separação
do programa e da memória de dados permite ainda que Dependendo da instrução executada, a ALU pode
as instruções sejam dimensionadas de maneira diferente afetar os valores dos bits Carry (C), Digit Carry (DC) e
da palavra de dados de 8 bits. Os opcodes de instrução Zero (Z) no registro de statuster. Os bits C e DC
têm 14 bits de largura, tornando possível ter todas as operam como um bit Borrow e Digit Borrow out,
instruções de palavra única. Um barramento de acesso à respectivamente, bit em subtração. Veja oSUBLW e
memória de programa de 14 bits busca uma instrução de SUBWF instruções para exemplos.
14 bits em um único ciclo. Um pipeline de dois estágios Um diagrama de blocos simplificado é mostrado na Figura 3-1 e uma
sobrepõe a busca e a execução de instruções. descrição dos pinos do dispositivo na Tabela 3-2.
Consequentemente,
Dois tipos de memória de dados são fornecidos nos
A Tabela 3-1 relaciona os tamanhos de memória do dispositivo (Flash, Dados dispositivos PIC16F627A / 628A / 648A. Não volátil
e EEPROM). A memória de dados EEPROM é fornecida para armazenamento de
longo prazo de dados, como valores de calibração, consulta de dados
TABELA 3-1: LISTA DE MEMÓRIA DO DISPOSITIVO da tabela e quaisquer outros dados que possam exigir atualização
periódica no campo. Esses dados não são perdidos quando a energia é
Memória removida. A outra memória de dados fornecida é a memória de dados
Dispositivo RAM regular. A memória de dados RAM regular é fornecida para
Clarão RAM EEPROM
armazenamento temporário de dados durante a operação normal. Os
Programa Dados Dados
dados são perdidos quando a energia é removida.
PIC16F627A 1024 x 14 224 x 8 128 x 8
PIC16F628A 2.048 x 14 224 x 8 128 x 8
PIC16F648A 4.096 x 14 256 x 8 256 x 8
PIC16LF627A 1024 x 14 224 x 8 128 x 8
PIC16LF628A 2.048 x 14 224 x 8 128 x 8
PIC16LF648A 4.096 x 14 256 x 8 256 x 8
13 Barramento de Dados
8
Contador de programa
Clarão
Programa
Memória RAM
Pilha de 8 níveis
Arquivo
(13 bits) Registros
Programa
14 PORTA
Ônibus Endereço RAM (1) 9
Addr MUX RA0 / AN0
Instrução reg
RA1 / AN1
Endereço direto 7 Indireto RA2 / AN2 / VREF
8 Addr
RA3 / AN3 / CMP1
FSR reg RA4 /T0CK1 / CMP2
RA5 / MCLR / VPP
RA6 / OSC2 / CLKOUT
Status Reg
8 RA7 / OSC1 / CLKIN
3 MUX PORTB
Energizar
Cronômetro RB0 / INT
RB1 / RX / DT
Instrução Oscilador
RB2 / TX / CK
Decodificar e Temporizador de inicialização
ALU RB3 / CCP1
Ao controle
Ligar RB4 / PGM
Redefinir 8
RB5
Cronometragem Cão de guarda
W reg RB6 / T1OSO / T1CKI / PGC
Geração
RB7 / T1OSI / PGD
Cronômetro
Baixa voltagem
Programação
RB0 / INT RB0 TTL CMOS Porta de E / S bidirecional. Pode ser programado
por software para pull-up interno fraco.
RB6 / T1OSO / T1CKI / PGC RB6 TTL CMOS Porta de E / S bidirecional. Alteração de interrupção no
pino. Pode ser programado por software para pull-up
interno fraco.
RB7 / T1OSI / PGD RB7 TTL CMOS Porta de E / S bidirecional. Alteração de interrupção no
pino. Pode ser programado por software para pull-up
interno fraco.
T1 Q2 3º T Q4 T1 Q2 3º T Q4 T1 Q2 3º T Q4
OSC1
T1
Q2 interno
Estágio
3º T relógio
Q4
PC PC PC + 1 PC + 2
CLKOUT
Buscar INST (PC)
Execute INST (PC-1) Buscar INST (PC + 1)
Execute INST (PC) Buscar INST (PC + 2)
Execute INST (PC + 1)
Todas as instruções são de ciclo único, exceto para quaisquer ramificações do programa. Isso leva dois ciclos, pois a instrução de busca é
“liberada” do pipeline enquanto a nova instrução está sendo buscada e então executada.
RP1 RP0
Programa On-Chip
Memória
PIC16F648A apenas
0FFFh
1FFFh
Endereço
Endereço indireto(1) 00h Endereço indireto(1) 80h Endereço indireto(1) 100h Endereço indireto(1) 180h
TMR0 01h OPÇÃO 81h TMR0 101h OPÇÃO 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
07h 87h 107h 187h
08h 88h 108h 188h
09h 89h 109h 189h
PCLATH 0Ah PCLATH 8 ah PCLATH 10 ah PCLATH 18 ah
INTCON 0Bh INTCON 8Bh INTCON 10Bh INTCON 18Bh
PIR1 0Ch PIE1 8Ch 10Ch 18Ch
0Dh 8Dh 10Dh 18Dh
TMR1L 0Eh PCON 8Eh 10Eh 18Eh
TMR1H 0Fh 8Fh 10Fh 18Fh
T1CON 10h 90h
TMR2 11h 91h
T2CON 12h PR2 92h
13h 93h
14h 94h
CCPR1L 15h 95h
CCPR1H 16h 96h
CCP1CON 17h 97h
RCSTA 18h TXSTA 98h
TXREG 19h SPBRG 99h
RCREG 1 ah EEDATA 9 ah
1Bh EEADR 9Bh
1Ch EECON1 9Ch
1Dh EECON2(1) 9Dh
1Eh 9Eh
CMCON 1Fh VRCON 9Fh 11Fh
20h Em geral 120h
A0h Propósito
Em geral Em geral Registro
Propósito Propósito 48 bytes 14Fh
Registro Registro
150h
80 bytes
80 bytes
Endereço
Endereço indireto(1) 00h Endereço indireto(1) 80h Endereço indireto(1) 100h Endereço indireto(1) 180h
TMR0 01h OPÇÃO 81h TMR0 101h OPÇÃO 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
07h 87h 107h 187h
08h 88h 108h 188h
09h 89h 109h 189h
PCLATH 0Ah PCLATH 8 ah PCLATH 10 ah PCLATH 18 ah
INTCON 0Bh INTCON 8Bh INTCON 10Bh INTCON 18Bh
PIR1 0Ch PIE1 8Ch 10Ch 18Ch
0Dh 8Dh 10Dh 18Dh
TMR1L 0Eh PCON 8Eh 10Eh 18Eh
TMR1H 0Fh 8Fh 10Fh 18Fh
T1CON 10h 90h
TMR2 11h 91h
T2CON 12h PR2 92h
13h 93h
14h 94h
CCPR1L 15h 95h
CCPR1H 16h 96h
CCP1CON 17h 97h
RCSTA 18h TXSTA 98h
TXREG 19h SPBRG 99h
RCREG 1 ah EEDATA 9 ah
1Bh EEADR 9Bh
1Ch EECON1 9Ch
1Dh EECON2(1) 9Dh
1Eh 9Eh
CMCON 1Fh VRCON 9Fh 11Fh
20h 120h
A0h
Em geral Em geral Em geral
Propósito Propósito Propósito
Registro Registro Registro
80 bytes 80 bytes
80 bytes
Redefinir(1) Página
Banco 0
00h INDF Endereçar esta localização usa o conteúdo do FSR para endereçar a memória de dados (não um registro físico) xxxx xxxx 28
01h TMR0 Registro do módulo Timer0 xxxx xxxx 45
02h PCL Byte menos significativo do contador do programa (PC) 0000 0000 28
03h STATUS IRP RP1 RP0 PARA PD Z DC C 0001 1xxx 22
04h FSR Ponteiro de endereço de memória de dados indiretos xxxx xxxx 28
05h PORTA RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0 xxxx 0000 31
06h PORTB RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 xxxx xxxx 36
07h - Não implementado - -
08h - Não implementado - -
09h - Não implementado - -
0Ah PCLATH - - - Buffer de gravação para os 5 bits superiores do contador do programa - - - 0 0000 28
0Bh INTCON GIE PEIE T0IE INTE RBIE T0IF INTF TXIF - CCP1IF TMR2IF RBIF 0000 000x 24
0Ch PIR1 EEIF CMIF RCIF TMR1IF 0000 - 000 26
0Dh - Não implementado - -
0Eh TMR1L Holding register para o byte menos significativo do TMR1 de 16 bits. xxxx xxxx 48
0Fh TMR1H Holding register para o byte mais significativo do TMR1 de 16 bits xxxx xxxx 48
10h T1CON - - T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON - - 00 0000 48
11h TMR2 Registro do módulo TMR2 0000 0000 52
12h T2CON - TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 52
13h - Não implementado - -
14h - Não implementado - -
15h CCPR1L Capture / Compare / PWM register (LSB) xxxx xxxx 55
16h CCPR1H Capture / Compare / PWM register (MSB) xxxx xxxx 55
17h CCP1CON - - CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 - - 00 0000 55
18h RCSTA SPEN RX9 SREN CREN ADEN FERR OERR RX9D 0000 000x 69
19h TXREG USART Transmitir registro de dados 0000 0000 76
1 ah RCREG USART Receber registro de dados 0000 0000 79
1Bh - Não implementado - -
1Ch - Não implementado - -
1Dh - Não implementado - -
1Eh - Não implementado - -
1Fh CMCON C2OUT C1OUT C2INV C1INV CIS CM2 CM1 CM0 0000 0000 61
Lenda: - = Locais não implementados lidos como '0', u = inalterado, x = desconhecido, q = valor depende da condição,
sombreado = não implementado
Nota 1: Para a condição de inicialização para tabelas de registros, consulte a Tabela 14-6 e a Tabela 14-7.
Redefinir(1) Página
Banco 1
80h INDF O endereçamento deste local usa o conteúdo do FSR para endereçar a memória de dados (não um registro físico) xxxx xxxx 28
81h OPÇÃO RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 23
82h PCL Byte menos significativo do contador do programa (PC) 0000 0000 28
83h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 22
84h FSR Indirect data memory address pointer xxxx xxxx 28
85h TRISA TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 1111 1111 31
86h TRISB TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 1111 1111 36
87h — Unimplemented — —
88h — Unimplemented — —
89h — Unimplemented — —
8Ah PCLATH — — — Write buffer for upper 5 bits of program counter - - - 0 0000 28
8Bh INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 24
8Ch PIE1 EEIE CMIE RCIE TXIE — CCP1IE TMR2IE TMR1IE 0000 - 000 25
8Dh — Unimplemented — —
8Eh PCON — — — — OSCF — POR BOR - - - - 1-0x 27
8Fh — Unimplemented — —
90h — Unimplemented — —
91h — Unimplemented — —
92h PR2 Timer2 Period Register 1111 1111 52
93h — Unimplemented — —
94h — Unimplemented — —
95h — Unimplemented — —
96h — Unimplemented — —
97h — Unimplemented — —
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 - 010 71
99h SPBRG Baud Rate Generator Register 0000 0000 71
9Ah EEDATA EEPROM data register xxxx xxxx 89
9Bh EEADR EEPROM address register xxxx xxxx 90
9Ch EECON1 —— — — WRERR WREN WR RD - - - - x000 90
9Dh EECON2 EEPROM control register 2 (not a physical register) ---- ---- 90
9Eh — Unimplemented — —
9Fh VRCON VREN VROE VRR — VR3 VR2 VR1 VR0 000- 0000 67
Legend: — = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition, shaded = unim-
plemented
Note 1: For the Initialization Condition for Registers Tables, refer to Table 14-6 and Table 14-7.
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)
00 = Bank 0 (00h - 7Fh)01 = Bank 1 (80h - FFh)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
4.3.2 STACK
The PIC16F627A/628A/648A family has an 8-level deep
x 13-bit wide hardware stack (Figure 4-1). The stack
space is not part of either program or data space and
the stack pointer is not readable or writable. The PC is
PUSHed onto the stack when a CALL instruction is
executed or an interrupt causes a branch. The stack is
POPed in the event of a RETURN, RETLW or aRETFIE
instruction execution. PCLATH is not affected by a
PUSH or POP operation.
Status Status
Register Direct Addressing Indirect Addressing
Register
RP1 RP0 6 from opcode 0 IRP 7 FSR Register 0
RAM
File
Registers
7Fh 1FFh
Bank 0 Bank 1 Bank 2 Bank 3
Note: For memory map detail see Figure 4-3, Figure 4-2 and Figure 4-1.
D Q
RA2 Pin
WR
TRISA
CK Q Analog
Input Mode VSS
TRIS Latch (CMCON Reg.)
RD
TRISA Schmitt Trigger
Input Buffer
Q D
EN
RD PORTA
To Comparator
VROE
VREF
D Q
RA3 Pin
WR
TRISA Analog
CK Q
Input Mode VSS
TRIS Latch (CMCON Reg.)
RD
TRISA Schmitt Trigger
Input Buffer
Q D
EN
RD PORTA
To Comparator
D Q
RA4 Pin
WR N
TRISA
CK Q
TRIS Latch Vss Vss
Schmitt Trigger
Input Buffer
RD TRISA
Q D
EN
RD PORTA
CLKOUT(FOSC/4)
1
MCLRE (Configuration Bit)
MCLR
circuit
D Q 0
WR
MCLR Filter PORTA
CK Q
Program Schmitt Trigger (FOSC = VSS
Data Latch
mode Input Buffer 101, 111) (2)
HV Detect
RA5/MCLR/VPP
D Q
WR
Data TRISA
CK Q
Bus
VSS TRIS Latch
RD
TRISA Schmitt
Trigger
Input Buffer
FOSC =
RD 011, 100, 110 (1)
TRISA VSS
Q D
Q D
EN
EN RD PORTA
RD
PORTA Note 1: INTOSC with RA6 = I/O or RC with RA6 = I/O.
2: INTOSC with RA6 = CLKOUT or RC with RA6 =
CLKOUT.
To Clock Circuits
VDD
Data Bus
D Q
RA7/OSC1/CLKIN Pin
WR PORTA
CK Q
Data Latch
D VSS
Q
WR TRISA
CK Q
TRIS Latch
RD TRISA
Q D
Schmitt Trigger
Input Buffer
EN
RD PORTA
05h PORTA RA7 RA6 RA5(2) RA4 RA3 RA2 RA1 RA0 xxxx 0000 qqqu 0000
85h TRISA TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 1111 1111 1111 1111
1Fh CMCON C2OUT C1OUT C2INV C1INV CIS CM2 CM1 CM0 0000 0000 0000 0000
9Fh VRCON VREN VROE VRR — VR3 VR2 VR1 VR0 000- 0000 000- 0000
Legend: — = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition,
shaded = unimplemented
Note 1: Shaded bits are not used by PORTA.
2: MCLRE Configuration Bit sets RA5 functionality.
5.2 PORTB and TRISB Registers This interrupt on mismatch feature, together with
software configurable pull-ups on these four pins
PORTB is an 8-bit wide bidirectional port. The allow easy interface to a key pad and make it possible
corresponding data direction register is TRISB. A ‘1’ in for wake-up on key-depression. (See AN552)
the TRISB register puts the corresponding output
driver in a High-impedance mode. A '0' in the TRISB Note: If a change on the I/O pin should occur
register puts the contents of the output latch on the when a read operation is being executed
selected pin(s). (start of the Q2 cycle), then the RBIF
interrupt flag may not get set.
PORTB is multiplexed with the external interrupt,
USART, CCP module and the TMR1 clock input/output. The interrupt-on-change feature is recommended for
The standard port functions and the alternate port wake-up on key depression operation and operations
functions are shown in Table 5-3. Alternate port where PORTB is only used for the interrupt-on-change
functions may override TRIS setting when enabled. feature. Polling of PORTB is not recommended while
using the interrupt-on-change feature.
Reading PORTB register reads the status of the pins,
whereas writing to it will write to the port latch. All write
operations are read-modify-write operations. So a write
to a port implies that the port pins are first read, then this
value is modified and written to the port data latch.
Each of the PORTB pins has a weak internal pull-up
(-200 -A typical). A single control bit can turn on all the
pull-ups. This is done by clearing the RBPU
(OPTION<7>) bit. The weak pull-up is automatically
turned off when the port pin is configured as an
output. The pull-ups are disabled on Power-on Reset.
Four of PORTB’s pins, RB<7:4>, have an interrupt-
onchange feature. Only pins configured as inputs can
cause this interrupt to occur (i.e., any RB<7:4> pin
configured as an output is excluded from the
interrupton-change comparison). The input pins (of
RB7:RB4) are compared with the old value latched on
the last read of PORTB. The “mismatch” outputs of
RB7:RB4 are OR’ed together to generate the RBIF
interrupt (flag latched in INTCON<0>).
This interrupt can wake the device from Sleep. The
user, in the interrupt service routine, can clear the
interrupt in the following manner:
a) Any read or write of PORTB. This will end the
mismatch condition.
b) Clear flag bit RBIF.
A mismatch condition will continue to set flag bit RBIF.
Reading PORTB will end the mismatch condition and
allow flag bit RBIF to be cleared.
Data Bus 0
Data Bus D Q RB1/
D Q
RX/DT
RB0/INT WR PORTB
WR PORTB CK Q
CK Q
Data Latch VSS
Data Latch VSS
D Q
D Q WR TRISB
CK Q
WR TRISB
CK Q TRIS Latch
Peripheral OE(1)
TRIS Latch
TTL
RD TRISB Input
Buffer
TTL
RD TRISB
Input Q D
Buffer
Q D EN
RD PORTB
EENN
Data Bus
D Q 0 RB2/ Data Bus
D Q 1 RB3/
TX/CK CCP1
WR PORTB WR PORTB
CK Q CK Q
D Q D Q
WR TRISB WR TRISB
CK Q CK Q
TTL TTL
Input Input
RD TRISB RD TRISB
Buffer Buffer
Q D Q D
EN EN
RD PORTB RD PORTB
Note 1: Peripheral OE (output enable) is only active if Note 1: Peripheral OE (output enable) is only active if
peripheral select is active. peripheral select is active.
Data Bus
D Q VDD
WR PORTB
CK Q
Data Latch
RB4/PGM
D Q
WR TRISB
CK Q
VSS
TRIS Latch
RD TRISB
RD PORTB
PGM input
TTL
Schmitt
input
Trigger
buffer
Q D
EN Q1
Set RBIF
From other Q D
RB<7:4> pins
Q3
EN
Note: The low voltage programming disables the interrupt-on-change and the weak pull-ups on RB4.
Data Bus
D Q
RB5 pin
WR PORTB
CK Q
Data Latch
VSS
D Q
WR TRISB
CK Q
TRIS Latch
TTL
input
buffer
RD TRISB
Q D
RD PORTB
EN Q1
Set RBIF
From other Q D
RB<7:4> pins
Q3
EN
VDD
RBPU
P weak pull-up
Data Bus
D Q
VDD
WR PORTB
CK Q
Data Latch
RB6/
D Q T1OSO/
T1CKI
WR TRISB pin
CK Q
VSS
TRIS Latch
RD TRISB
T1OSCEN
TTL
input
buffer
RD PORTB
TMR1 Clock
Schmitt
From RB7 Trigger
Q D
EN Q1
Set RBIF
From other Q D
RB<7:4> pins
Q3
EN
VDD
Data Bus
D Q
WR PORTB RB7/T1OSI
CK Q
pin
Data Latch
D Q VSS
WR TRISB
CK Q
TRIS Latch
RD TRISB
T10SCEN
TTL
RD PORTB input
buffer
Schmitt
Trigger
Q D
EN Q1
Set RBIF
From other Q D
RB<7:4> pins
Q3
EN
81h, 181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
Legend: u = unchanged, x = unknown Shaded
Note 1: bits are not used by PORTB.
2: LVP Configuration Bit sets RB4 functionality.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PC PC PC + 1 PC + 2 PC + 3
Instruction MOVWF PORTB MOVF PORTB, W NOP NOP
fetched Write to PORTB Read to PORTB
Port pin
sampled here
TPD
Execute Execute Execute
MOVWF MOVF NOP
PORTB PORTB, W
Note 1: This example shows write to PORTB followed by a read from PORTB. Data setup time = (0.25 TCY - TPD) where TCY =
2: instruction cycle and TPD = propagation delay of Q1 cycle to output valid. Therefore, at higher clock frequencies, a write
followed by a read may be problematic.
8
0
T0CKI 1 SYNC
PIN 1 TMR0 REG
2
0 CYCLES
T0SE
T0CS
SET FLAG BIT T0IF
TMR1 Clock Source PSA ON OVERFLOW
0
WDT POSTSCALER/
WATCHDOG TMR0 PRESCALER
1
TIMER
8
PSA
8-TO-1MUX PS0 - PS2
1
WDT
0 TIME OUT
PSA
Note: T0SE, T0CS, PS. A, PS0-PS2 are bits in the Option Register.
01h, 101h TMR0 Timer0 module register xxxx xxxx uuuu uuuu
0Bh, 8Bh,
INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
81h, 181h OPTION(2) RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
85h TRISA TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 1111 1111 1111 1111
Legend: — = Unimplemented locations, read as ‘0’, u = unchanged, x = unknown
Note 1: Shaded bits are not used by Timer0 module.
2: Option is referred by OPTION_REG in MPLAB®.
This bit is ignored. Timer1 uses the internal clock when TMR1CS = 0.
bit 1 TMR1CS: Timer1 Clock Source Select bit
1 = External clock from pin RB6/T1OSO/T1CKI (on the rising edge)0
= Internal clock (FOSC/4)
bit 0 TMR1ON: Timer1 On bit
1 = Enables Timer10
= Stops Timer1
Note 1: The oscillator inverter and feedback resistor are turned off to eliminate power drain.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Counter mode is selected by setting bit TMR1CS. In When the prescaler is 1:1, the external clock input is the
this mode the TMR1 register pair value increments on same as the prescaler output. The synchronization of
every rising edge of clock input on pin RB7/T1OSI T1CKI with the internal phase clocks is accomplished by
when bit T1OSCEN is set or pin RB6/T1OSO/T1CKI sampling the prescaler output on the Q2 and Q4 cycles of
when bit T1OSCEN is cleared. the internal phase clocks. Therefore, it is necessary for
T1CKI to be high for at least 2Tosc (and a small RC delay
If T1SYNC is cleared, then the external clock input is of 20 ns) and low for at least 2Tosc (and a small RC delay
synchronized with internal phase clocks. The of 20 ns). Refer to the appropriate electrical specifications,
synchronization is done after the prescaler stage. The parameters 45, 46, and 47.
prescaler stage is an asynchronous ripple-counter.
When a prescaler other than 1:1 is used, the external
In this configuration, during Sleep mode, the TMR1 clock input is divided by the asynchronous ripplecounter
register pair value will not increment even if the type prescaler so that the prescaler output is
external clock is present, since the synchronization symmetrical. In order for the external clock to meet the
circuit is shut off. The prescaler however will continue sampling requirement, the ripple-counter must be taken
to increment. into account. Therefore, it is necessary for T1CKI to have a
period of at least 4Tosc (and a small RC delay of 40 ns)
divided by the prescaler value. The only requirement on
T1CKI high and low time is that they do not violate the
minimum pulse width requirements of 10 ns). Refer to the
appropriate electrical specifications, parameters 45, 46,
and 47.
Note 1: When the T1OSCEN bit is cleared, the inverter and feedback resistor are turned off. This eliminates power drain.
;
7.3.1 EXTERNAL CLOCK INPUT TIMING
MOVF TMR1H, W ;Read high byte
WITH UNSYNCHRONIZED CLOCK MOVWF TMPH ;
If control bit T1SYNC is set, the timer will increment MOVF TMR1L, W ;Read low byte
MOVWF TMPL ;
completely asynchronously. The input clock must meet
; Re-enable the Interrupts (if required)
certain minimum high and low time requirements. Refer
CONTINUE ;Continue with your
to Table 17-8 in the Electrical Specifications Section, ;code
timing parameters 45, 46, and 47.
TOUTPS<3:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’
- n = Value at POR ‘1’ = Bit is set = Bit is cleared x = Bit is unknown
0Ch PIR1 EEIF CMIF RCIF TXIF — CCP1IF TMR2IF TMR1IF 0000 - 000 0000 - 000
8Ch PIE1 EEIE CMIE RCIE TXIE — CCP1IE TMR2IE TMR1IE 0000 - 000 0000 - 000
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 - 000 0000
1011 = Compare mode, trigger special event (CCP1IF bit is set; CCP1 resets TMR1
11xx = PWM mode
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Timer1 must be running in Timer mode or The special event trigger output of CCP1 resets the TMR1
Synchronized Counter mode if the CCP module is register pair. This allows the CCPR1 register to effectively
using the compare feature. In Asynchronous Counter be a 16-bit programmable period register for Timer1.
mode, the compare operation may not work.
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
0Ch PIR1 EEIF CMIF RCIF TXIF — CCP1IF TMR2IF TMR1IF 0000 - 000 0000 - 000
8Ch PIE1 EEIE CMIE RCIE TXIE — CCP1IE TMR2IE TMR1IE 0000 - 000 0000 - 000
86h, 186h TRISB PORTB Data Direction Register 1111 1111 1111 1111
11h TMR2 Timer2 module’s register 0000 0000 0000 0000
92h PR2 Timer2 module’s period register 1111 1111 1111 1111
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 - 000 0000 uuuu uuuu
15h CCPR1L xxxx xxxx
Capture/Compare/PWM register1 (LSB) Capture/Compare/PWM register1 uuuu uuuu
16h CCPR1H (MSB) CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 xxxx xxxx uuuu uuuu
17h CCP1CON — — 0000 - - 00 0000
Legend: x = unknown, u = unchanged, - = unimplemented read as ‘0’. Shaded cells are not used by PWM and Timer2.
When C2INV = 1:
1 = C2 VIN+ < C2 VIN-0
= C2 VIN+ > C2 VIN-
bit 6 C1OUT: Comparator 1 Output
When C1INV = 0:
1 = C1 VIN+ > C1 VIN-0
= C1 VIN+ < C1 VIN-
When C1INV = 1:
1 = C1 VIN+ < C1 VIN-0
= C1 VIN+ > C1 VIN-
bit 5 C2INV: Comparator 2 Output Inversion1
= C2 Output inverted0 = C2 Output not
inverted
bit 4 C1INV: Comparator 1 Output Inversion
1 = C1 Output inverted0 = C1
Output not inverted
bit 3 CIS: Comparator Input Switch
When CM2:CM0: = 001
Then:
1 = C1 VIN- connects to RA30
= C1 VIN- connects to RA0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
D VIN-
RA1/AN1 A V IN
- RA1/AN1
Off (Read as '0') D V IN
+ C2 Off (Read as '0')
RA2/AN2/VREF A VIN+ C2 RA2/AN2/VREF
VSS
Four Inputs Multiplexed to Two Comparators
Two Independent Comparators CM2:CM0 = 010
CM2:CM0 = 100
RA0/AN0 A
A VIN- CIS = 0 V IN
-
RA0/AN0 A
RA3/AN3/CMP1 CIS = 1 C1VOUT
A VIN+ C1 C1VOUT VIN+ C1
RA3/AN3/CMP1
RA1/AN1 A
CIS = 0 VIN-
RA1/AN1 A VIN- RA2/AN2/VREF A CIS = 1 C2VOUT
VIN+ C2
C2 C2VOUT
RA2/AN2/VREF A VIN+
From VREF
Module
Two Common Reference Comparators Two Common Reference Comparators with Outputs
CM2:CM0 = 011 CM2:CM0 = 110
A VIN-
A VIN- RA0/AN0
RA0/AN0 C1VOUT
D VIN+ C1
D V IN
+ C1 C1VOUT RA3/AN3/CMP1
RA3/AN3/CMP1
RA1/AN1 A VIN-
RA1/AN1 A VIN-
C2VOUT A VIN+ C2 C2VOUT
RA2/AN2/VREF A VIN+ C2 RA2/AN2/VREF
RA0/AN0 D VIN- A
RA0/AN0 CIS = 0 VIN-
D V IN
+ C1 Off (Read as '0')
RA3/AN3/CMP1 RA3/AN3/CMP1 A CIS = 1
V IN
+ C1 C1VOUT
VSS
A = Analog Input, port reads zeros always. D = Digital Input. CIS (CMCON<3>) is the Comparator Input Switch.
CnINV
RD CMCON
EN Q1
CL
From other Comparator
Reset
VT = 0.6V RIC
RS < 10 K
AIN
CPIN ILEAKAGE
VA VT = 0.6V ±500 nA
5 pF
VSS
Legend CPIN = Input Capacitance
VT = Threshold Voltage
ILEAKAGE = Leakage Current At The Pin =
RIC Interconnect Resistance =
RS Source Impedance
VA = Analog Voltage
1Fh CMCON C2OUT C1OUT C2INV C1NV CIS CM2 CM1 CM0 0000 0000 0000 0000
0Bh, 8Bh,
INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
0Ch PIR1 EEIF CMIF RCIF TXIF — CCP1IF TMR2IF TMR1IF 0000CCP1IE - 000 0000 -000
8Ch PIE1 EEIE CMIE RCIE TXIE — TMR2IE TMR1IE 0000 - 000 0000 -000
85h TRISA TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 1111 1111 1111 1111
Legend: x = Unknown, u = Unchanged, - = Unimplemented, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
VREN
8R R R R R
8R VRR
VSS VSS
VR3
VREF 16-1 Analog Mux (From VRCON<3:0>)
VR0
Voltage
Reference
Output
Impedance
Note 1: R is dependent upon the Voltage Reference Configuration VRCON<3:0> and VRCON<5>.
REGISTER 12-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’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ ‘0’ =
- n = Value at POR ‘1’ = Bit is set Bit is cleared x = Bit is unknown
FOSC = 16 MHz
9615 – 9600
= ----------------------------- = 0.16%
Desired Baud Rate = 9600 9600
BRGH = 0
SYNC = 0 It may be advantageous to use the high baud rate
(BRGH = 1) even for slower baud clocks. This is
because the FOSC/(16(X + 1)) equation can reduce the
baud rate error in some cases.
Writing a new value to the SPBRG register, causes the
BRG timer to be Reset (or cleared), this ensures the
BRG does not wait for a timer overflow before
outputting the new baud rate.
0.3 NA — — NA — — NA — —
1.2 NA — — NA — — NA — —
2.4 NA — — NA — — NA — —
9.6 NA — — NA — — 9.766 + 1.73% 255
19.2 19.53 + 1.73% 255 19.23 + 0.16% 207 19.23 + 0.16% 129
76.8 76.92 + 0.16% 64 76.92 + 0.16% 51 75.76 - 1.36% 32
96 96.15 + 0.16% 51 95.24 - 0.79% 41 96.15 + 0.16% 25
300 294.1 - 1.96 16 307.69 + 2.56% 12 312.5 + 4.17% 7
500 500 0 9 500 0 7 500 0 4
HIGH 5000 — 0 4000 — 0 2500 — 0
LOW 19.53 — 255 15.625 — 255 9.766 — 255
0.3 NA — — NA — — NA — —
1.2 NA — — NA — — NA — —
2.4 NA — — NA — — NA — —
9.6 9.622 + 0.23% 185 9.6 0 131 9.615 + 0.16% 103
19.2 19.24 + 0.23% 92 19.2 0 65 19.231 + 0.16% 51
76.8 77.82 + 1.32 22 79.2 + 3.13% 15 75.923 + 0.16% 12
96 94.20 - 1.88 18 97.48 + 1.54% 12 1000 + 4.17% 9
300 298.3 - 0.57 5 316.8 5.60% 3 NA — —
500 NA — — NA — — NA — —
HIGH 1789.8 — 0 1267 — 0 100 — 0
LOW 6.991 — 255 4.950 — 255 3.906 — 255
0.3 NA — — NA — — NA — —
1.2 1.221 + 1.73% 255 1.202 + 0.16% 207 1.202 + 0.16% 129
2.4 2.404 + 0.16% 129 2.404 + 0.16% 103 2.404 + 0.16% 64
9.6 9.469 - 1.36% 32 9.615 + 0.16% 25 9.766 + 1.73% 15
19.2 19.53 + 1.73% 15 19.23 + 0.16% 12 19.53 + 1.73V 7
76.8 78.13 + 1.73% 3 83.33 + 8.51% 2 78.13 + 1.73% 1
96 104.2 + 8.51% 2 NA — — NA — —
300 312.5 + 4.17% 0 NA — — NA — —
500 NA — — NA — — NA — —
HIGH 312.5 — 0 250 — 0 156.3 — 0
LOW 1.221 — 255 0.977 — 255 0.6104 — 255
x16 CLK
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3
Samples
Baud CLK
First falling edge after RX pin goes low
Second rising edge
x4 CLK
1 2 3 4 1 2 3 4 1 2
Q2, Q4 CLK
Q2, Q4 CLK
Samples
RX Start bit
(RB1/RX/DT pin) bit 0
x16 CLK
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3
Samples
12.2 USART Asynchronous Mode software. It will Reset only when new data is loaded
into the TXREG register. While flag bit TXIF indicated
In this mode, the USART uses standard non-return-tozero the status of the TXREG register, another bit TRMT
(NRZ) format (one Start bit, eight or nine data bits and (TXSTA<1>) shows the status of the TSR register.
one Stop bit). The most common data format is 8-bit. A Status bit TRMT is a read only bit which is set when the
dedicated 8-bit baud rate generator is used to derive TSR register is empty. No interrupt logic is tied to this
baud rate frequencies from the oscillator. The USART bit, so the user has to poll this bit in order to
transmits and receives the LSb first. The USART’s determine if the TSR register is empty.
transmitter and receiver are functionally independent but
use the same data format and baud rate. The baud rate Note 1: The TSR register is not mapped in data
generator produces a clock either x16 or x64 of the bit memory so it is not available to the user.
shift rate, depending on bit BRGH (TXSTA<2>). Parity is 2: Flag bit TXIF is set when enable bit TXEN
not supported by the hardware, but can be implemented is set.
in software (and stored as the ninth data bit).
Transmission is enabled by setting enable bit TXEN
Asynchronous mode is stopped during Sleep.
(TXSTA<5>). The actual transmission will not occur
until the TXREG register has been loaded with data
Asynchronous mode is selected by clearing bit SYNC and the baud rate generator (BRG) has produced a
(TXSTA<4>). shift clock (Figure 12-5). The transmission can also be
The USART Asynchronous module consists of the started by first loading the TXREG register and then
following important elements: setting enable bit TXEN. Normally when transmission
is first started, the TSR register is empty, so a transfer
• Baud Rate Generator
to the TXREG register will result in an immediate
• Sampling Circuit transfer to TSR resulting in an empty TXREG. A backto-
• Asynchronous Transmitter back transfer is thus possible (Figure 12-7). Clearing
• Asynchronous Receiver enable bit TXEN during a transmission will cause the
transmission to be aborted and will Reset the
12.2.1 USART ASYNCHRONOUS transmitter. As a result the RB2/TX/CK pin will revert to
TRANSMITTER hi-impedance.
The USART transmitter block diagram is shown in In order to select 9-bit transmission, transmit bit TX9
Figure 12-5. The heart of the transmitter is the (TXSTA<6>) should be set and the ninth bit should be
transmit (serial) shift register (TSR). The shift register written to TX9D (TXSTA<0>). The ninth bit must be
obtains its data from the read/write transmit buffer, written before writing the 8-bit data to the TXREG
TXREG. The TXREG register is loaded with data in register. This is because a data write to the TXREG
software. The TSR register is not loaded until the Stop register can result in an immediate transfer of the
bit has been transmitted from the previous load. As data to the TSR register (if the TSR is empty). In such a
soon as the Stop bit is transmitted, the TSR is loaded case, an incorrect ninth data bit maybe loaded in the
with new data from the TXREG register (if available). TSR register.
Once the TXREG register transfers the data to the TSR
register (occurs in one TCY), the TXREG register is
empty and flag bit TXIF (PIR1<4>) is set. This interrupt
can be enabled/ disabled by setting/clearing enable
bit TXIE ( PIE1<4>). Flag bit TXIF will be set regardless
of the state of enable bit TXIE and cannot be cleared in
Write to TXREG
Word 1
BRG output
(shift clock)
RB2/TX/CK (pin)
Start Bit Bit 0 Bit 1 Bit 7/8 Stop Bit
WORD 1
TXIF bit
(Transmit buffer
reg. empty flag)
WORD 1
TRMT bit
Transmit Shift Reg
(Transmit shift
reg. empty flag)
Write to TXREG
Word 1 Word 2
BRG output
(shift clock)
RB2/TX/CK (pin)
Start Bit Bit 0 Bit 1 Bit 7/8 Stop Bit Start Bit Bit 0
TXIF bit
(interrupt reg. flag) WORD 1 WORD 2
RB1/RX/DT
Pin Buffer Data
and Control Recovery RX9
SPEN
RX9 Enable
ADEN Load of
Receive
RX9
Buffer
ADEN
RSR<8> 8
Interrupt RCIF
Data Bus
RCIE
RCIF
(INTERRUPT FLAG)
‘1’ ‘1’
ADEN = 1
(ADDRESS MATCH
ENABLE)
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 ADEN = 1 and Bit 8 = 0.
RCIF
(INTERRUPT FLAG)
‘1’ ‘1’
ADEN = 1
(ADDRESS MATCH
ENABLE)
Note: This timing diagram shows an address byte followed by an data byte. The data byte is not read into the RCREG
(receive buffer) because ADEN was not updated (still = 1) and Bit 8 = 0.
FIGURE 12-11: ASYNCHRONOUS RECEPTION WITH ADDRESS BYTE FIRST FOLLOWED BY VALID
DATA BYTE
RB1/RX/DT (PIN) START START
BIT BIT0 BIT1 BIT8 STOP BIT BIT0 BIT8 STOP
BIT BIT
RCV SHIFT
REG
RCV BUFFER REG
BIT8 = 1, ADDRESS BYTE WORD 1 BIT8 = 0, DATA BYTE WORD 2
RCREG RCREG
READ RCV
BUFFER REG
RCREG
RCIF
(INTERRUPT FLAG)
ADEN
(ADDRESS MATCH
ENABLE)
Note: This timing diagram shows an address byte followed by an data byte. The data byte is read into the RCREG
(Receive Buffer) because ADEN was updated after an address match, and was cleared to a ‘0’, so the contents of
the Receive Shift Register (RSR) are read into the Receive Buffer regardless of the value of Bit 8.
When the RX9 bit is set in the RCSTA register, 9 bits The receive block diagram is shown in Figure 12-8.
are received and the ninth bit is placed in the RX9D bit Reception is enabled by setting bit CREN (RCSTA<4>).
of the RCSTA register. The USART module has a special
provision for multi-processor communication.
Multiprocessor communication is enabled by setting 12.3.1.1 Setting up 9-bit mode with Address
the ADEN bit (RCSTA<3>) along with the RX9 bit. The Detect
port is now programmed such that when the last bit is Follow these steps when setting up Asynchronous
received, the contents of the receive shift register Reception with Address Detect Enabled:
(RSR) are transferred to the receive buffer, the ninth
bit of the RSR (RSR<8>) is transferred to RX9D, and the 1. TRISB<1> bit needs to be set and TRISB<2> bit
receive interrupt is set if and only if RSR<8> = 1. This cleared in order to configure pins RB2/TX/CK
feature can be used in a multi-processor system as and RB1/RX/DT as the Universal Synchronous
follows: Asynchronous Receiver Transmitter pins.
2. Initialize the SPBRG register for the appropriate baud
A master processor intends to transmit a block of data to
rate. If a high-speed baud rate is desired, set bit
one of many slaves. It must first send out an address byte
BRGH.
that identifies the target slave. An address byte is
identified by setting the ninth bit (RSR<8>) to a ‘1’ (instead 3. Enable asynchronous communication by setting
of a ‘0’ for a data byte). If the ADEN and RX9 bits are set in or clearing bit SYNC and setting bit SPEN.
the slave’s RCSTA register, enabling multiprocessor 4. If interrupts are desired, then set enable bit RCIE.
communication, all data bytes will be ignored. However, if
the ninth received bit is equal to a ‘1’, indicating that the 5. Set bit RX9 to enable 9-bit reception.
received byte is an address, the slave will be interrupted 6. Set ADEN to enable address detect.
and the contents of the RSR register will be transferred
7. Enable the reception by setting enable bit CREN
into the receive buffer. This allows the slave to be or SREN.
interrupted only by addresses, so that the slave can
8. Flag bit RCIF will be set when reception is
examine the received byte to see if it is being addressed.
complete, and an interrupt will be generated if
The addressed slave will then clear its ADEN bit and
enable bit RCIE was set.
prepare to receive data bytes from the master.
9. Read the 8-bit received data by reading the
RCREG register to determine if the device is
When ADEN is enabled (= ‘1’), all data bytes are being addressed.
ignored. Following the Stop bit, the data will not be
10. If any error occurred, clear the error by clearing
loaded into the receive buffer, and no interrupt will
enable bit CREN if it was already set.
occur. If another byte is shifted into the RSR register,
the previous data byte will be lost. 11. If the device has been addressed (RSR<8> = ‘1’
with address match enabled), clear the ADEN
and RCIF bits to allow data bytes and address
bytes to be read into the receive buffer and
interrupt the CPU.
O diagrama de blocos do transmissor USART é mostrado na Para selecionar a transmissão de 9 bits, o bit TX9 (TXSTA
Figura 12-5. O coração do transmissor é o registrador de <6>) deve ser definido e o nono bit deve ser gravado no
deslocamento de transmissão (serial) (TSR). O registro de bit TX9D (TXSTA <0>). O nono bit deve ser escrito antes de
deslocamento obtém seus dados do registro do buffer de gravar os dados de 8 bits no registro TXREG. Isso ocorre
transmissão de leitura / gravação TXREG. O registro TXREG é porque uma gravação de dados no TXREG pode resultar
carregado com dados no software. O registro TSR não é em uma transferência imediata dos dados para o
carregado até que o último bit tenha sido transmitido do registrador TSR (se o TSR estiver vazio). Se o TSR estava
carregamento anterior. Assim que o último bit é transmitido, o vazio e o TXREG foi escrito antes de escrever o “novo”
TSR é carregado com novos dados do TXREG (se disponível). Uma TX9D, o valor “presente” do bit TX9D é carregado.
vez que o registro TXREG transfere os dados para o registro TSR Siga estas etapas ao configurar uma transmissão
(ocorre em um Tcycle), o TXREG está vazio e o bit de interrupção, mestre síncrona:
TXIF (PIR1 <4>) é definido. A interrupção pode ser habilitada /
desabilitada configurando / apagando o bit de habilitação TXIE
1. O bit TRISB <1> precisa ser definido e o bit TRISB <2>
(PIE1 <4>). O bit de sinalização TXIF será definido
limpo para configurar os pinos RB2 / TX / CK e
independentemente do estado do bit TXIE de ativação e não pode
RB1 / RX / DT como os pinos do transmissor
ser apagado no software. Ele será reiniciado apenas quando
receptor assíncrono síncrono universal.
novos dados forem carregados no registro TXREG. Enquanto o bit 2. Inicialize o registro SPBRG para a taxa de transmissão
de bandeira TXIF indica o status do registro TXREG, outro bit apropriada (Seção 12.1 "Gerador de taxa de
TRMT (TXSTA <1>) mostra o status do registro TSR. TRMT é um bit transmissão USART (BRG)")
somente leitura que é definido quando o TSR está vazio. 3. Habilite a porta serial mestre síncrona
Nenhuma lógica de interrupção está ligada a este bit, então o configurando os bits SYNC, SPEN e CSRC.
usuário deve sondar este bit para determinar se o registro TSR 4. Se interrupções forem desejadas, defina o bit de habilitação
está vazio. O TSR não está mapeado na memória de dados, TXIE.
portanto, não está disponível para o usuário.
5. Se a transmissão de 9 bits for desejada, defina o bit TX9.
A transmissão é habilitada configurando o bit de habilitação 6. Habilite a transmissão configurando o bit TXEN.
TXEN (TXSTA <5>). A transmissão real não ocorrerá até que o
7. Se a transmissão de 9 bits for selecionada, o nono bit
registro TXREG tenha sido carregado com os dados. O
deve ser carregado no bit TX9D.
primeiro bit de dados será deslocado na próxima transição
8. Inicie a transmissão carregando dados para o registro
de subida disponível do relógio na linha CK. A saída de dados
TXREG.
é estável em torno da borda descendente do relógio síncrono
(Figura 12-12). A transmissão também pode ser iniciada
carregando primeiro o registro TXREG e, em seguida,
definindo o bit TXEN (Figura 12-13). Isso é vantajoso quando
taxas de baud lentas são selecionadas, uma vez que o BRG é
mantido em Reset quando os bits TXEN, CREN e SREN são
limpos. Definir o bit de habilitação TXEN iniciará o BRG,
criando um relógio de turno imediatamente. Normalmente,
quando a transmissão é iniciada pela primeira vez, o registro
TSR está vazio, portanto, uma transferência para o registro
TXREG resultará em uma transferência imediata para o TSR,
resultando em um TXREG vazio.
0Ch PIR1 EEIF CMIF RCIF TXIF - CCP1IF TMR2IF TMR1IF 0000 -000FERR 0000 - 000
18h RCSTA SPEN RX9 SREN CREN ADEN OERR RX9D 0000 000x 0000 000x
19h TXREG Registro de transmissão de dados USART 0000 0000 0000 0000
8Ch PIE1 EEIE CMIE RCIE TXIE - CCP1IE TMR2IE TMR1IE 0000 -000BRGH 0000 - 000
98h TXSTA CSRC TX9 TXEN SINCRONIZAR - TRMT TX9D 0000 - 010 0000 - 010
99h SPBRG Registro do gerador de taxa de transmissão 0000 0000 0000 0000
Lenda: x = desconhecido, - = não implementado, lido como '0'. As células sombreadas não são usadas para transmissão mestre síncrona.
PIN RB2 / TX / CK
ESCREVER PARA
TXREG REG
ESCREVER PALAVRA 1 ESCREVER PALAVRA 2
TXIF BIT
(BANDEIRA INTERROMPIDA)
TRMTTRMTT
BI
'1' '1'
TXEN BIT
Observação: Modo Sync Master; SPBRG = '0'. Transmissão contínua de duas palavras de 8 bits.
PIN RB2 / TX / CK
ESCREVER PARA
TXREG REG
TXIF BIT
TRMT BIT
TXEN BIT
<4>). Os dados são amostrados no pino RB1 / RX / DT na borda descendente do relógio. Se o bit SREN de habilitação estiver
Siga estas etapas ao configurar uma recepção mestre
definido, apenas uma palavra será recebida. Se o bit de habilitação CREN estiver definido, a recepção será contínua até que o CREN
síncrona:
seja apagado. Se ambos os bits forem definidos, o CREN terá precedência. Depois de cronometrar o último bit, os dados recebidos 1. O bit TRISB <1> precisa ser definido e o bit TRISB <2>
no Receive Shift Register (RSR) são transferidos para o registro RCREG (se estiver vazio). Quando a transferência for concluída, o bit limpo para configurar os pinos RB2 / TX / CK e
de sinalizador de interrupção RCIF (PIR1 <5>) é definido. A interrupção real pode ser habilitada / desabilitada configurando / RB1 / RX / DT como os pinos do transmissor
apagando o bit de habilitação RCIE (PIE1 <5>). O bit de bandeira RCIF é um bit somente leitura que é reiniciado pelo hardware. receptor assíncrono síncrono universal.
Neste caso, é reiniciado quando o registro RCREG foi lido e está vazio. O RCREG é um registrador com buffer duplo (ou seja, é um
2. Inicialize o registro SPBRG para a taxa de transmissão
FIFO de dois níveis). É possível que dois bytes de dados sejam recebidos e transferidos para o RCREG FIFO e um terceiro byte para
apropriada. (Seção 12.1 "Gerador de taxa de
começar a mudar para o registro RSR. No clock do último bit do terceiro byte, se o registro RCREG ainda estiver cheio, o bit de erro
transmissão USART (BRG)")
de overrun OERR (RCSTA <1>) é definido. A palavra no RSR será perdida. O registro RCREG pode ser lido duas vezes para recuperar
3. Habilite a porta serial mestre síncrona
os dois bytes no FIFO. O bit OERR deve ser apagado no software (apagando o bit CREN). Se o bit OERR estiver definido, as
configurando os bits SYNC, SPEN e CSRC.
transferências do RSR para o RCREG são inibidas, portanto, é essencial limpar o bit OERR se estiver definido. O nono bit de recepção
4. Certifique-se de que os bits CREN e SREN estejam limpos.
é armazenado em buffer da mesma maneira que os dados de recepção. Lendo o registro RCREG, irá carregar o bit RX9D O RCREG é
um registrador com buffer duplo (ou seja, é um FIFO de dois níveis). É possível que dois bytes de dados sejam recebidos e
5. Se interrupções forem desejadas, defina o bit de habilitação
transferidos para o RCREG FIFO e um terceiro byte para começar a mudar para o registro RSR. No clock do último bit do terceiro
RCIE.
byte, se o registro RCREG ainda estiver cheio, o bit de erro de overrun OERR (RCSTA <1>) é definido. A palavra no RSR será perdida. 6. Se a recepção de 9 bits for desejada, defina o bit RX9.
O registro RCREG pode ser lido duas vezes para recuperar os dois bytes no FIFO. O bit OERR deve ser apagado no software 7. Se uma única recepção for necessária, defina o bit SREN.
(apagando o bit CREN). Se o bit OERR estiver definido, as transferências do RSR para o RCREG são inibidas, portanto, é essencial Para recepção contínua, defina o bit CREN.
limpar o bit OERR se estiver definido. O nono bit de recepção é armazenado em buffer da mesma maneira que os dados de
8. O bit de sinalizador de interrupção RCIF será definido quando a
recepção. Lendo o registro RCREG, irá carregar o bit RX9D O RCREG é um registrador com buffer duplo (ou seja, é um FIFO de dois
recepção for concluída e uma interrupção será gerada se o bit de
níveis). É possível que dois bytes de dados sejam recebidos e transferidos para o RCREG FIFO e um terceiro byte para começar a
habilitação RCIE foi definido.
mudar para o registro RSR. No clock do último bit do terceiro byte, se o registro RCREG ainda estiver cheio, o bit de erro de overrun
9. Leia o registro RCSTA para obter o nono bit (se
OERR (RCSTA <1>) é definido. A palavra no RSR será perdida. O registro RCREG pode ser lido duas vezes para recuperar os dois
habilitado) e determine se ocorreu algum erro
bytes no FIFO. O bit OERR deve ser apagado no software (apagando o bit CREN). Se o bit OERR estiver definido, as transferências do
durante a recepção.
RSR para o RCREG são inibidas, portanto, é essencial limpar o bit OERR se estiver definido. O nono bit de recepção é armazenado
em buffer da mesma maneira que os dados de recepção. Lendo o registro RCREG, irá carregar o bit RX9D É possível que dois bytes
10. Leia os dados recebidos de 8 bits lendo o
de dados sejam recebidos e transferidos para o RCREG FIFO e um terceiro byte para começar a mudar para o registro RSR. No clock
registro RCREG.
do último bit do terceiro byte, se o registro RCREG ainda estiver cheio, o bit de erro de overrun OERR (RCSTA <1>) é definido. A
11. Se ocorrer algum erro, elimine o erro apagando o
bit CREN.
palavra no RSR será perdida. O registro RCREG pode ser lido duas vezes para recuperar os dois bytes no FIFO. O bit OERR deve ser apagado no software (apagando o bit CREN). Se o bit OERR estiver definido, as transferências do RSR para o RCREG são inibidas, portanto, é essencial limpar o bit OERR se ele estiver definido. O
0Ch PIR1 EEIF CMIF RCIF TXIF - CCP1IF TMR2IF TMR1IF 0000 -000FERR 0000 - 000
18h RCSTA SPEN RX9 SREN CREN ADEN OERR RX9D 0000 000x 0000 000x
1 ah RCREG USART Receber registro de 0000 0000 0000 0000
8Ch PIE1 dados EEPIE CMIE RCIE TXIE - CCP1IE TMR2IE TMR1IE -000 0000BRGH - 000 - 000
98h TXSTA CSRC TX9 TXEN SYNC - TRMT TX9D 0000 - 010 0000 - 010
99h SPBRG Registro do gerador de taxa de transmissão 0000 0000 0000 0000
Lenda: x = desconhecido, - = não implementado lido como '0'. As células sombreadas não são usadas para recepção mestre síncrona.
RB1 / RX / DT PIN BIT0 BIT1 BIT2 BIT3 BIT4 BIT5 BIT6 BIT7
PIN RB2 / TX / CK
ESCREVER PARA
BIT SREN
SREN BIT
RCIF BIT
(INTERROMPER)
LEITURA
RXREG
Observação: O diagrama de temporização demonstra o modo Sync Master com bit SREN = '1' e bit BRG = '0'.
12.5 Modo Slave Síncrono USART Siga estas etapas ao configurar uma transmissão
Slave Síncrona:
O modo Slave Síncrono difere do modo Master pelo fato
de que o shift clock é fornecido externamente no pino 1. O bit TRISB <1> precisa ser definido e o bit TRISB <2>
RB2 / TX / CK (ao invés de ser fornecido internamente no limpo para configurar os pinos RB2 / TX / CK e
modo Master). Isso permite que o dispositivo transfira ou RB1 / RX / DT como os pinos do transmissor
receba dados no modo de suspensão. O modo escravo é receptor assíncrono síncrono universal.
acessado limpando o bit CSRC (TXSTA <7>). 2. Habilite a porta serial escrava síncrona
configurando os bits SYNC e SPEN e limpando o
12.5.1 TRANSMISSÃO DE ESCRAVO bit CSRC.
SÍNCRONO USART 3. Limpe os bits CREN e SREN.
4. Se interrupções forem desejadas, defina o bit de habilitação
A operação dos modos Síncrono Mestre e Escravo são
TXIE.
idênticos, exceto no caso do modo Dormir.
5. Se a transmissão de 9 bits for desejada, defina o bit TX9.
6. Habilite a transmissão configurando o bit de habilitação
Se duas palavras forem escritas no TXREG e, em seguida, o
TXEN.
DORMIR a instrução for executada, ocorrerá o seguinte:
7. Se a transmissão de 9 bits for selecionada, o nono bit
a) A primeira palavra será imediatamente transferida para o
deve ser carregado no bit TX9D.
registrador TSR e transmitida.
8. Inicie a transmissão carregando dados para o registro
b) A segunda palavra permanecerá no registro TXREG.
TXREG.
c) O bit de bandeira TXIF não será definido.
Siga estas etapas ao configurar uma Recepção Slave 8. Leia os dados recebidos de 8 bits lendo o registro
Síncrona: RCREG.
9. Se ocorrer algum erro, elimine o erro apagando o bit
1. O bit TRISB <1> precisa ser definido e o bit TRISB <2>
CREN.
limpo para configurar os pinos RB2 / TX / CK e
RB1 / RX / DT como os pinos do transmissor
receptor assíncrono síncrono universal.
0Ch PIR1 EEIF CMIF RCIF TXIF - CCP1IF TMR2IF TMR1IF 0000 -000FERR 0000 - 000
18h RCSTA SPEN RX9 SREN CREN ADEN OERR RX9D 0000 000x 0000 000x
19h TXREG Registro de transmissão de dados USART 0000 0000 0000 0000
8Ch PIE1 EEIE CMIE RCIE TXIE - CCP1IE TMR2IE TMR1IE 0000 -000BRGH 0000 - 000
98h TXSTA CSRC TX9 TXEN SINCRONIZAR - TRMT TX9D 0000 - 010 0000 - 010
99h SPBRG Registro do gerador de taxa de transmissão 0000 0000 0000 0000
Lenda: x = desconhecido, - = não implementado lido como '0'. As células sombreadas não são usadas para Transmissão Slave Síncrona.
0Ch PIR1 EEIF CMIF RCIF TXIF - CCP1IF TMR2IF TMR1IF 0000 -000FERR 0000 - 000
18h RCSTA SPEN RX9 SREN CREN ADEN OERR RX9D 0000 000x 0000 000x
1 ah RCREG USART Receber registro de dados 0000 0000 0000 0000
8Ch PIE1 EEIE CMIE RCIE TXIE - CCP1IE TMR2IE TMR1IE 0000 -000BRGH 0000 - 000
98h TXSTA CSRC TX9 TXEN SINCRONIZAR - TRMT TX9D 0000 - 010 0000 - 010
99h SPBRG Registro do gerador de taxa de transmissão 0000 0000 0000 0000
Lenda: x = desconhecido, - = não implementado lido como '0'. Células sombreadas não são usadas para recepção Slave Síncrona.
13,0 DATA EEPROM MEMORY A memória de dados EEPROM permite a leitura e gravação de bytes.
Uma gravação de byte apaga automaticamente a localização e grava
A memória de dados EEPROM é legível e gravável durante a os novos dados (apagar antes de gravar). A memória de dados
operação normal (full VDD faixa). Esta memória não é EEPROM é classificada para altos ciclos de apagamento / gravação. O
mapeada diretamente no espaço do arquivo de registro. Em tempo de gravação é controlado por um temporizador no chip. O
vez disso, é indiretamente endereçado por meio dos registros tempo de gravação variará com a voltagem e a temperatura, bem
de função especial (SFRs). Existem quatro SFRs usados para como de chip para chip. Consulte as especificações AC para os limites
ler e gravar essa memória. Esses registros são: exatos.
• EECON1 Quando o dispositivo está protegido por código, a CPU pode
• EECON2 (Não é um registro fisicamente implementado) continuar a ler e gravar os dados na memória EEPROM. Um
• EEDATA programador de dispositivo não pode mais acessar esta
memória.
• EEADR
Informações adicionais sobre os dados EEPROM estão
EEDATA mantém os dados de 8 bits para leitura / gravação e
disponíveis no PICmicro® Manual de referência de médio
EEADR mantém o endereço da localização da EEPROM que
alcance (DS33023).
está sendo acessada. Os dispositivos PIC16F627A / 628A têm
128 bytes de dados EEPROM com uma faixa de endereço de
0h a 7Fh. O dispositivo PIC16F648A tem 256 bytes de dados
EEPROM com uma faixa de endereço de 0h a FFh.
bit 7-0 EEDATn: Valor do byte para escrever ou ler do local da memória EEPROM de dados.
Lenda:
R = bit legível W = Bit gravável '1' = U = bit não implementado, lido como '0' '0'
- n = Valor no POR Bit está definido = bit é apagado x = bit é desconhecido
bit 7 PIC16F627A / 628A - Endereço não implementado: Deve ser definido como '0' PIC16F648A - EEADR: Definido como '1'
especifica os 128 principais locais (128-256) de leitura / gravação EEPROM
Operação
bit 6-0 EEADR: Especifica um dos 128 locais da operação de leitura / gravação EEPROM
Lenda:
R = bit legível W = Bit gravável '1' = U = bit não implementado, lido como '0' '0'
- n = Valor no POR Bit está definido = bit apagado x = bit desconhecido
EECON1 é o registro de controle com quatro bits de ordem O bit do sinalizador de interrupção EEIF no registro PIR1 é definido
inferior fisicamente implementados. Os quatro bits superiores quando a gravação é concluída. Este bit deve ser apagado no software.
não existem e são lidos como '0's. EECON2 não é um registro físico. Ler EECON2 lerá todos
os '0's. O registro EECON2 é usado exclusivamente na
seqüência de gravação de dados EEPROM.
1 = inicia um ciclo de gravação. (O bit é apagado pelo hardware assim que a gravação for concluída. O bit WR
só pode ser definido (não apagado) no software.
0 = O ciclo de gravação para os dados EEPROM está completo
1 = Inicia uma leitura de EEPROM (a leitura leva um ciclo. RD é apagado no hardware. O bit RD
só pode ser definido (não apagado) no software).
0 = Não inicia uma leitura de EEPROM
Lenda:
R = bit legível W = Bit gravável '1' = U = bit não implementado, lido como '0' '0'
- n = Valor no POR Bit está definido = bit apagado x = bit desconhecido
MOVWF
Required
MOVLW AAh ; Existem condições em que o dispositivo pode não querer gravar
MOVWF EECON2 ;Escrever AAh na memória EEPROM de dados. Para proteger contra gravações
BSF EECON1, WR ; Definir WR pedaço espúrias de EEPROM, vários mecanismos foram integrados. Na
;começar escrever inicialização, WREN é apagado. Além disso, quando habilitado, o
BSF INTCON, GIE ;Permitir INTs. temporizador de inicialização (duração de 72 ms) impede a
gravação de EEPROM.
A gravação não será iniciada se a seqüência acima não for
seguida exatamente (gravar 55h em EECON2, gravar AAh em A seqüência de início de gravação e o bit WREN juntos ajudam a evitar
EECON2 e definir o bit WR) para cada byte. Recomendamos uma gravação acidental durante queda de energia, falha de energia ou
fortemente que as interrupções sejam desabilitadas durante este mau funcionamento do software.
Redefinir Reinicia
Lenda: x = desconhecido, u = inalterado, - = não implementado lido como '0', q = valor depende da condição.
As células sombreadas não são usadas pela EEPROM de dados.
Nota 1: EECON2 não é um registro físico.
1 = PWRT desativado0
= PWRT habilitado
1 = WDT habilitado
0 = WDT desativado
Observação 1: Habilitar Redefinição de Brown-out não habilita automaticamente o Power-up Timer (PWRT) da forma como fazia no PIC16F627 / 628.
2: O esquema de proteção de código foi alterado em relação ao esquema de proteção de código usado no PIC16F627 / 628. Toda a memória do programa Flash precisa ser apagada
em massa para definir o bit CP, desligando a proteção do código. Consulte a Especificação de Programação DS41196 para obter detalhes. Todos os dados EEPROM precisam ser
3: apagados em massa para definir o bit CPD, desligando a proteção do código. Consulte a Especificação de Programação DS41196 para obter detalhes.
Lenda:
R = bit legível W = Bit gravável '1' U = bit não implementado, lido como
- n = Valor no POR = bit definido '0' '0' = bit é limpo x = bit é desconhecido
O PIC16F627A / 628A / 648A pode ser operado em oito XT 455 kHz 22 - 100 pF 22 - 100 pF
opções de oscilador diferentes. O usuário pode 2,0 MHz 15 - 68 pF 15 - 68 pF
4,0 MHz 15 - 68 pF 15 - 68 pF
programar três bits de configuração (FOSC2 a FOSC0)
para selecionar um destes oito modos: HS 8,0 MHz 10 - 68 pF 10 - 68 pF
16,0 MHz 10 - 22 pF 10 - 22 pF
• LP Cristal de baixa potência
Observação: Capacitância mais alta aumenta a estabilidade do oscilador, mas
• XT Cristal / Ressonador também aumenta o tempo de inicialização. Esses valores são
apenas para orientação de design. Como cada ressonador tem
• HS Cristal / Resonator Externo / Capacitor suas próprias características, o usuário deve consultar o
• RC de Alta Velocidade (2 modos) fabricante do ressonador para obter os valores apropriados dos
componentes externos.
• Oscilador de precisão interno INTOSC (2 modos)
• CE Relógio externo TABELA 14-2: SELEÇÃO DE CAPACITOR PARA
OSCILADOR DE CRISTAL
14.2.2 OSCILADOR DE CRISTAL /
RESSONADORES DE CERÂMICA Modo Frequencia OSC1 (C1) OSC2 (C2)
LP 32 kHz 15 - 30 pF 15 - 30 pF
Nos modos XT, LP ou HS, um ressonador de cristal ou cerâmica é 200 kHz 0 - 15 pF 0 - 15 pF
conectado aos pinos OSC1 e OSC2 para estabelecer a oscilação
XT 100 kHz 68 - 150 pF 150 - 200 pF
(Figura 14-1). O projeto do oscilador PIC16F627A / 628A / 648A 2 MHz 15 - 30 pF 15 - 30 pF
requer o uso de um cristal de corte paralelo. O uso de um cristal 4 MHz 15 - 30 pF 15 - 30 pF
lapidado em série pode fornecer uma frequência fora das HS 8 MHz 15 - 30 pF 15 - 30 pF
especificações do fabricante do cristal. Quando nos modos XT, LP 10 MHz 15 - 30 pF 15 - 30 pF
20 MHz 15 - 30 pF 15 - 30 pF
ou HS, o dispositivo pode ter uma fonte de relógio externa para
Capacitância mais alta aumenta a estabilidade do oscilador, mas
acionar o pino OSC1 (Figura 14-4). Observação:
FIGURA 14-1: OPERAÇÃO DE CRISTAL pode ser necessário no modo HS, bem como no modo XT, para
evitar cristais de overdriving com especificação de baixo nível de
(OU CERÂMICA drive. Como cada cristal possui suas próprias características, o
10K
14.2.6 OSCILADOR RC
XTAL
Para aplicações onde o tempo preciso não é um
10K requisito, a opção do oscilador RC está disponível. A
operação e a funcionalidade do oscilador RC
C1 C2 dependem de uma série de variáveis. A frequência do
oscilador RC é uma função de:
A Figura 14-3 mostra um circuito oscilador ressonante em série. • Tensão de alimentação
Este circuito também é projetado para usar a frequência • Resistor (REXT) e capacitor (CEXT) valores
fundamental do cristal. O inversor realiza uma mudança de fase • Temperatura de operação.
de 180 em um circuito oscilador ressonante em série. Os
A frequência do oscilador irá variar de unidade para unidade
resistores de 330 k fornecem o feedback negativo para polarizar
devido à variação normal dos parâmetros do processo. A
os inversores em sua região linear.
diferença na capacitância do quadro principal entre os tipos
de pacote também afetará a frequência de oscilação,
FIGURA 14-3: SÉRIE EXTERNA especialmente para baixo CEXT valores. O usuário também
CRISTAL RESSONANTE precisa levar em consideração a tolerância dos componentes
CIRCUITO OSCILADOR R e C externos. A Figura 14-5 mostra como a combinação R /
C está conectada.
O OUTRO
330 K- 330 K- DISPOSITIVOS FIGURA 14-5: MODO OSCILADOR RC
74AS04 74AS04 74AS04
CLKIN VDD
0,1 PF PIC16F627A / 628A / 648A
PIC16F627A /
628A / 648A REXT
RA7 / OSC1 / interno
CLKIN
Relógio
XTAL
CEXT
VWL
14.2.4 PRECISÃO INTERNA 4 MHZ
OSCILADOR FOSC/ 4
RA6 / OSC2 / CLKOUT
O oscilador de precisão interno fornece um relógio de
sistema fixo de 4 MHz (nominal) em VDD = 5 V e 25-C. Ver
O modo RC Oscillator tem duas opções que controlam o pino
Seção 17.0 "Especificações elétricas", para obter
OSC2 não utilizado. O primeiro permite que seja usado como
informações sobre a variação da tensão e da temperatura.
uma porta de E / S de propósito geral. O outro configura o
pino como uma saída fornecendo o sinal Fosc (relógio interno
14.2.5 RELÓGIO EXTERNO
dividido por 4) para fins de teste ou sincronização externa.
Para aplicações onde um relógio já está disponível em outro
lugar, os usuários podem acionar diretamente o
PIC16F627A / 628A / 648A, desde que esta fonte de relógio 14.2.7 CLKOUT
externo atenda aos requisitos de temporização AC / DC
O PIC16F627A / 628A / 648A pode ser configurado para
listados emSeção 17.6 "Diagramas de tempo e
fornecer um sinal de clock out programando a palavra de
especificações". A Figura 14-4 abaixo mostra como um
configuração. A frequência do oscilador, dividida por 4, pode
circuito de relógio externo deve ser configurado.
ser usada para fins de teste ou para sincronizar outra lógica.
Redefinir
VDD subir
detectar
Reinicialização de inicialização
VDD
Apagão
detectar Reset
S Q
BOREN
OST / PWRT
OST
Chip_Reset
Contador de ondulação de 10 bits
R Q
OSC1 /
CLKIN
Alfinete
PWRT
No chip(1)
OSC Contador de ondulação de 10 bits
Habilitar OST
Observação 1: Este é um oscilador separado do oscilador INTOSC / RC.
Timer (PWRT), Oscillator Start-up devido a VDD, temperatura e variação do processo. Consulte a
Tabela 17-7 dos parâmetros DC para obter detalhes.
Timer (OST) e Brown-out Reset
(BOR) 14.4.3 TEMPORIZADOR DE INICIALIZAÇÃO DO OSCILADOR
(OST)
14,4.1 REINICIALIZAÇÃO DE ENERGIA (POR)
O OST fornece um atraso de ciclo do oscilador de 1024 (da
O circuito POR on-chip mantém o chip em Reset até VDD atingiu
entrada OSC1) após o término do atraso PWRT. A execução
um nível alto o suficiente paraoperaríon. Para aproveitar as
do programa não começará até que o tempo limite OST seja
vantagens do POR, basta ligar o pino MCLR através de um resistor
concluído. Isso garante que o oscilador ou ressonador de
a VDD. Isso eliminará os componentes RC externos geralmente
cristal foi iniciado e estabilizado.
necessários para criar a reinicialização na inicialização. Um tempo
máximo de subida para VDD É necessário. Consulte as O tempo limite de OST é invocado apenas para os modos XT, LP e HS e
especificações elétricas para obter detalhes. apenas na reinicialização da inicialização ou despertar do repouso.
Consulte a Tabela 17-7.
O circuito POR não produz um Reset interno quando V
DD declina. 14.4.4 REINICIALIZAÇÃO DE BROWN-OUT (BOR)
Quando o dispositivo inicia a operação normal (sai da condição de
O PIC16F627A / 628A / 648A tem circuitos BOR no chip. Um
reinicialização), os parâmetros operacionais do dispositivo
bit de configuração, BOREN, pode desabilitar (se
(tensão, frequência, temperatura, etc.) devem ser atendidos para
desmarcado / programado) ou habilitar (se habilitado) o
garantir a operação. Se essas condições não forem atendidas, o
circuito de reset do BOR. Se VDD cai abaixo de VBOR por mais
dispositivo deve ser mantido em Reset até que as condições de
de TBOR, a situação de queda de energia reinicializará o chip.
operação sejam atendidas.
Não é garantido que ocorra uma reinicialização se VDD cai
Para obter informações adicionais, consulte a Nota de Aplicação abaixo de VBOR para menor que TBOR. VBOR e TBOR são
AN607, “Resolução de problemas de power-up”. definidos na Tabela 17-2 e Tabela 17-7, respectivamente.
VDD
VBOR
INTERNO <72 ms
REDEFINIR
72 ms
VDD
VBOR
INTERNO
72 ms
REDEFINIR
INTOSC 72 ms - 72 ms - 6-s
0 X 1 1 Reinicialização de inicialização
1 1 0 0 WDT Wake-up
03h, 83h, STATUS IRP RP1 RPO PARA PD Z DC C 0001 1xxx 000q quuu
103h, 183h
Reiniciar MCLR durante a operação normal 000h 000u uuuu ---- 1-uu
VDD
MCLR
INTERNAL POR
Tpwrt
INTERNAL RESET
FIGURE 14-9: TIME OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 2
VDD
MCLR
INTERNAL POR
Tpwrt
INTERNAL RESET
VDD
MCLR
INTERNAL POR
Tpwrt
INTERNAL RESET
Q1
D R MCLR
PIC16F627A/628A/648A
R1 R2 40k PIC16F627A/628A/648A
MCLR
VDD VDD
33k
10k MCLR
40k PIC16F627A/628A/648A
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
(3)
CLKOUT
(4)
INT pin
(1)
(1) (5)
INTF flag Interrupt Latency (2)
(INTCON<1>)
GIE bit
(INTCON<7>)
INSTRUCTION FLOW
Instruction
Fetched Inst (PC) Inst (PC+1) — Inst (0004h) Inst (0005h)
0
M WDT POSTSCALER/
U
Watchdog TMR0 PRESCALER
Timer 1X
8
8 to 1 MUX PS<2:0>
PSA 3
WDT
Enable Bit
To TMR0
(Figure 6-1)
0 1
MUX PSA
WDT
Time out
Note: T0SE, T0CS, PSA, PS0-PS2 are bits in the OPTION register.
2007h Config. LVP BOREN MCLRE FOSC2 PWRTE WDTE FOSC1 FOSC0 uuuu uuuu uuuu uuuu
bits
81h, 181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
Legend: x = unknown, u = unchanged, - = unimplemented read as ‘0’, q = value depends upon condition.
Note: Shaded cells are not used by the Watchdog Timer.
14.8 Power-Down Mode (Sleep) For lowest current consumption in this mode, all I/O
pins should be either at VDD, or VSS, with no external
The Power-down mode is entered by executing a circuitry drawing current from the I/O pin and the
SLEEP instruction. comparators, and VREF should be disabled. I/O pins
If enabled, the Watchdog Timer will be cleared but that are hi-impedance inputs should be pulled high or
keeps running, the PD bit in the Status Register is low externally to avoid switching currents caused by
cleared, the TO bit is set, and the oscillator driver is floating inputs. The T0CKI input should also be at VDD
turned off. The I/O ports maintain the status they had, or VSS for lowest current consumption. The
before SLEEP was executed (driving high, low, or hi- contribution from on chip pull-ups on PORTB should
impedance). be considered.
The MCLR pin must be at a logic high level (VIHMC).
Note: It should be noted that a Reset generated
by a WDT time out does not drive MCLR
pin low.
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
CLKOUT(4) Tost(2)
INT pin
INTF flag
(INTCON<1>) Interrupt Latency
(Note 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 Dummy cycle Dummy cycle
Executed Inst(PC - 1) Sleep Inst(PC + 1) Inst(0004h)
Note 1: XT, HS or LP Oscillator mode assumed. TOST = 1024TOSC (drawing not to scale). Approximately 1 -s
2: delay will be there for RC Osc mode.
3: GIE = ‘1’ assumed. In this case after wake-up, the processor jumps to the interrupt routine. If GIE = ‘0’, execution will continue in-line.
4: CLKOUT is not available in these Osc modes, but shown here for timing reference.
To Normal
Connections
External
Connector PIC16F627A/628A/648A
Signals
+ 5V VDD
0V VSS
VPP RA5/MCLR/VPP
CLK RB6/PGC
VDD
To Normal
Connections
Words: 1
Cycles: 1 Words: 1
Description: Add the contents of the W register Description: AND the W register with register ‘f’. If
with register ‘f’. If ‘d’ is 0 the result is ‘d’ is 0 the result is stored in the W
stored in the W register. If ‘d’ is 1 the register. If ‘d’ is 1 the result is stored
result is stored back in register ‘f’. back in register ‘f’.
Words: 1 Words: 1
Cycles: 1 Cycles: 1
Example ADDWF REG1, 0 Example ANDWF REG1, 1
Before Instruction
REG1 = 0x0A
After Instruction
REG1 = 0x8A
Words: 1 Cycles: 1
Example DECF CNT, 1
Cycles: 1
Before Instruction
Example CLRWDT
CNT = 0x01
Before Instruction Z= 0
WDT counter = ? After Instruction
After Instruction CNT = 0x00
WDT counter = 0x00 Z= 1
WDT prescaler = 0
TO = 1
PD = 1
After Interrupt
PC = TOS
GIE = 1
Cycles: 2
Words: 1
Example CALL TABLE;W contains table
;offset value Cycles: 1
• ;W now has table value Example RLF REG1, 0
•
• Before Instruction
TABLE
ADDWF PC;W = offset REG1=1110 0110
RETLW k1;Begin table C =0
RETLW k2; After Instruction
• REG1=1110 0110
• W = 1100 1100
• C =1
RETLW kn; End of table
Before Instruction
W = 0x07
After Instruction
W = value of k8
After Interrupt
PC = TOS
Cycles: 1 W = 1
C = ?
Example RRF REG1, 0
After Instruction
Before Instruction
REG1 = 1110 0110C W = 1
=0 C = 1; result is positive
After Instruction Example 2: Before Instruction
REG1 = 1110 0110W
W= 2
= 0111 0011
C= ?
C =0
After Instruction
W= 0
SLEEP C= 1; result is zero
Operands: None W= 3
C= ?
Operation: 00h - WDT,
0 - WDT prescaler, 1 After Instruction
- TO, W= 0xFF
0 - PD C= 0; result is negative
Status Affected: TO, PD
Encoding: 00 0000 0110 0011
Description: The power-down Status bit, PDis
cleared. Time out Status bit, TO
is set. Watchdog Timer and its
prescaler are cleared.
The processor is put into Sleep
mode with the oscillator
stopped. See Section 14.8
"Power-Down Mode (Sleep)"for
more details.
Words: 1
Cycles: 1
Example: SLEEP
After Instruction
Description: The instruction is supported for
code compatibility with the
REG1 = 0 PIC16C5X products. Since TRIS
W = 2 registers are readable and
C = 1; result is zero writable, the user can directly
Z = DC = 1 address them.
Example 3: Before Instruction Words: 1
REG1 = 1 Cycles: 1
W = 2 Example
C = ?
To maintain upward compatibility
After Instruction with future PICmicro®products,
REG1 = 0xFF do not use this instruction.
W = 2
C = 0; result is negative
Z = DC = 0
REG1 = 0x1A
W= 0xB5
Note: Voltage spikes below VSS at the MCLR pin, inducing currents greater than 80 mA, may cause latch-up. Thus, a
series resistor of 50-100 - should be used when applying a “low” level to the MCLR pin rather than pulling this
pin directly to VSS.
6.0
5.5
5.0
4.5
VDD
(VOLTS)
4.0
3.5
3.0
2.5
0 4 10 20 25
FREQUENCY (MHz)
Note: The shaded region indicates the permissible combinations of voltage and frequency.
5.5
5.0
4.5
VDD
(VOLTS)
4.0
3.5
3.0
2.5
2.0
0 4 10 20 25
FREQUENCY (MHz)
Note: The shaded region indicates the permissible combinations of voltage and frequency.
Param
Sym Characteristic/Device Min Typ† Max Units Conditions
No.
VDD Supply Voltage
D001 PIC16LF627A/628A/648A 2.0 — 5.5 V
PIC16F627A/628A/648A 3.0 — 5.5 V
D002 VDR RAM Data Retention — 1.5* — V Device in Sleep mode
Voltage(1)
D003 VPOR VDD Start Voltage — VSS — V See Section 14.4 on Power-on
to ensure Power-on Reset Reset for details
D004 SVDD VDD Rise Rate 0.05* — — V/ms See Section 14.4 on Power-on
to ensure Power-on Reset Reset for details
D005 VBOR Brown-out Reset Voltage 3.65 4.0 4.35 V BOREN configuration bit is set
3.65 4.0 4.4 V BOREN configuration bit is set,
Extended
Legend: Rows with standard voltage device data only are shaded for improved readability.
* These parameters are characterized but not tested.
† Data in “Typ” column is at 5.0 V, 25-C, unless otherwise stated. These parameters are for design guidance only and are
not tested.
Note 1: This is the limit to which VDD can be lowered in Sleep mode without losing RAM data.
Param Conditions
Device Characteristics Min† Typ Max Units
No. VDD Note
Supply Voltage (VDD)
D001 — 3.0 — 5.5 V —
Power-down Base Current (IPD)
— 0.1 TBD -A 3.0 WDT, BOR, Comparators, VREF, and
D020E — T1OSC: disabled
— 0.2 TBD -A 5.0
Peripheral Module Current (-IMOD)(1)
— 2 TBD -A 3.0 WDT Current
D021E —
— 9 TBD -A 5.0
— 32 TBD -A 4.5 BOR Current
D022E —
— 33 TBD -A 5.0
— 27 TBD -A 3.0 Comparator Current
D023E —
— 49 TBD -A 5.0
— 50 TBD -A 3.0 VREF Current
D024E —
— 83 TBD -A 5.0
— 1.3 TBD -A 3.0 T1OSC Current
D025E —
— 1.8 TBD -A 5.0
Supply Current (IDD)
— 21 TBD -A 3.0 FOSC = 32 kHz
D010E — LP Oscillator Mode
— 38 TBD -A 5.0
— 220 TBD -A 3.0 FOSC = 1 MHz
D011E — XT Oscillator Mode
— 370 TBD -A 5.0
— 430 TBD -A 3.0 FOSC = 4 MHz
D012E — XT Oscillator Mode
— 780 TBD -A 5.0
— 2.6 TBD mA 4.5 FOSC = 20 MHz
D013E — HS Oscillator Mode
— 3 TBD mA 5.0
Note 1: The “-” current is the additional current consumed when this peripheral is enabled. This current should be added to the base I
DD or IPD measurement. Max values should be used when calculating total current consumption.
Param.
Sym Characteristic/Device Min Typ† Max Unit Conditions
No.
VIL Input Low Voltage
I/O ports
D030 with TTL buffer VSS — 0.8 V VDD = 4.5V to 5.5V
VSS — 0.15 VDD V otherwise
D031 with Schmitt Trigger input(4) VSS — 0.2 VDD V
D032 MCLR, RA4/T0CKI,OSC1 VSS — 0.2 VDD V (Note1)
(in RC mode)
D033 OSC1 (in HS) VSS — 0.3 VDD V
OSC1 (in LP and XT) VSS — 0.8 V
VIH Input High Voltage
I/O ports
D040 with TTL buffer 2.0 V — VDD V VDD = 4.5V to 5.5V
. 25 VDD + 0.8 V — VDD V otherwise
D041 with Schmitt Trigger input(4) 0.8 VDD — VDD V
D042 MCLR RA4/T0CKI 0.8 VDD — VDD V
D043 OSC1 (XT, HS and LP) 0.7 VDD — VDD V
D043A OSC1 (in RC mode) 0.9 VDD — VDD V (Note1)
D070 IPURB PORTB weak pull-up 50 200 400 -A VDD = 5.0V, VPIN = VSS
current
IIL Input Leakage Current(2), (3)
I/O ports (Except PORTA) — — - 1.0 -A VSS - VPIN - VDD, pin at hi-impedance VSS
D060 PORTA(4) — — - 0.5 -A - VPIN - VDD, pin at hi-impedance
D061 RA4/T0CKI — — - 1.0 -A VSS - VPIN - VDD
D063 OSC1, MCLR — — - 5.0 -A VSS - VPIN - VDD, XT, HS and LP osc
configuration
VOL Output Low Voltage
— — 0.6 V IOL=8.5 mA, VDD=4.5 V, -40- to +85-C IOL
D080 I/O ports(4)
— — 0.6 V =7.0 mA, VDD=4.5 V, +85- to +125-C
VOH Output High Voltage(3)
D090 I/O ports (Except RA4(4) VDD-0.7 — — V IOH=-3.0 mA, VDD=4.5 V, -40- to +85-C I
VDD-0.7 — — V OH=-2.5 mA, VDD=4.5 V, +85- to
+ 125-C
D150 VOD Open-Drain High Voltage — — 8.5* V RA4 pin PIC16F627A/628A/648A,
PIC16LF627A/628A/648A
Capacitive Loading Specs on Output Pins
D100* COSC2 OSC2 pin — — 15 pF In XT, HS and LP modes when external
clock used to drive OSC1.
D101* Cio All I/O pins/OSC2 (in RC mode) — — 50 pF
* These parameters are characterized but not tested.
† Data in “Typ” column is at 5.0V, 25-C unless otherwise stated. These parameters are for design guidance only and are not tested.
Note 1: In RC oscillator configuration, the OSC1 pin is a Schmitt Trigger input. It is not recommended that the PIC16F627A/628A/648A be driven with
external clock in RC mode.
2: The leakage current on the MCLR pin is strongly dependent on applied voltage level. The specified levels represent normal operating conditions.
Higher leakage current may be measured at different input voltages.
3: Negative current is defined as coming out of the pin.
4: Includes OSC1 and OSC2 when configured as I/O pins, CLKIN, or CLKOUT.
Parameter
Sym Characteristic Min Typ† Max Units Conditions
No.
Data EEPROM Memory
D120 ED Endurance 100K 1M — E/W - 40-C - TA - 85°C 85°C - TA -
D120A ED Endurance 10K 100K E/W 125°C VMIN = Minimum
D121 VDRW VDD for read/write VMIN — 5.5 V operating voltage
Param
Characteristics Sym Min Typ Max Units Comments
No.
Spec
Characteristics Sym Min Typ Max Units Comments
No.
D310 Resolution VRES — — VDD/24 LSb Low Range (VRR = 1)
VDD/32 LSb High Range (VRR = 0)
D311 Absolute Accuracy VRAA — — 1/4(2)* LSb Low Range (VRR = 1)
— — 1/2(2)* LSb High Range (VRR = 0)
D312 Unit Resistor Value (R) VRUR — 2k* — -
D313 Settling Time(1) TSET — — 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.When VDD is between 2.0V and
2: 3.0V the VREF output voltage levels on RA2 described by the equation:[VDD/2 ± (3-VDD)/2] may cause the Absolute
Accuracy (VRAA) of the VREF output signal on RA2 to be greater than the stated max.
1. TppS2ppS
2. TppS
T
F Frequency T Time
Lowercase subscripts (pp) and their meanings:pp
F Fall P Period
H High R Rise
I Invalid (Hi-impedance) V Valid
L Low Z Hi-Impedance
VDD/2
RL
CL CL
PIN PIN
VSS VSS
RL = 464-
CL = 50 pF for all pins except OSC2
15 pF for OSC2 output
Q4 Q1 Q2 Q3 Q4 Q1
OSC1
1 3 3
4 4
2
CLKOUT
Q4 Q1 Q2 Q3
OSC1
11
10
22
CLKOUT 23
13 12
19 18
14 16
I/O PIN
(INPUT)
17 15
20, 21
FIGURE 17-6: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER AND POWER-UP
TIMER TIMING
VDD
MCLR
30
Internal
POR
33
PWRT
Time out
32
OST
Time out
Internal
RESET
Watchdog
Timer
RESET
31
34 34
I/O Pins
VDD VBOR
35
TABLE 17-7: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER AND POWER-UP
TIMER REQUIREMENTS
Parameter
Sym Characteristic Min Typ† Max Units Conditions
No.
30 TmcL MCLR Pulse Width (low) 2000 — — ns VDD = 5V, -40°C to +85°C
TBD TBD TBD ms Extended temperature
31 Twdt Watchdog Timer Time out Period 7* 18 33* ms VDD = 5V, -40°C to +85°C
(No Prescaler) TBD TBD TBD ms Extended temperature
32 Tost Oscillation Start-up Timer Period — 1024TOSC — — TOSC = OSC1 period
33 Tpwrt Power-up Timer Period 28* 72 132* ms VDD = 5V, -40°C to +85°C
TBD TBD TBD ms Extended temperature
RA4/T0CKI
40 41
42
RB6/T1OSO/T1CKI
45 46
47 48
TMR0 OR
TMR1
RB3/CCP1
(CAPTURE MODE)
50 51
52
RB3/CCP1
53 54
RA4/T0CKI
40 41
42
TMR0
XXXXXXXXXXXXXX PIC16F627A-I/P
XXXXXXXXXXXXXX
YYWWNNN 0210017
XXXXXXXX 16F628A
XXXXXXXX - I/ML
YYWWNNN 0210017
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.
E1
n 1 -
E A2
c L
A1
B1
-
B p
eB
E
p
E1
2
B n 1
h
-
45-
c
A A2
-
- L A1
E1
p
B 2
n 1
c
A A2
L A1
-
Notes:
Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed
. 010” (0.254mm) per side.
JEDEC Equivalent: MO-150
Drawing No. C04-072
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
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?
V
Voltage Reference
Configuration............................................................... 67
Voltage Reference Module.......................................... 67
W
Watchdog Timer (WDT) .................................................... 106
WWW, On-Line Support........................................................ 3
X
XORLW Instruction ........................................................... 124
XORWF Instruction ........................................................... 124
Package P = PDIP
SO = SOIC (Gull Wing, 300 mil body)
SS = SSOP (209 mil)
ML = QFN (28 Lead)
* JW Devices are UV erasable and can be programmed to any device configuration. JW Devices meet the electrical requirement of
each oscillator type.
Please specify which device, revision of silicon and Data Sheet (include Literature #) you are using.
01/26/04
www.datasheetcatalog.com