16 F 506
16 F 506
16 F 506
1.1
PIC16F506
1.0
1.2
PROGRAMMING THE
PIC16F506
Program/Verify Mode
FIGURE 1-1:
Hardware Requirements
PIN DIAGRAMS
14
VSS
RB5/OSC1/CLKIN
13
RB0/ICSPDAT/C1IN+/AN0
RB4/OSC2/CLKOUT
12
RB1/ICSPCLK/C1IN-/AN1
MCLR/VPP/RB3
RC5/T0CKI
RC4/C2OUT
RC3
PIC16F506
VDD
11
RB2/C1OUT/AN2
10
RC0/C2IN+
RC1/C2IN-
RC2/CVREF
RC4/C2OUT
GND
RB0/C1IN+/AN0/ICSPDAT
11
RB1/C1IN-/AN1/ICSPCLK
10
RB2/C1OUT/AN2
9
8
RC0/C2IN+
RC1/C2IN-
RC5/T0CKI
RC3
RB4/OSC2/CLKOUT
RB3/MCLR/VPP
NC
PIC16F506
16 15 14 13
12
1
RC2/CVREF
RB5/OSC1/CLKIN
NC
VDD
DS41258C-page 1
PIC16F506
TABLE 1-1:
Pin Name
Pin Type
RB1
ICSPCLK
RB0
ICSPDAT
I/O
MCLR/VPP/RB3
Program/Verify mode
Pin Description
Clock input Schmitt Trigger input
Data input/output Schmitt Trigger input
(1)
VDD
VDD
Power Supply
VSS
VSS
Ground
DS41258C-page 2
PIC16F506
2.1
2.2
User ID Locations
2.3
Configuration Word
2.4
2.5
FIGURE 2-1:
User Memory
Space
MEMORY MAPPING
PIC16F506 PROGRAM
MEMORY MAP
000h
On-chip User
Program
Memory (Page 0)
1FFh
200h
On-chip User
Program
Memory (Page 1)
Reset Vector
Config Memory
Space
2.0
User ID Locations
Backup OSCCAL Value
3FEh
3FFh
400h
403h
404h
405h
Reserved
43Fh
440h
Unimplemented
Configuration Word
7FEh
7FFh
DS41258C-page 3
PIC16F506
3.0
COMMANDS AND
ALGORITHMS
3.1
Program/Verify Mode
3.1.2
3.1.1
PROGRAMMING
FIGURE 3-1:
Note:
The first and last clock pulses during the data segment
correspond to the Start and Stop bits, respectively.
Input data is a dont care during the Start and Stop
cycles. The 14 clock pulses between the Start and Stop
cycles, clock the 14 bits of input/output data. Data is
transferred LSb first.
ENTERING HIGH
VOLTAGE PROGRAM/
VERIFY MODE
TPPDP
SERIAL PROGRAM/VERIFY
OPERATION
THLD0
VPP
VDD
ICSPDAT
ICSPCLK
TABLE 3-1:
Data
0, data (14), 0
0, data (14), 0
Increment Address
Begin Programming
End Programming
DS41258C-page 4
Externally Timed
Internally Timed
PIC16F506
3.1.2.1
FIGURE 3-2:
0
0
TSET1
THLD1
TDLY2
ICSPCLK
0
ICSPDAT
3.1.2.2
strt_bit LSb
16
15
MSb stp_bit
TSET1
-+THLD1
TDLY1
FIGURE 3-3:
ICSPCLK
ICSPDAT
15
16
TDLY3
1 0
strt_bit
TDLY1
TSET1
MSb stp_bit
LSb
THLD1
Input
Output
Input
DS41258C-page 5
PIC16F506
3.1.2.3
Increment Address
FIGURE 3-4:
Next Command
1
ICSPCLK
ICSPDAT
TSET1
THLD1
3.1.2.4
FIGURE 3-5:
ICSPCLK
ICSPDAT
TSET1
DS41258C-page 6
THLD1
PIC16F506
3.1.2.5
End Programming
FIGURE 3-6:
TDIS
1
Next Command
1
ICSPCLK
ICSPDAT
TSET1
3.1.2.6
THLD1
Note:
1.
Note:
2.
3.
4.
5.
6.
7.
2.
3.
4.
5.
6.
DS41258C-page 7
PIC16F506
TABLE 3-2:
PC =
Program Memory
Reset Vector
Configuration
Word
User ID
Backup
OSCCAL
Configuration Word or
Program Memory Space
FIGURE 3-7:
Next Command
1
ICSPCLK
ICSPDAT
TSET1
THLD1
DS41258C-page 8
PIC16F506
FIGURE 3-8:
Enter Programming
Mode
Increment
Address
No
PC = 0x3FF?
Yes
Read Calibration
Bits and Save in
Computer/Programmer
Temp. Memory
Increment
Address
No
PC = 0x404?
Yes
Exit Programming
Mode
Done
DS41258C-page 9
PIC16F506
FIGURE 3-9:
Enter Programming
Mode
Increment
Address
No
PC = 0x3FF?
Yes
Read Calibration
Bits from
Computer/Programmer
Temp. Memory
Increment
Address
No
PC = 0x404?
Yes
Read Backup OSCCAL
Calibration Bits from
Computer/Programmer
Temp. Memory
Done
DS41258C-page 10
PIC16F506
FIGURE 3-10:
Enter Programming
Mode
PC = 0x7FF
(Config Word)
Increment
Address
Bulk Erase
Device
PROGRAM CYCLE
Load Data
for
Program Memory
One Word
Program Cycle
Begin
Programming
Command
(Externally timed)
Read Data
from
Program Memory
Data Correct?
No
Yes
Increment
Address
Command
No
All Programming
Locations
Done?
Report
Programming
Failure
Wait TPROG
End
Programming
Wait TDIS
Yes
Exit Programming
Mode
Done
DS41258C-page 11
PIC16F506
FIGURE 3-11:
One-Word
Programming
Cycle
(see Figure 3-10)
Read Data
Command
Data
Correct?
No
Report
Programming
Failure
Yes
Increment
Address
Command
No
Address =
0x400?
Yes
Load Data
Command
One-Word
Programming
Cycle
(see Figure 3-10)
Read Data
Command
Data
Correct?
No
Report
Programming
Failure
Yes
Increment
Address
Command
No
Address =
0x404?
Yes
Exit Programming
Mode
Done
DS41258C-page 12
PIC16F506
FIGURE 3-12:
Enter
Program/Verify mode
PC = 0x7FF
(Config Word)
Wait TERA
Exit Programming
Mode
Done
DS41258C-page 13
PIC16F506
FIGURE 3-13:
Start
Enter
Program/Verify mode
PC = 0x7FF
(Config Word)
Increment
PC
No
PC = 0x400?
(First User ID)
Yes
Bulk Erase
Device
Wait TERA
Restore
OSCCAL bits
(Figure 3-9)
Exit Programming
Mode
Done
DS41258C-page 14
PIC16F506
4.0
CONFIGURATION WORD
REGISTER 4-1:
IOSCFS MCLRE
CP
WDTE
FOSC2
FOSC1
bit 11
FOSC0
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 11-7
Unimplemented: Read as 1
bit 6
bit 5
bit 4
bit 3
bit 2-0
x = Bit is unknown
DS41258C-page 15
PIC16F506
5.0
CODE PROTECTION
5.3
Checksum Computation
5.3.1
5.1
c)
5.2
Note:
Program
Memory
CHECKSUM
The
checksum
calculation
differs
depending on the code-protect setting.
The Configuration Word and ID locations
can always be read regardless of the
code-protect settings.
DS41258C-page 16
PIC16F506
TABLE 5-1:
Device
PIC16F506
Checksum*
Blank
Value
0x723 at 0
and Max
Address
OFF
0xEC80
0xDAC8
ON
0xECAF
0xD21B
DS41258C-page 17
PIC16F506
6.0
TABLE 6-1:
AC/DC CHARACTERISTICS
Sym.
Characteristics
Typ.
Max.
Units
4.5
5.5
VDDERA
4.5
5.5
IDDPROG
0.5
mA
IDDERA
0.5
mA
VPP
12.5
13.5
IPP
0.45
mA
TVHHR
1.0
TPPDP
VIH1
0.8 VDD
VIL1
0.2 VDD
TSET0
100
ns
THLD0
Conditions/
Comments
General
Serial Program/Verify
TSET1
100
ns
THLD1
100
ns
TDLY1
1.0
TDLY2
1.0
TDLY3
80
ns
TERA
10(1)
ms
TPROG
2(1)
ms
TDIS
100
TRESET
10
ms
Note 1:
Minimum time to ensure that function completes successfully over voltage, temperature and device
variations.
DS41258C-page 18
PIC16F506
REVISION HISTORY
Revision C (02/2010)
Revised Section 1.1; Added QFN pin diagram; Revised
Note 1, Table 1-1; Revised Section 3.1, 1st para;
Added Revision History.
DS41258C-page 19
PIC16F506
NOTES:
DS41258C-page 20
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 Microchips 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, dsPIC,
KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART,
PIC32 logo, rfPIC and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified
logo, MPLIB, MPLINK, mTouch, Octopus, Omniscient Code
Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit,
PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance,
TSHARC, UniWinDriver, WiperLock and ZENA are
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
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.
2010, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 978-1-60932-034-8
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Companys quality system processes and procedures
are for its PIC MCUs and dsPIC DSCs, KEELOQ code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchips quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS41258C-page 21
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
01/05/10
DS41258C-page 22