Beruflich Dokumente
Kultur Dokumente
PIC16F627A
PIC16F628A
PIC16F648A
PIC16LF627A
PIC16LF628A
PIC16LF648A
Note:
PROGRAMMING THE
PIC16F627A/628A/648A
1.1
Hardware Requirements
The PIC16F627A/628A/648A requires one programmable power supply for VDD (2.0V to 5.5V) and a VPP
of 12V to 14V, or VPP of 4.5V to 5.5V, when using low
voltage. Both supplies should have a minimum
resolution of 0.25V.
1.2
Programming Mode
FIGURE 1-1:
PIN DIAGRAM
PDIP, SOIC
SSOP
RA4/T0CKI/CMP2
RA5/MCLR/VPP
VSS
RB0/INT
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
18
RA1/AN1
RA2/AN2/VREF
17
RA0/AN0
RA3/AN3/CMP1
16
RA7/OSC1/CLKIN
15
RA6/OSC2/CLKOUT
RA4/T0CKI/CMP2
RA5/MCLR/VPP
14
VDD
VSS
13
RB7/DATA/T1OSI
12
RB6/CLOCK/T1OSO/T1CKI
11
RB5
10
RB4/PGM
VSS
RB0/INT
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
10
Preliminary
PIC16F627A/628A/648A
RA3/AN3/CMP1
PIC16F627A/628A/648A
RA2/AN2/VREF
20
RA1/AN1
19
RA0/AN0
18
RA7/OSC1/CLKIN
17
16
RA6/OSC2/CLKOUT
VDD
15
VDD
14
RB7/DATA/T1OSI
13
RB6/CLOCK/T1OSO/T1CKI
12
RB5
11
RB4/PGM
DS41196E-page 1
PIC16F627A/628A/648A
28-PIN QFN PIC16F627A/628A/648A DIAGRAM
NC
28
27
26
25
24
23
22
NC
RA1/AN1
RA0/AN0
RA4/T0CKI/CMP2
RA3/AN3/CMP1
RA2/AN2/VREF
FIGURE 1-2:
1
NC 2
VSS
3
NC 4 PIC16F627A/628A/
VSS
5 648A
NC 6
7
RB0/INT
21
20
19
18
17
16
15
RA7/OSC1/CLKIN
RA6/OSC2/CLKOUT
VDD
NC
VDD
RB7/DATA/T1OSI
RB6/CLOCK/T1OSO/T1CKI
TABLE 1-1:
NC
RB4/PGM
RB5
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
NC
8
9
10
11
12
13
14
RA5/MCLR/VPP
Pin Name
Function
Pin Type
Pin Description
RB4
PGM
RB6
CLOCK
Clock input
RB7
DATA
I/O
Data input/output
Programming Mode
P(1)
VDD
VDD
Power Supply
VSS
VSS
Ground
MCLR/VPP
DS41196E-page 2
Preliminary
PIC16F627A/628A/648A
2.0
PROGRAM DETAILS
2.3
2.1
2.2
EE Data Memory
TABLE 2-1:
EE DATA CAPACITY
EE Data
Memory
Device
PC Bits
Decoded
PIC16F627A/628A
128
PIC16F648A
256
TABLE 2-2:
Device
PROGRAM FLASH
Program FLASH
PIC16F627A
1K
PIC16F628A
2K
PIC16F648A
4K
User ID Locations
Preliminary
DS41196E-page 3
PIC16F627A/628A/648A
FIGURE 2-1:
2 KW
4 KW
Implemented
Implemented
0x3FF
Implemented
0x7FF
0xFFF
User ID Location
Implemented
Implemented
Implemented
2008
User ID Location
User ID Location
Reserved
Not Implemented
Reserved
Device ID
2007
Configuration Word
DS41196E-page 4
1FFF
2000
3FFF
Preliminary
PIC16F627A/628A/648A
2.4
Program/Verify Mode
TABLE 2-3:
Load Configuration
Data
0
0, data (14), 0
0, data (14), 0
Increment Address
0, data (14), 0
Preliminary
DS41196E-page 5
PIC16F627A/628A/648A
The optional 16-bit data word will either be an input to,
or an output from the PICmicro microcontroller,
depending on the command. Load Data commands will
be input, and Read Data commands will be output. The
16-bit data word only contains 14 bits of data to
conform to the 14-bit program memory word. The 14
bits are centered within the 16-bit word, padded with a
leading and trailing zero.
Program/Verify mode may be entered via one of two
methods. High voltage Program/Verify is entered by
holding CLOCK and DATA pins low while raising MCLR
first, then VDD as shown in Figure 2-2. Low voltage
Program/Verify mode is entered by raising VDD, then
MCLR and PGM, as shown in Figure 2-3. The PC will
be set to 0 upon entering into Program/Verify mode.
The PC can be changed by the execution of either an
increment PC command, or a Load Configuration
command, which sets the PC to 0x2000.
FIGURE 2-3:
VDD
PGM
MCLR
DATA
CLOCK
Note:
FIGURE 2-2:
ENTERING LOW
VOLTAGE PROGRAM/
VERIFY MODE
ENTERING HIGH
VOLTAGE PROGRAM/
VERIFY MODE
Tppdp
Thld0
MCLR
VDD
LVP
DATA
CLOCK
Note:
DS41196E-page 6
Preliminary
PIC16F627A/628A/648A
2.4.1
FIGURE 2-4:
15
16
RB6
(CLOCK)
0
RB7
(DATA)
strt_bit LSb
TSET1
stp_bit
MSb
THLD1
2.4.2
FIGURE 2-5:
15
16
RB6
(CLOCK)
RB7
(DATA)
TSET1
strt_bit LSb
MSb
stp_bit
THLD1
Preliminary
DS41196E-page 7
PIC16F627A/628A/648A
2.4.3
FIGURE 2-6:
LOAD CONFIGURATION
TDLY2
1
15
16
RB6
(CLOCK)
0
RB7
(DATA)
2.4.4
strt_bit LSb
MSb
stp_bit
FIGURE 2-7:
RB6
(CLOCK)
RB7
(DATA)
TSET1
THLD1
}
}
DS41196E-page 8
Preliminary
PIC16F627A/628A/648A
2.4.5
INCREMENT ADDRESS
FIGURE 2-8:
RB6
(CLOCK)
RB7
(DATA)
Next Command
1
TSET1
TDLY1
THLD1
}
}
2.4.6
FIGURE 2-9:
RB6
(CLOCK)
RB7
(DATA)
15
16
TDLY3
0
strt_bit
TDLY1
TSET1
stp_bit
LSb
MSb
THLD1
RB7 = input
RB7 = output
Preliminary
RB7
input
DS41196E-page 9
PIC16F627A/628A/648A
2.4.7
FIGURE 2-10:
RB6
(CLOCK)
15
16
TDLY3
RB7
(DATA) Tset1
strt_bit
TDLY1
stp_bit
MSb
LSb
THLD1
}
RB7 = output
RB7 = input
DS41196E-page 10
Preliminary
RB7
input
PIC16F627A/628A/648A
3.0
COMMON PROGRAMMING
TASKS
3.1
Note:
FIGURE 3-1:
RB6
(CLOCK)
RB7
(DATA)
TABLE 3-1:
ACTION
Serial & Parallel Operation
Result
CP
ON=0
OFF=1
CPD
ON=0
OFF=1
PC=
Config
Mem
Program
Memory
Data EE
Memory
Config
Word
User ID
location
OFF
Unaffected
Erased
Unaffected
Unaffected
ON
Unaffected
Erased
Unaffected
Unaffected
ON
YES
Erased
Erased
Erased
Erased
OFF
YES
Erased
Unaffected
Erased
Erased
ON
NO
Erased
Erased
Erased
Unaffected
OFF
NO
Erased
Unaffected
Erased
Unaffected
Preliminary
Comment
CPD=ON
DS41196E-page 11
PIC16F627A/628A/648A
3.2
Note:
1.
2.
FIGURE 3-2:
RB6
(CLOCK)
TDLY3
RB7
(DATA)
TSET1
THLD1
}
}
DS41196E-page 12
Preliminary
PIC16F627A/628A/648A
3.3
FIGURE 3-3:
Start
High Voltage
Programming
Program Cycle
PROGRAM CYCLE
Load Data
for
Program Memory
Command
Read Data
from Program
Memory
Data Correct?
No
Report
Programming
Failure
Begin
Programming
Command
Yes
Increment
Address
Command
No
All Locations
Done?
Wait TPROG
Yes
Verify all
Locations
Report Verify
Error @
VDDNOM
No
Data Correct?
Yes
Done
Preliminary
DS41196E-page 13
PIC16F627A/628A/648A
FIGURE 3-4:
Start
Load
Configuration
Data
No
Program ID
Location?
Yes
Report
Programming
Failure
Increment
Address
Command
Read Data
Command
Program Cycle
No
Data Correct?
Yes
No
Address =
0x2004?
Yes
Increment
Address
Command
Increment
Address
Command
Increment
Address
Command
Report Program
Configuration
Word Error
No
Program
Cycle
(Config. Word)
Set VDD =
VDDNOM
Data Correct?
Read Data
Command
Yes
Done
DS41196E-page 14
Preliminary
PIC16F627A/628A/648A
3.4
FIGURE 3-5:
Start
PROGRAM CYCLE
Program Cycle
Load Data
for Data
Memory
Command
Read Data
from
Data Memory
Data Correct?
Begin
Programming
Command
No
Report
Programming
Failure
Wait TDPROG
Yes
Increment
Address
Command
No
All Locations
Done?
Yes
Data Correct?
No Report Verify
Error
Yes
Done
Preliminary
DS41196E-page 15
PIC16F627A/628A/648A
3.5
FIGURE 3-6:
Start
Low Voltage
Programming
Increment
Address
Command
No
Address
= Start
Address?
Yes
PROGRAM CYCLE
Load Data
for Program
Memory
Command
Program Cycle
Begin
Programming
Command
Read Data
from Program
Memory
Data Correct?
No
Report
Programming
Failure
Wait TPROG
Yes
Increment
Address
Command
No
All Locations
Done?
Yes
Verify all
Locations @
VDDNOM
Done
DS41196E-page 16
Preliminary
PIC16F627A/628A/648A
3.6
TABLE 3-2:
Configuration Word
Device ID Value
The PIC16F627A/628A/648A has several configuration bits. These bits can be set (reads 0) or left
unchanged (reads 1), to select various device
configurations.
3.7
DEVICE ID VALUES
Device
Dev
Device ID Word
Rev
PIC16F627A
01 0000 010
x xxxx
PIC16F628A
01 0000 011
x xxxx
PIC16F648A
01 0001 000
x xxxx
REGISTER 3-1:
R/P-1
U-1
U-1
U-1
U-1
R/P-1
R/P-1
CP
CPD
LVP
R/P-1
R/P-1
R/P-1
R/P-1
R/P-1
PWRTE
WDTE
R/P-1
bit 13
bit 0
bit 13
bit 12-9
Unimplemented: Read as 1
bit 8
bit 7
bit 6
bit 5
bit 3
bit 2
bit 4, 1-0
Note
R/P-1
FOSC1 FOSC0
1:
2:
3:
Enabling Brown-out Reset does not automatically enable the Power-up Timer (PWRT).
Only a Bulk Erase will reset the configuration word, including the CP bits.
While MCLR is asserted in INTOSC mode, the internal clock oscillator is disabled.
Legend:
R = Readable bit
W = Writable bit
P = Programmable
- n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
Preliminary
DS41196E-page 17
PIC16F627A/628A/648A
3.8
To allow portability of code, the programmer is required to read the configuration word and ID locations from the hex
file when loading the hex file. If configuration word information was not present in the hex file, then a simple warning
message may be issued. Similarly, while saving a hex file, configuration word and ID information must be included.
An option to not include this information may be provided.
Specifically for the PIC16F627A/628A/648A, the EEPROM data memory should also be embedded in the hex file
(see Section 3.9 Embedding Data EEPROM Contents in Hex File).
Microchip Technology Inc. feels strongly that this feature is important for the benefit of the end customer.
DS41196E-page 18
Preliminary
PIC16F627A/628A/648A
3.9
3.10
Note:
Checksum Computation
3.10.1
CHECKSUM
TABLE 3-3:
The checksum calculation differs depending on the code protect setting. Since the
program memory locations read out differently depending on the code protect
setting, the table describes how to
manipulate the actual program memory
values to simulate the values that would
be read from a protected device. When
calculating a checksum, by reading a
device, the entire program memory can
simply be read and summed. The
configuration word and ID locations can
always be read.
CHECKSUM COMPUTATION
0x25E6 at 0
and Max
Address
Device
Code
Protect
PIC16F627A
OFF
1DFF
E9CD
ON
1FFE
EBCC
PIC16F628A
PIC16F648A
Checksum*
Blank
Value
OFF
19FF
E5CD
ON
1BFE
E7CC
OFF
11FF
DDCD
ON
13FE
DFCC
Preliminary
DS41196E-page 19
PIC16F627A/628A/648A
4.0
PROGRAM/VERIFY MODE
ELECTRICAL
CHARACTERISTICS
TABLE 4-1:
AC/DC Characteristics
Characteristics
Min
Typ
Max
Units
VDD
2.0
5.5
VDD
2.0
5.5
VDD
4.5
5.5
VIHH
10.0
13.5
TVHHR
1.0
TPPDP
Conditions/
Comments
General
VDD
TLVPP
VIH1
0.8 VDD
Schmitt Trigger
input
VIL1
0.2 VDD
Schmitt Trigger
input
TSET0
100
ns
THLD0
TSET1
100
ns
THLD1
100
ns
TDLY1
1.0
TDLY2
1.0
TDLY3
80
ns
TPROG
2.5
ms
TDPROG
ms
TERA
ms
Serial Program/Verify
DS41196E-page 20
Preliminary
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
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 microchips 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.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, KEELOQ, MPLAB, PIC, PICmicro, PICSTART,
PRO MATE and PowerSmart are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
AmpLab, FilterLab, microID, MXDEV, MXLAB, PICMASTER,
SEEVAL, SmartShunt and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
Application Maestro, dsPICDEM, dsPICDEM.net,
dsPICworks, ECAN, ECONOMONITOR, FanSense,
FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP,
ICEPIC, microPort, Migratable Memory, MPASM, MPLIB,
MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICtail,
PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB, rfPIC,
Select Mode, SmartSensor, SmartTel and Total Endurance
are trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
Serialized Quick Turn Programming (SQTP) is a service mark
of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
2003, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Preliminary
DS41196E-page 21
ASIA/PACIFIC
Korea
Corporate Office
Australia
Atlanta
Unit 706B
Wan Tai Bei Hai Bldg.
No. 6 Chaoyangmen Bei Str.
Beijing, 100027, China
Tel: 86-10-85282100
Fax: 86-10-85282104
Boston
2 Lan Drive, Suite 120
Westford, MA 01886
Tel: 978-692-3848
Fax: 978-692-3821
Chicago
333 Pierce Road, Suite 180
Itasca, IL 60143
Tel: 630-285-0071
Fax: 630-285-0075
Dallas
4570 Westgrove Drive, Suite 160
Addison, TX 75001
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Tri-Atria Office Building
32255 Northwestern Highway, Suite 190
Farmington Hills, MI 48334
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
2767 S. Albright Road
Kokomo, IN 46902
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
China - Beijing
China - Chengdu
Rm. 2401-2402, 24th Floor,
Ming Xing Financial Tower
No. 88 TIDU Street
Chengdu 610016, China
Tel: 86-28-86766200
Fax: 86-28-86766599
China - Fuzhou
Unit 28F, World Trade Plaza
No. 71 Wusi Road
Fuzhou 350001, China
Tel: 86-591-7503506
Fax: 86-591-7503521
China - Shanghai
Room 701, Bldg. B
Far East International Plaza
No. 317 Xian Xia Road
Shanghai, 200051
Tel: 86-21-6275-5700
Fax: 86-21-6275-5060
China - Shenzhen
Phoenix
China - Shunde
San Jose
China - Qingdao
Toronto
6285 Northam Drive, Suite 108
Mississauga, Ontario L4V 1X5, Canada
Tel: 905-673-0699
Fax: 905-673-6509
India
Divyasree Chambers
1 Floor, Wing A (A3/A4)
No. 11, OShaugnessey Road
Bangalore, 560 025, India
Tel: 91-80-2290061 Fax: 91-80-2290062
Japan
Benex S-1 6F
3-18-20, Shinyokohama
Kohoku-Ku, Yokohama-shi
Kanagawa, 222-0033, Japan
Tel: 81-45-471- 6166 Fax: 81-45-471-6122
DS41196E-page 22
Preliminary
Singapore
200 Middle Road
#07-02 Prime Centre
Singapore, 188980
Tel: 65-6334-8870 Fax: 65-6334-8850
Taiwan
Kaohsiung Branch
30F - 1 No. 8
Min Chuan 2nd Road
Kaohsiung 806, Taiwan
Tel: 886-7-536-4818
Fax: 886-7-536-4803
Taiwan
Taiwan Branch
11F-3, No. 207
Tung Hua North Road
Taipei, 105, Taiwan
Tel: 886-2-2717-7175 Fax: 886-2-2545-0139
EUROPE
Austria
Durisolstrasse 2
A-4600 Wels
Austria
Tel: 43-7242-2244-399
Fax: 43-7242-2244-393
Denmark
Regus Business Centre
Lautrup hoj 1-3
Ballerup DK-2750 Denmark
Tel: 45-4420-9895 Fax: 45-4420-9910
France
Parc dActivite du Moulin de Massy
43 Rue du Saule Trapu
Batiment A - ler Etage
91300 Massy, France
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Germany
Steinheilstrasse 10
D-85737 Ismaning, Germany
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Italy
Via Quasimodo, 12
20025 Legnano (MI)
Milan, Italy
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands
P. A. De Biesbosch 14
NL-5152 SC Drunen, Netherlands
Tel: 31-416-690399
Fax: 31-416-690340
United Kingdom
505 Eskdale Road
Winnersh Triangle
Wokingham
Berkshire, England RG41 5TU
Tel: 44-118-921-5869
Fax: 44-118-921-5820
11/24/03