12F508
12F508
DS41236E
PIC12F508/509/16F505
Data Sheet
8/14-Pin, 8-Bit Flash Microcontrollers
DS41236E-page 2 2009 Microchip Technology Inc.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyers risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART,
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, PIC
32
logo, 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.
2009, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
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.
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.
2009 Microchip Technology Inc. DS41236E-page 3
PIC12F508/509/16F505
Devices Included In This Data Sheet:
High-Performance RISC CPU:
Only 33 Single-Word Instructions to Learn
All Single-Cycle Instructions Except for Program
Branches, which are Two-Cycle
12-Bit Wide Instructions
2-Level Deep Hardware Stack
Direct, Indirect and Relative Addressing modes
for Data and Instructions
8-Bit Wide Data Path
8 Special Function Hardware Registers
Operating Speed:
- DC 20 MHz clock input (PIC16F505 only)
- DC 200 ns instruction cycle (PIC16F505
only)
- DC 4 MHz clock input
- DC 1000 ns instruction cycle
Special Microcontroller Features:
4 MHz Precision Internal Oscillator:
- Factory calibrated to 1%
In-Circuit Serial Programming (ICSP)
In-Circuit Debugging (ICD) Support
Power-On Reset (POR)
Device Reset Timer (DRT)
Watchdog Timer (WDT) with Dedicated On-Chip
RC Oscillator for Reliable Operation
Programmable Code Protection
Multiplexed MCLR Input Pin
Internal Weak Pull-Ups on I/O Pins
Power-Saving Sleep mode
Wake-Wp from Sleep on Pin Change
Selectable Oscillator Options:
- INTRC: 4 MHz precision Internal oscillator
- EXTRC: External low-cost RC oscillator
- XT: Standard crystal/resonator
- HS: High-speed crystal/resonator
(PIC16F505 only)
- LP: Power-saving, low-frequency crystal
- EC: High-speed external clock input
(PIC16F505 only)
Low-Power Features/CMOS Technology:
Operating Current:
- < 175 A @ 2V, 4 MHz, typical
Standby Current:
- 100 nA @ 2V, typical
Low-Power, High-Speed Flash Technology:
- 100,000 Flash endurance
- > 40 year retention
Fully Static Design
Wide Operating Voltage Range: 2.0V to 5.5V
Wide Temperature Range:
- Industrial: -40C to +85C
- Extended: -40C to +125C
Peripheral Features (PIC12F508/509):
6 I/O Pins:
- 5 I/O pins with individual direction control
- 1 input only pin
- High current sink/source for direct LED drive
- Wake-on-change
- Weak pull-ups
8-Bit Real-Time Clock/Counter (TMR0) with 8-Bit
Programmable Prescaler
Peripheral Features (PIC16F505):
12 I/O Pins:
- 11 I/O pins with individual direction control
- 1 input only pin
- High current sink/source for direct LED drive
- Wake-on-change
- Weak pull-ups
8-Bit Real-Time Clock/Counter (TMR0) with 8-Bit
Programmable Prescaler
PIC12F508 PIC12F509 PIC16F505
8/14-Pin, 8-Bit Flash Microcontrollers
PIC12F508/509/16F505
DS41236E-page 4 2009 Microchip Technology Inc.
Pin Diagrams
PIC16F505 16-Pin Diagram (QFN)
PDIP, SOIC, TSSOP
VDD
RB5/OSC1/CLKIN
RB4/OSC2/CLKOUT
RB3/MCLR/VPP
1
2
3
4
VSS
RB0/ICSPDAT
14
13
12
11
P
I
C
1
6
F
5
0
5
5
6
7
10
9
8
RC5/T0CKI
RC4
RC3
RB1/ICSPCLK
RB2
RC0
RC1
RC2
PDIP, SOIC, MSOP
VDD
GP5/OSC1/CLKIN
GP4/OSC2
GP3/MCLR/VPP
1
2
3
4
VSS
GP0/ICSPDAT
8
7
6
5
P
I
C
1
2
F
5
0
8
/
5
0
9
GP1/ICSPCLK
GP2/T0CKI
DFN
P
I
C
1
2
F
5
0
8
/
5
0
9
1
2
3
4
8
7
6
5
VSS
GP0/ICSPDAT
GP1/ICSPCLK
GP2/T0CKI
VDD
GP5/OSC1/CLKIN
GP4/OSC2
GP3/MCLR/VPP
1
2
3
4 9
10
11
12
5 6 7 8
1
6
1
5
1
4
1
3
PIC16F505
RB5/OSC1/CLKIN
RB4/OSC2/CLKOUT
RB3/MCLR/VPP
RC5/TOCKI
V
D
D
N
C
N
C
V
S
S
RB0/ICSPDAT
RB1/ICSPCLK
RB2
RC0
R
C
4
R
C
3
R
C
2
R
C
1
2009 Microchip Technology Inc. DS41236E-page 5
PIC12F508/509/16F505
Device
Program Memory Data Memory
I/O
Timers
8-bit
Flash (words) SRAM (bytes)
PIC12F508 512 25 6 1
PIC12F509 1024 41 6 1
PIC16F505 1024 72 12 1
PIC12F508/509/16F505
DS41236E-page 6 2009 Microchip Technology Inc.
Table of Contents
1.0 General Description...................................................................................................................................................................... 7
2.0 PIC12F508/509/16F505 Device Varieties ................................................................................................................................... 9
3.0 Architectural Overview ............................................................................................................................................................... 11
4.0 Memory Organization................................................................................................................................................................. 17
5.0 I/O Port ....................................................................................................................................................................................... 31
6.0 Timer0 Module and TMR0 Register ........................................................................................................................................... 35
7.0 Special Features Of The CPU.................................................................................................................................................... 41
8.0 Instruction Set Summary ............................................................................................................................................................ 57
9.0 Development Support................................................................................................................................................................. 65
10.0 Electrical Characteristics ............................................................................................................................................................ 69
11.0 DC and AC Characteristics Graphs and Charts ......................................................................................................................... 81
12.0 Packaging Information................................................................................................................................................................ 91
Index .................................................................................................................................................................................................. 105
The Microchip Web Site..................................................................................................................................................................... 107
Customer Change Notification Service .............................................................................................................................................. 107
Customer Support .............................................................................................................................................................................. 107
Reader Response .............................................................................................................................................................................. 108
Product Identification System............................................................................................................................................................. 109
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your
Microchip products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be
refined and enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at [email protected] or fax the Reader Response Form in the back of this data sheet to (480) 792-4150.
We welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
Microchips Worldwide Web site; http://www.microchip.com
Your local Microchip sales office (see last page)
The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (include
literature number) you are using.
Customer Notification System
Register on our web site at www.microchip.com/cn to receive the most current information on all of our products.
2009 Microchip Technology Inc. DS41236E-page 7
PIC12F508/509/16F505
1.0 GENERAL DESCRIPTION
The PIC12F508/509/16F505 devices from Microchip
Technology are low-cost, high-performance, 8-bit,
fully-static, Flash-based CMOS microcontrollers. They
employ a RISC architecture with only 33 single-word/
single-cycle instructions. All instructions are single
cycle (200 s) except for program branches, which
take two cycles. The PIC12F508/509/16F505 devices
deliver performance an order of magnitude higher than
their competitors in the same price category. The 12-bit
wide instructions are highly symmetrical, resulting in a
typical 2:1 code compression over other 8-bit
microcontrollers in its class. The easy to use and easy
to remember instruction set reduces development time
significantly.
The PIC12F508/509/16F505 products are equipped
with special features that reduce system cost and
power requirements. The Power-on Reset (POR) and
Device Reset Timer (DRT) eliminate the need for exter-
nal Reset circuitry. There are four oscillator configura-
tions to choose from (six on the PIC16F505), including
INTRC Internal Oscillator mode and the power-saving
LP (Low-Power) Oscillator mode. Power-Saving Sleep
mode, Watchdog Timer and code protection features
improve system cost, power and reliability.
The PIC12F508/509/16F505 devices are available in
the cost-effective Flash programmable version, which
is suitable for production in any volume. The customer
can take full advantage of Microchips price leadership
in Flash programmable microcontrollers, while
benefiting from the Flash programmable flexibility.
The PIC12F508/509/16F505 products are supported
by a full-featured macro assembler, a software simula-
tor, an in-circuit emulator, a C compiler, a low-cost
development programmer and a full featured program-
mer. All the tools are supported on IBM
PC and
compatible machines.
1.1 Applications
The PIC12F508/509/16F505 devices fit in applications
ranging from personal care appliances and security
systems to low-power remote transmitters/receivers.
The Flash technology makes customizing application
programs (transmitter codes, appliance settings,
receiver frequencies, etc.) extremely fast and conve-
nient. The small footprint packages, for through hole or
surface mounting, make these microcontrollers perfect
for applications with space limitations. Low cost, low
power, high performance, ease-of-use and I/O flexibil-
ity make the PIC12F508/509/16F505 devices very ver-
satile even in areas where no microcontroller use has
been considered before (e.g., timer functions, logic and
PLDs in larger systems and coprocessor applications).
TABLE 1-1: PIC12F508/509/16F505 DEVICES
PIC12F508 PIC12F509 PIC16F505
Clock Maximum Frequency of Operation (MHz) 4 4 20
Memory Flash Program Memory (words) 512 1024 1024
Data Memory (bytes) 25 41 72
Peripherals Timer Module(s) TMR0 TMR0 TMR0
Wake-up from Sleep on Pin Change Yes Yes Yes
Features I/O Pins 5 5 11
Input Pins 1 1 1
Internal Pull-ups Yes Yes Yes
In-Circuit Serial Programming Yes Yes Yes
Number of Instructions 33 33 33
Packages 8-pin PDIP, SOIC,
MSOP, DFN
8-pin PDIP, SOIC,
MSOP, DFN
14-pin PDIP, SOIC,
TSSOP
The PIC12F508/509/16F505 devices have Power-on Reset, selectable Watchdog Timer, selectable code-protect, high I/O current
capability and precision internal oscillator.
The PIC12F508/509/16F505 devices use serial programming with data pin RB0/GP0 and clock pin RB1/GP1.
PIC12F508/509/16F505
DS41236E-page 8 2009 Microchip Technology Inc.
NOTES:
2009 Microchip Technology Inc. DS41236E-page 9
PIC12F508/509/16F505
2.0 PIC12F508/509/16F505 DEVICE
VARIETIES
A variety of packaging options are available. Depend-
ing on application and production requirements, the
proper device option can be selected using the
information in this section. When placing orders, please
use the PIC12F508/509/16F505 Product Identification
System at the back of this data sheet to specify the
correct part number.
2.1 Quick Turn Programming (QTP)
Devices
Microchip offers a QTP programming service for
factory production orders. This service is made
available for users who choose not to program
medium-to-high quantity units and whose code
patterns have stabilized. The devices are identical to
the Flash devices but with all Flash locations and fuse
options already programmed by the factory. Certain
code and prototype verification procedures do apply
before production shipments are available. Please
contact your local Microchip Technology sales office for
more details.
2.2 Serialized Quick Turn
Programming
SM
(SQTP
SM
) Devices
Microchip offers a unique programming service, where
a few user-defined locations in each device are
programmed with different serial numbers. The serial
numbers may be random, pseudo-random or
sequential.
Serial programming allows each device to have a
unique number, which can serve as an entry code,
password or ID number.
PIC12F508/509/16F505
DS41236E-page 10 2009 Microchip Technology Inc.
NOTES:
2009 Microchip Technology Inc. DS41236E-page 11
PIC12F508/509/16F505
3.0 ARCHITECTURAL OVERVIEW
The high performance of the PIC12F508/509/16F505
devices can be attributed to a number of architectural
features commonly found in RISC microprocessors.
To begin with, the PIC12F508/509/16F505 devices
use a Harvard architecture in which program and data
are accessed on separate buses. This improves
bandwidth over traditional von Neumann architec-
tures where program and data are fetched on the
same bus. Separating program and data memory fur-
ther allows instructions to be sized differently than the
8-bit wide data word. Instruction opcodes are 12 bits
wide, making it possible to have all single-word
instructions. A 12-bit wide program memory access
bus fetches a 12-bit instruction in a single cycle. A
two-stage pipeline overlaps fetch and execution of
instructions. Consequently, all instructions (33)
execute in a single cycle (200 ns @ 20 MHz, 1 s @
4 MHz) except for program branches.
Table 3-1 below lists program memory (Flash) and data
memory (RAM) for the PIC12F508/509/16F505
devices.
TABLE 3-1: PIC12F508/509/16F505
MEMORY
The PIC12F508/509/16F505 devices can directly or
indirectly address its register files and data memory. All
Special Function Registers (SFR), including the PC,
are mapped in the data memory. The PIC12F508/509/
16F505 devices have a highly orthogonal (symmetri-
cal) instruction set that makes it possible to carry out
any operation, on any register, using any addressing
mode. This symmetrical nature and lack of special
optimal situations make programming with the
PIC12F508/509/16F505 devices simple, yet efficient.
In addition, the learning curve is reduced significantly.
The PIC12F508/509/16F505 devices contain an 8-bit
ALU and working register. The ALU is a general
purpose arithmetic unit. It performs arithmetic and
Boolean functions between data in the working register
and any register file.
The ALU is 8 bits wide and capable of addition, sub-
traction, shift and logical operations. Unless otherwise
mentioned, arithmetic operations are twos comple-
ment in nature. In two-operand instructions, one
operand is typically the W (working) register. The other
operand is either a file register or an immediate
constant. In single operand instructions, the operand is
either the W register or a file register.
The W register is an 8-bit working register used for ALU
operations. It is not an addressable register.
Depending on the instruction executed, the ALU may
affect the values of the Carry (C), Digit Carry (DC) and
Zero (Z) bits in the STATUS register. The C and DC bits
operate as a borrow and digit borrow out bit, respec-
tively, in subtraction. See the SUBWF and ADDWF
instructions for examples.
Simplified block diagrams are shown in Figure 3-1 and
Figure 3-2, with the corresponding pin described in
Table 3-2 and Table 3-3.
Device
Memory
Program Data
PIC12F508 512 x 12 25 x 8
PIC12F509 1024 x 12 41 x 8
PIC16F505 1024 x 12 72 x 8
PIC12F508/509/16F505
DS41236E-page 12 2009 Microchip Technology Inc.
FIGURE 3-1: PIC12F508/509 BLOCK DIAGRAM
Device Reset
Timer
Power-on
Reset
Watchdog
Timer
Flash
Program
Memory
12
Data Bus
8
12
Program
Bus
Instruction Reg
Program Counter
RAM
File
Registers
Direct Addr
5
RAM Addr 9
Addr MUX
Indirect
Addr
FSR Reg
Status Reg
MUX
ALU
W Reg
Instruction
Decode and
Control
Timing
Generation
OSC1/CLKIN
OSC2
MCLR
VDD, VSS
Timer0
GPIO
8
8
GP4/OSC2
GP3/MCLR/VPP
GP2/T0CKI
GP1/ISCPCLK
GP0/ISCPDAT
5-7
3
GP5/OSC1/CLKIN
Stack 1
Stack 2
512 x 12 or
25 x 8 or
1024 x 12
41 x 8
Internal RC
OSC
2009 Microchip Technology Inc. DS41236E-page 13
PIC12F508/509/16F505
TABLE 3-2: PIC12F508/509 PINOUT DESCRIPTION
Name Function
Input
Type
Output
Type
Description
GP0/ICSPDAT GP0 TTL CMOS Bidirectional I/O pin. Can be software programmed for internal
weak pull-up and wake-up from Sleep on pin change.
ICSPDAT ST CMOS In-Circuit Serial Programming data pin.
GP1/ICSPCLK GP1 TTL CMOS Bidirectional I/O pin. Can be software programmed for internal
weak pull-up and wake-up from Sleep on pin change.
ICSPCLK ST CMOS In-Circuit Serial Programming clock pin.
GP2/T0CKI GP2 TTL CMOS Bidirectional I/O pin.
T0CKI ST Clock input to TMR0.
GP3/MCLR/VPP GP3 TTL Input pin. Can be software programmed for internal weak
pull-up and wake-up from Sleep on pin change.
MCLR ST Master Clear (Reset). When configured as MCLR, this pin is
an active-low Reset to the device. Voltage on MCLR/VPP must
not exceed VDD during normal device operation or the device
will enter Programming mode. Weak pull-up always on if
configured as MCLR.
VPP HV Programming voltage input.
GP4/OSC2 GP4 TTL CMOS Bidirectional I/O pin.
OSC2 XTAL Oscillator crystal output. Connections to crystal or resonator in
Crystal Oscillator mode (XT and LP modes only, GPIO in other
modes).
GP5/OSC1/CLKIN GP5 TTL CMOS Bidirectional I/O pin.
OSC1 XTAL Oscillator crystal input.
CLKIN ST External clock source input.
VDD VDD P Positive supply for logic and I/O pins.
VSS VSS P Ground reference for logic and I/O pins.
Legend: I = Input, O = Output, I/O = Input/Output, P = Power, = Not used, TTL = TTL input,
ST = Schmitt Trigger input, HV = High Voltage
PIC12F508/509/16F505
DS41236E-page 14 2009 Microchip Technology Inc.
FIGURE 3-2: PIC16F505 BLOCK DIAGRAM
Device Reset
Timer
Power-on
Reset
Watchdog
Timer
Flash
Program
Memory
12
Data Bus
8
12
Program
Bus
Instruction Reg
Program Counter
RAM
File
Registers
Direct Addr
5
RAM Addr 9
Addr MUX
Indirect
Addr
FSR Reg
Status Reg
MUX
ALU
W Reg
Instruction
Decode and
Control
Timing
Generation
OSC1/CLKIN
OSC2/CLKOUT
MCLR
VDD, VSS
Timer0
PORTB
8
8
RB4/OSC2/CLKOUT
RB3/MCLR/VPP
RB2
RB1/ICSPDAT
RB0/ICSPCLK
5-7
3
RB5/OSC1/CLKIN
Stack 1
Stack 2
1K x 12
72 bytes
Internal RC
OSC
PORTC
RC4
RC3
RC2
RC1
RC0
RC5/T0CKI
2009 Microchip Technology Inc. DS41236E-page 15
PIC12F508/509/16F505
TABLE 3-3: PIC16F505 PINOUT DESCRIPTION
Name Function
Input
Type
Output
Type
Description
RB0/ICSPDAT RB0 TTL CMOS Bidirectional I/O pin. Can be software programmed for internal
weak pull-up and wake-up from Sleep on pin change.
ICSPDAT ST CMOS In-Circuit Serial Programming data pin.
RB1/ICSPCLK RB1 TTL CMOS Bidirectional I/O pin. Can be software programmed for internal
weak pull-up and wake-up from Sleep on pin change.
ICSPCLK ST CMOS In-Circuit Serial Programming clock pin.
RB2 RB2 TTL CMOS Bidirectional I/O pin.
RB3/MCLR/VPP RB3 TTL Input port. Can be software programmed for internal weak
pull-up and wake-up from Sleep on pin change.
MCLR ST Master Clear (Reset). When configured as MCLR, this pin is
an active-low Reset to the device. Voltage on MCLR/VPP must
not exceed VDD during normal device operation or the device
will enter Programming mode. Weak pull-up always on if
configured as MCLR.
VPP HV Programming voltage input.
RB4/OSC2/CLKOUT RB4 TTL CMOS Bidirectional I/O pin. Can be software programmed for internal
weak pull-up and wake-up from Sleep on pin change.
OSC2 XTAL Oscillator crystal output. Connections to crystal or resonator in
Crystal Oscillator mode (XT, HS and LP modes only).
CLKOUT CMOS In EXTRC and INTRC modes, the pin output can be
configured for CLKOUT, which has 1/4 the frequency of OSC1
and denotes the instruction cycle rate.
RB5/OSC1/CLKIN RB5 TTL CMOS Bidirectional I/O pin.
OSC1 XTAL Crystal input.
CLKIN ST External clock source input.
RC0 RC0 TTL CMOS Bidirectional I/O pin.
RC1 RC1 TTL CMOS Bidirectional I/O pin.
RC2 RC2 TTL CMOS Bidirectional I/O pin.
RC3 RC3 TTL CMOS Bidirectional I/O pin.
RC4 RC4 TTL CMOS Bidirectional I/O pin.
RC5/T0CKI RC5 TTL CMOS Bidirectional I/O pin.
T0CKI ST Clock input to TMR0.
VDD VDD P Positive supply for logic and I/O pins.
VSS VSS P Ground reference for logic and I/O pins.
Legend: I = Input, O = Output, I/O = Input/Output, P = Power, = Not used, TTL = TTL input,
ST = Schmitt Trigger input, HV = High Voltage
PIC12F508/509/16F505
DS41236E-page 16 2009 Microchip Technology Inc.
3.1 Clocking Scheme/Instruction
Cycle
The clock input (OSC1/CLKIN pin) is internally divided
by four to generate four non-overlapping quadrature
clocks, namely Q1, Q2, Q3 and Q4. Internally, the PC
is incremented every Q1 and the instruction is fetched
from program memory and latched into the instruction
register in Q4. It is decoded and executed during the
following Q1 through Q4. The clocks and instruction
execution flow is shown in Figure 3-3 and Example 3-1.
3.2 Instruction Flow/Pipelining
An instruction cycle consists of four Q cycles (Q1, Q2,
Q3 and Q4). The instruction fetch and execute are
pipelined such that fetch takes one instruction cycle,
while decode and execute take another instruction
cycle. However, due to the pipelining, each instruction
effectively executes in one cycle. If an instruction
causes the PC to change (e.g., GOTO), then two cycles
are required to complete the instruction (Example 3-1).
A fetch cycle begins with the PC incrementing in Q1.
In the execution cycle, the fetched instruction is latched
into the Instruction Register (IR) in cycle Q1. This
instruction is then decoded and executed during the
Q2, Q3 and Q4 cycles. Data memory is read during Q2
(operand read) and written during Q4 (destination
write).
FIGURE 3-3: CLOCK/INSTRUCTION CYCLE
EXAMPLE 3-1: INSTRUCTION PIPELINE FLOW
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Q1
Q2
Q3
Q4
PC PC PC + 1 PC + 2
Fetch INST (PC)
Execute INST (PC 1) Fetch INST (PC + 1)
Execute INST (PC) Fetch INST (PC + 2)
Execute INST (PC + 1)
Internal
phase
clock
All instructions are single cycle, except for any program branches. These take two cycles, since the fetch instruction
is flushed from the pipeline, while the new instruction is being fetched and then executed.
1. MOVLW 03H Fetch 1 Execute 1
2. MOVWF PORTB Fetch 2 Execute 2
3. CALL SUB_1 Fetch 3 Execute 3
4. BSF PORTB, BIT1 Fetch 4 Flush
Fetch SUB_1 Execute SUB_1
2009 Microchip Technology Inc. DS41236E-page 17
PIC12F508/509/16F505
4.0 MEMORY ORGANIZATION
The PIC12F508/509/16F505 memories are organized
into program memory and data memory. For devices
with more than 512 bytes of program memory, a paging
scheme is used. Program memory pages are accessed
using one STATUS register bit. For the PIC12F509 and
PIC16F505, with data memory register files of more
than 32 registers, a banking scheme is used. Data
memory banks are accessed using the File Select
Register (FSR).
4.1 Program Memory Organization for
the PIC12F508/509
The PIC12F508 device has a 10-bit Program Counter
(PC) and PIC12F509 has a 11-bit Program Counter
(PC) capable of addressing a 2K x 12 program memory
space.
Only the first 512 x 12 (0000h-01FFh) for the
PIC12F508, and 1K x 12 (0000h-03FFh) for the
PIC12F509 are physically implemented (see
Figure 4-1). Accessing a location above these
boundaries will cause a wrap-around within the first
512 x 12 space (PIC12F508) or 1K x 12 space
(PIC12F509). The effective Reset vector is a 0000h
(see Figure 4-1). Location 01FFh (PIC12F508) and
location 03FFh (PIC12F509) contain the internal
clock oscillator calibration value. This value should
never be overwritten.
FIGURE 4-1: PROGRAM MEMORY MAP
AND STACK FOR THE
PIC12F508/509
CALL, RETLW
PC<11:0>
Stack Level 1
Stack Level 2
U
s
e
r
M
e
m
o
r
y
S
p
a
c
e
12
0000h
7FFh
01FFh
0200h
On-chip Program
Memory
Reset Vector
(1)
Note 1: Address 0000h becomes the
effective Reset vector. Location
01FFh, 03FFh (PIC12F508,
PIC12F509) contains the MOVLW XX
internal oscillator calibration value.
512 Word
1024 Word
03FFh
0400h
On-chip Program
Memory
PIC12F508/509/16F505
DS41236E-page 18 2009 Microchip Technology Inc.
4.2 Program Memory Organization
For The PIC16F505
The PIC16F505 device has a 11-bit Program Counter
(PC) capable of addressing a 2K x 12 program memory
space.
The 1K x 12 (0000h-03FFh) for the PIC16F505 are
physically implemented. Refer to Figure 4-2.
Accessing a location above this boundary will cause a
wrap-around within the first 1K x 12 space. The
effective Reset vector is at 0000h (see Figure 4-2).
Location 03FFh contains the internal oscillator
calibration value. This value should never be
overwritten.
FIGURE 4-2: PROGRAM MEMORY MAP
AND STACK FOR THE
PIC16F505
4.3 Data Memory Organization
Data memory is composed of registers or bytes of
RAM. Therefore, data memory for a device is specified
by its register file. The register file is divided into two
functional groups: Special Function Registers (SFR)
and General Purpose Registers (GPR).
The Special Function Registers include the TMR0
register, the Program Counter (PCL), the STATUS
register, the I/O registers (ports) and the File Select
Register (FSR). In addition, Special Function Registers
are used to control the I/O port configuration and
prescaler options.
The General Purpose Registers are used for data and
control information under command of the instructions.
For the PIC12F508/509, the register file is composed of
7 Special Function Registers, 9 General Purpose
Registers and 16 or 32 General Purpose Registers
accessed by banking (see Figure 4-3 and Figure 4-4).
For the PIC16F505, the register file is composed of 8
Special Function Registers, 8 General Purpose
Registers and 64 General Purpose Registers accessed
by banking (Figure 4-5).
4.3.1 GENERAL PURPOSE REGISTER
FILE
The General Purpose Register file is accessed, either
directly or indirectly, through the File Select Register
(FSR). See Section 4.9 Indirect Data Addressing:
INDF and FSR Registers.
CALL, RETLW
PC<11:0>
Stack Level 1
Stack Level 2
U
s
e
r
M
e
m
o
r
y
S
p
a
c
e
12
0000h
7FFh
01FFh
0200h
Reset Vector
(1)
Note 1: Address 0000h becomes the
effective Reset vector. Location
03FFh contains the MOVLW XX
internal oscillator calibration value.
1024 Words
03FFh
0400h
On-chip Program
Memory
2009 Microchip Technology Inc. DS41236E-page 19
PIC12F508/509/16F505
FIGURE 4-3: PIC12F508 REGISTER
FILE MAP
FIGURE 4-4: PIC12F509 REGISTER
FILE MAP
FIGURE 4-5: PIC16F505 REGISTER FILE MAP
File Address
00h
01h
02h
03h
04h
05h
06h
07h
1Fh
INDF
(1)
TMR0
PCL
STATUS
FSR
OSCCAL
GPIO
General
Purpose
Registers
Note 1: Not a physical register. See Section 4.9
Indirect Data Addressing: INDF and
FSR Registers.
File Address
00h
01h
02h
03h
04h
05h
06h
07h
1Fh
INDF
(1)
TMR0
PCL
STATUS
FSR
OSCCAL
GPIO
0Fh
10h
Bank 0 Bank 1
3Fh
30h
20h
2Fh
General
Purpose
Registers
General
Purpose
Registers
General
Purpose
Registers
Addresses map
back to
addresses
in Bank 0.
Note 1: Not a physical register. See Section 4.9
Indirect Data Addressing: INDF and FSR
Registers.
FSR<5> 0 1
File Address
00h
01h
02h
03h
04h
05h
06h
07h
1Fh
INDF
(1)
TMR0
PCL
STATUS
FSR
OSCCAL
PORTB
0Fh
10h
Bank 0 Bank 1
3Fh
30h
20h
2Fh
General
Purpose
Registers
General
Purpose
Registers
General
Purpose
Registers
Addresses map back to
addresses in Bank 0.
Note 1: Not a physical register. See Section 4.9 Indirect Data Addressing: INDF and FSR Registers.
FSR<6:5> 00 01
Bank 3
7Fh
70h
60h
6Fh
General
Purpose
Registers
11
Bank 2
5Fh
50h
40h
4Fh
General
Purpose
Registers
10
08h
PORTC
PIC12F508/509/16F505
DS41236E-page 20 2009 Microchip Technology Inc.
4.3.2 SPECIAL FUNCTION REGISTERS
The Special Function Registers (SFRs) are registers
used by the CPU and peripheral functions to control the
operation of the device (Table 4-1).
The Special Function Registers can be classified into
two sets. The Special Function Registers associated
with the core functions are described in this section.
Those related to the operation of the peripheral
features are described in the section for each
peripheral feature.
TABLE 4-1: SPECIAL FUNCTION REGISTER (SFR) SUMMARY (PIC12F508/509)
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Value on
Power-On
Reset
(2)
Page #
00h INDF Uses Contents of FSR to Address Data Memory (not a physical
register)
xxxx xxxx 28
01h TMR0 8-bit Real-Time Clock/Counter xxxx xxxx 35
02h
(1)
PCL Low-order 8 bits of PC 1111 1111 27
03h STATUS GPWUF PA0
(5)
TO PD Z DC C 0-01 1xxx
(3)
22
04h FSR Indirect Data Memory Address Pointer 111x xxxx 28
04h
(4)
FSR Indirect Data Memory Address Pointer 110x xxxx 28
05h OSCCAL CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0 1111 111- 26
06h GPIO GP5 GP4 GP3 GP2 GP1 GP0 --xx xxxx 31
N/A TRISGPIO I/O Control Register --11 1111 31
N/A OPTION GPWU GPPU TOCS TOSE PSA PS2 PS1 PS0 1111 1111 24
Legend: = unimplemented, read as 0, x = unknown, u = unchanged, q = value depends on condition.
Note 1: The upper byte of the Program Counter is not directly accessible. See Section 4.7 Program Counter
for an explanation of how to access these bits.
2: Other (non Power-up) Resets include external Reset through MCLR, Watchdog Timer and wake-up on pin
change Reset.
3: If Reset was due to wake-up on pin change, then bit 7 = 1. All other Resets will cause bit 7 = 0.
4: PIC12F509 only.
5: This bit is used on the PIC12F509. For code compatibility do not use this bit on the PIC12F508.
2009 Microchip Technology Inc. DS41236E-page 21
PIC12F508/509/16F505
TABLE 4-2: SPECIAL FUNCTION REGISTER (SFR) SUMMARY (PIC16F505)
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Value on
Power-On
Reset
(2)
Page #
00h INDF Uses Contents of FSR to Address Data Memory (not a physical
register)
xxxx xxxx 28
01h TMR0 8-bit Real-Time Clock/Counter xxxx xxxx 35
02h
(1)
PCL Low-order 8 bits of PC 1111 1111 27
03h STATUS RBWUF PA0 TO PD Z DC C 0-01 1xxx 22
04h FSR Indirect Data Memory Address Pointer 100x xxxx 28
05h OSCCAL CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0 1111 111- 26
06h PORTB RB5 RB4 RB3 RB2 RB1 RB0 --xx xxxx 31
07h PORTC RC5 RC4 RC3 RC2 RC1 RC0 --xx xxxx 31
N/A TRISB I/O Control Register --11 1111 31
N/A TRISC I/O Control Register --11 1111 31
N/A OPTION RBWU RBPU TOCS TOSE PSA PS2 PS1 PS0 1111 1111 25
Legend: = unimplemented, read as 0, x = unknown, u = unchanged, q = value depends on condition.
Note 1: If Reset was due to wake-up on pin change, then bit 7 = 1. All other Resets will cause bit 7 = 0.
2: Other (non Power-up) Resets include external reset through MCLR, Watchdog Timer and wake-up on pin
change Reset.
PIC12F508/509/16F505
DS41236E-page 22 2009 Microchip Technology Inc.
4.4 STATUS Register
This register contains the arithmetic status of the ALU,
the Reset status and the page preselect bit.
The STATUS register can be the destination for any
instruction, as with any other register. If the STATUS
register is the destination for an instruction that affects
the Z, DC or C bits, then the write to these three bits is
disabled. These bits are set or cleared according to the
device logic. Furthermore, the TO and PD bits are not
writable. Therefore, the result of an instruction with the
STATUS register as destination may be different than
intended.
For example, CLRF STATUS, will clear the upper three
bits and set the Z bit. This leaves the STATUS register
as 000u u1uu (where u = unchanged).
Therefore, it is recommended that only BCF, BSF and
MOVWF instructions be used to alter the STATUS regis-
ter. These instructions do not affect the Z, DC or C bits
from the STATUS register. For other instructions which
do affect Status bits, see Section 8.0 Instruction Set
Summary.
REGISTER 4-1: STATUS REGISTER (ADDRESS: 03h) (PIC12F508/509)
R/W-0 R/W-0 R/W-0 R-1 R-1 R/W-x R/W-x R/W-x
GPWUF PA0 TO PD Z DC C
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0
-n = Value at POR 1 = Bit is set 0 = Bit is cleared x = Bit is unknown
bit 7 GPWUF: GPIO Reset bit
1 = Reset due to wake-up from Sleep on pin change
0 = After power-up or other Reset
bit 6 Reserved: Do not use
bit 5 PA0: Program Page Preselect bits
(1)
1 = Page 1 (200h-3FFh)
0 = Page 0 (000h-1FFh)
Each page is 512 bytes.
Using the PA0 bit as a general purpose read/write bit in devices which do not use it for program page preselect is
not recommended, since this may affect upward compatibility with future products.
bit 4 TO: Time-Out bit
1 = After power-up, CLRWDT instruction, or SLEEP instruction
0 = A WDT time-out occurred
bit 3 PD: Power-Down bit
1 = After power-up or by the CLRWDT instruction
0 = By execution of the SLEEP instruction
bit 2 Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit 1 DC: Digit Carry/Borrow bit (for ADDWF and SUBWF instructions)
ADDWF:
1 = A carry from the 4th low-order bit of the result occurred
0 = A carry from the 4th low-order bit of the result did not occur
SUBWF:
1 = A borrow from the 4th low-order bit of the result did not occur
0 = A borrow from the 4th low-order bit of the result occurred
bit 0 C: Carry/Borrow bit (for ADDWF, SUBWF and RRF, RLF instructions)
ADDWF: SUBWF: RRF or RLF:
1 = A carry occurred 1 = A borrow did not occur Load bit with LSb or MSb, respectively
0 = A carry did not occur 0 = A borrow occurred
Note 1: This bit is used on the PIC12F509. For code compatibility do not use this bit on the PIC12F508.
2009 Microchip Technology Inc. DS41236E-page 23
PIC12F508/509/16F505
REGISTER 4-2: STATUS REGISTER (ADDRESS: 03h) (PIC16F505)
R/W-0 R/W-0 R/W-0 R-1 R-1 R/W-x R/W-x R/W-x
RBWUF PA0 TO PD Z DC C
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0
-n = Value at POR 1 = Bit is set 0 = Bit is cleared x = Bit is unknown
bit 7 RBWUF: PORTB Reset bit
1 = Reset due to wake-up from Sleep on pin change
0 = After power-up or other Reset
bit 6 Reserved: Do not use
bit 5 PA0: Program Page Preselect bits
1 = Page 1 (200h-3FFh)
0 = Page 0 (000h-1FFh)
Each page is 512 bytes.
Using the PA0 bit as a general purpose read/write bit in devices which do not use it for program page
preselect is not recommended, since this may affect upward compatibility with future products.
bit 4 TO: Time-Out bit
1 = After power-up, CLRWDT instruction, or SLEEP instruction
0 = A WDT time-out occurred
bit 3 PD: Power-Down bit
1 = After power-up or by the CLRWDT instruction
0 = By execution of the SLEEP instruction
bit 2 Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit 1 DC: Digit Carry/Borrow bit (for ADDWF and SUBWF instructions)
ADDWF:
1 = A carry from the 4th low-order bit of the result occurred
0 = A carry from the 4th low-order bit of the result did not occur
SUBWF:
1 = A borrow from the 4th low-order bit of the result did not occur
0 = A borrow from the 4th low-order bit of the result occurred
bit 0 C: Carry/Borrow bit (for ADDWF, SUBWF and RRF, RLF instructions)
ADDWF: SUBWF: RRF or RLF:
1 = A carry occurred 1 = A borrow did not occur Load bit with LSb or MSb, respectively
0 = A carry did not occur 0 = A borrow occurred
PIC12F508/509/16F505
DS41236E-page 24 2009 Microchip Technology Inc.
4.5 OPTION Register
The OPTION register is a 8-bit wide, write-only register,
which contains various control bits to configure the
Timer0/WDT prescaler and Timer0.
By executing the OPTION instruction, the contents of
the W register will be transferred to the OPTION regis-
ter. A Reset sets the OPTION<7:0> bits.
Note: If TRIS bit is set to 0, the wake-up on
change and pull-up functions are disabled
for that pin (i.e., note that TRIS overrides
Option control of GPPU/RBPU and
GPWU/RBWU).
Note: If the T0CS bit is set to 1, it will override
the TRIS function on the T0CKI pin.
REGISTER 4-3: OPTION REGISTER (PIC12F508/509)
W-1 W-1 W-1 W-1 W-1 W-1 W-1 W-1
GPWU GPPU T0CS T0SE PSA PS2 PS1 PS0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0
-n = Value at POR 1 = Bit is set 0 = Bit is cleared x = Bit is unknown
bit 7 GPWU: Enable Wake-up on Pin Change bit (GP0, GP1, GP3)
1 = Disabled
0 = Enabled
bit 6 GPPU: Enable Weak Pull-ups bit (GP0, GP1, GP3)
1 = Disabled
0 = Enabled
bit 5 T0CS: Timer0 Clock Source Select bit
1 = Transition on T0CKI pin (overrides TRIS on the T0CKI pin)
0 = Transition on internal instruction cycle clock, FOSC/4
bit 4 T0SE: Timer0 Source Edge Select bit
1 = Increment on high-to-low transition on the T0CKI pin
0 = Increment on low-to-high transition on the T0CKI pin
bit 3 PSA: Prescaler Assignment bit
1 = Prescaler assigned to the WDT
0 = Prescaler assigned to Timer0
bit 2-0 PS<2:0>: Prescaler Rate Select bits
000
001
010
011
100
101
110
111
1 : 2
1 : 4
1 : 8
1 : 16
1 : 32
1 : 64
1 : 128
1 : 256
1 : 1
1 : 2
1 : 4
1 : 8
1 : 16
1 : 32
1 : 64
1 : 128
Bit Value Timer0 Rate WDT Rate
2009 Microchip Technology Inc. DS41236E-page 25
PIC12F508/509/16F505
REGISTER 4-4: OPTION REGISTER (PIC16F505)
W-1 W-1 W-1 W-1 W-1 W-1 W-1 W-1
RBWU RBPU T0CS T0SE PSA PS2 PS1 PS0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0
-n = Value at POR 1 = Bit is set 0 = Bit is cleared x = Bit is unknown
bit 7 RBWU: Enable Wake-up on Pin Change bit (RB0, RB1, RB3, RB4)
1 = Disabled
0 = Enabled
bit 6 RBPU: Enable Weak Pull-ups bit (RB0, RB1, RB3, RB4)
1 = Disabled
0 = Enabled
bit 5 T0CS: Timer0 clock Source Select bit
1 = Transition on T0CKI pin (overrides TRIS on the T0CKI pin)
0 = Transition on internal instruction cycle clock, FOSC/4
bit 4 T0SE: Timer0 Source Edge Select bit
1 = Increment on high-to-low transition on the T0CKI pin
0 = Increment on low-to-high transition on the T0CKI pin
bit 3 PSA: Prescaler Assignment bit
1 = Prescaler assigned to the WDT
0 = Prescaler assigned to Timer0
bit 2-0 PS<2:0>: Prescaler Rate Select bits
000
001
010
011
100
101
110
111
1 : 2
1 : 4
1 : 8
1 : 16
1 : 32
1 : 64
1 : 128
1 : 256
1 : 1
1 : 2
1 : 4
1 : 8
1 : 16
1 : 32
1 : 64
1 : 128
Bit Value Timer0 Rate WDT Rate
PIC12F508/509/16F505
DS41236E-page 26 2009 Microchip Technology Inc.
4.6 OSCCAL Register
The Oscillator Calibration (OSCCAL) register is used to
calibrate the internal precision 4 MHz oscillator. It
contains seven bits for calibration.
After you move in the calibration constant, do not
change the value. See Section 7.2.5 Internal 4 MHz
RC Oscillator.
Note: Erasing the device will also erase the pre-
programmed internal calibration value for
the internal oscillator. The calibration
value must be read prior to erasing the
part so it can be reprogrammed correctly
later.
REGISTER 4-5: OSCCAL REGISTER (ADDRESS: 05h)
R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-0
CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0
-n = Value at POR 1 = Bit is set 0 = Bit is cleared x = Bit is unknown
bit 7-1 CAL<6:0>: Oscillator Calibration bits
0111111 = Maximum frequency
0000001
0000000 = Center frequency
1111111
f, d
f, d
f, d
f, d
f, d
f, d
f, d
f
f, d
f, d
f, d
f, d
f, d
Add W and f
AND W with f
Clear f
Clear W
Complement f
Decrement f
Decrement f, Skip if 0
Increment f
Increment f, Skip if 0
Inclusive OR W with f
Move f
Move W to f
No Operation
Rotate left f through Carry
Rotate right f through Carry
Subtract W from f
Swap f
Exclusive OR W with f
1
1
1
1
1
1
1
(2)
1
1
(2)
1
1
1
1
1
1
1
1
1
0001
0001
0000
0000
0010
0000
0010
0010
0011
0001
0010
0000
0000
0011
0011
0000
0011
0001
11df
01df
011f
0100
01df
11df
11df
10df
11df
00df
00df
001f
0000
01df
00df
10df
10df
10df
ffff
ffff
ffff
0000
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
0000
ffff
ffff
ffff
ffff
ffff
C, DC, Z
Z
Z
Z
Z
Z
None
Z
None
Z
Z
None
None
C
C
C, DC, Z
None
Z
1, 2, 4
2, 4
4
2, 4
2, 4
2, 4
2, 4
2, 4
2, 4
1, 4
2, 4
2, 4
1, 2, 4
2, 4
2, 4
BIT-ORIENTED FILE REGISTER OPERATIONS
BCF
BSF
BTFSC
BTFSS
f, b
f, b
f, b
f, b
Bit Clear f
Bit Set f
Bit Test f, Skip if Clear
Bit Test f, Skip if Set
1
1
1
(2)
1
(2)
0100
0101
0110
0111
bbbf
bbbf
bbbf
bbbf
ffff
ffff
ffff
ffff
None
None
None
None
2, 4
2, 4
LITERAL AND CONTROL OPERATIONS
ANDLW
CALL
CLRWDT
GOTO
IORLW
MOVLW
OPTION
RETLW
SLEEP
TRIS
XORLW
k
k
k
k
k
f
k
AND literal with W
Call Subroutine
Clear Watchdog Timer
Unconditional branch
Inclusive OR literal with W
Move literal to W
Load OPTION register
Return, place literal in W
Go into Standby mode
Load TRIS register
Exclusive OR literal to W
1
2
1
2
1
1
1
2
1
1
1
1110
1001
0000
101k
1101
1100
0000
1000
0000
0000
1111
kkkk
kkkk
0000
kkkk
kkkk
kkkk
0000
kkkk
0000
0000
kkkk
kkkk
kkkk
0100
kkkk
kkkk
kkkk
0010
kkkk
0011
0fff
kkkk
Z
None
TO, PD
None
Z
None
None
None
TO, PD
None
Z
1
3
Note 1: The 9th bit of the program counter will be forced to a 0 by any instruction that writes to the PC except for
GOTO. See Section 4.7 Program Counter.
2: When an I/O register is modified as a function of itself (e.g. MOVF PORTB, 1), the value used will be that
value present on the pins themselves. For example, if the data latch is 1 for a pin configured as input and
is driven low by an external device, the data will be written back with a 0.
3: The instruction TRIS f, where f = 6, causes the contents of the W register to be written to the tri-state
latches of PORTB. A 1 forces the pin to a high-impedance state and disables the output buffers.
4: If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be
cleared (if assigned to TMR0).
2009 Microchip Technology Inc. DS41236E-page 59
PIC12F508/509/16F505
ADDWF Add W and f
Syntax: [ label ] ADDWF f,d
Operands: 0 f 31
d [0,1]
Operation: (W) + (f) (dest)
Status Affected: C, DC, Z
Description: Add the contents of the W register
and register f. If d is0, the result
is stored in the W register. If d is
1, the result is stored back in
register f.
ANDLW AND literal with W
Syntax: [ label ] ANDLW k
Operands: 0 k 255
Operation: (W).AND. (k) (W)
Status Affected: Z
Description: The contents of the W register are
ANDed with the eight-bit literal k.
The result is placed in the W
register.
ANDWF AND W with f
Syntax: [ label ] ANDWF f,d
Operands: 0 f 31
d [0,1]
Operation: (W) .AND. (f) (dest)
Status Affected: Z
Description: The contents of the W register are
ANDed with register f. If d is 0,
the result is stored in the W register.
If d is 1, the result is stored back
in register f.
BCF Bit Clear f
Syntax: [ label ] BCF f,b
Operands: 0 f 31
0 b 7
Operation: 0 (f<b>)
Status Affected: None
Description: Bit b in register f is cleared.
BSF Bit Set f
Syntax: [ label ] BSF f,b
Operands: 0 f 31
0 b 7
Operation: 1 (f<b>)
Status Affected: None
Description: Bit b in register f is set.
BTFSC Bit Test f, Skip if Clear
Syntax: [ label ] BTFSC f,b
Operands: 0 f 31
0 b 7
Operation: skip if (f<b>) = 0
Status Affected: None
Description: If bit b in register f is 0, then the
next instruction is skipped.
If bit b is 0, then the next instruc-
tion fetched during the current
instruction execution is discarded,
and a NOP is executed instead,
making this a two-cycle instruction.
PIC12F508/509/16F505
DS41236E-page 60 2009 Microchip Technology Inc.
BTFSS Bit Test f, Skip if Set
Syntax: [ label ] BTFSS f,b
Operands: 0 f 31
0 b < 7
Operation: skip if (f<b>) = 1
Status Affected: None
Description: If bit b in register f is 1, then the
next instruction is skipped.
If bit b is 1, then the next instruc-
tion fetched during the current
instruction execution, is discarded
and a NOP is executed instead,
making this a two-cycle instruction.
CALL Subroutine Call
Syntax: [ label ] CALL k
Operands: 0 k 255
Operation: (PC) + 1 Top-of-Stack;
k PC<7:0>;
(STATUS<6:5>) PC<10:9>;
0 PC<8>
Status Affected: None
Description: Subroutine call. First, return
address (PC + 1) is PUSHed onto
the stack. The eight-bit immediate
address is loaded into PC
bits <7:0>. The upper bits
PC<10:9> are loaded from
STATUS<6:5>, PC<8> is cleared.
CALL is a two-cycle instruction.
CLRF Clear f
Syntax: [ label ] CLRF f
Operands: 0 f 31
Operation: 00h (f);
1 Z
Status Affected: Z
Description: The contents of register f are
cleared and the Z bit is set.
CLRW Clear W
Syntax: [ label ] CLRW
Operands: None
Operation: 00h (W);
1 Z
Status Affected: Z
Description: The W register is cleared. Zero bit
(Z) is set.
CLRWDT Clear Watchdog Timer
Syntax: [ label ] CLRWDT
Operands: None
Operation: 00h WDT;
0 WDT prescaler (if assigned);
1 TO;
1 PD
Status Affected: TO, PD
Description: The CLRWDT instruction resets the
WDT. It also resets the prescaler, if
the prescaler is assigned to the
WDT and not Timer0. Status bits
TO and PD are set.
COMF Complement f
Syntax: [ label ] COMF f,d
Operands: 0 f 31
d [0,1]
Operation: (f) (dest)
Status Affected: Z
Description: The contents of register f are
complemented. If d is 0, the
result is stored in the W register. If
d is 1, the result is stored back in
register f.
2009 Microchip Technology Inc. DS41236E-page 61
PIC12F508/509/16F505
DECF Decrement f
Syntax: [ label ] DECF f,d
Operands: 0 f 31
d [0,1]
Operation: (f) 1 (dest)
Status Affected: Z
Description: Decrement register f. If d is 0,
the result is stored in the W
register. If d is 1, the result is
stored back in register f.
DECFSZ Decrement f, Skip if 0
Syntax: [ label ] DECFSZ f,d
Operands: 0 f 31
d [0,1]
Operation: (f) 1 d; skip if result = 0
Status Affected: None
Description: The contents of register f are
decremented. If d is 0, the result
is placed in the W register. If d is
1, the result is placed back in
register f.
If the result is 0, the next instruc-
tion, which is already fetched, is
discarded and a NOP is executed
instead making it a two-cycle
instruction.
GOTO Unconditional Branch
Syntax: [ label ] GOTO k
Operands: 0 k 511
Operation: k PC<8:0>;
STATUS<6:5> PC<10:9>
Status Affected: None
Description: GOTO is an unconditional branch.
The 9-bit immediate value is
loaded into PC bits <8:0>. The
upper bits of PC are loaded from
STATUS<6:5>. GOTO is a two-
cycle instruction.
INCF Increment f
Syntax: [ label ] INCF f,d
Operands: 0 f 31
d [0,1]
Operation: (f) + 1 (dest)
Status Affected: Z
Description: The contents of register f are
incremented. If d is 0, the result
is placed in the W register. If d is
1, the result is placed back in
register f.
INCFSZ Increment f, Skip if 0
Syntax: [ label ] INCFSZ f,d
Operands: 0 f 31
d [0,1]
Operation: (f) + 1 (dest), skip if result = 0
Status Affected: None
Description: The contents of register f are
incremented. If d is 0, the result
is placed in the W register. If d is
1, the result is placed back in
register f.
If the result is 0, then the next
instruction, which is already
fetched, is discarded and a NOP is
executed instead making it a
two-cycle instruction.
IORLW Inclusive OR literal with W
Syntax: [ label ] IORLW k
Operands: 0 k 255
Operation: (W) .OR. (k) (W)
Status Affected: Z
Description: The contents of the W register are
ORed with the eight-bit literal k.
The result is placed in the
W register.
PIC12F508/509/16F505
DS41236E-page 62 2009 Microchip Technology Inc.
IORWF Inclusive OR W with f
Syntax: [ label ] IORWF f,d
Operands: 0 f 31
d [0,1]
Operation: (W).OR. (f) (dest)
Status Affected: Z
Description: Inclusive OR the W register with
register f. If d is 0, the result is
placed in the W register. If d is 1,
the result is placed back in register
f.
MOVF Move f
Syntax: [ label ] MOVF f,d
Operands: 0 f 31
d [0,1]
Operation: (f) (dest)
Status Affected: Z
Description: The contents of register f are
moved to destination d. If d is 0,
destination is the W register. If d
is 1, the destination is file
register f. d = 1 is useful as a
test of a file register, since status
flag Z is affected.
MOVLW Move Literal to W
Syntax: [ label ] MOVLW k
Operands: 0 k 255
Operation: k (W)
Status Affected: None
Description: The eight-bit literal k is loaded
into the W register. The dont
cares will assembled as 0s.
MOVWF Move W to f
Syntax: [ label ] MOVWF f
Operands: 0 f 31
Operation: (W) (f)
Status Affected: None
Description: Move data from the W register to
register f.
NOP No Operation
Syntax: [ label ] NOP
Operands: None
Operation: No operation
Status Affected: None
Description: No operation.
OPTION Load OPTION Register
Syntax: [ label ] OPTION
Operands: None
Operation: (W) OPTION
Status Affected: None
Description: The content of the W register is
loaded into the OPTION register.
2009 Microchip Technology Inc. DS41236E-page 63
PIC12F508/509/16F505
RETLW Return with Literal in W
Syntax: [ label ] RETLW k
Operands: 0 k 255
Operation: k (W);
TOS PC
Status Affected: None
Description: The W register is loaded with the
eight-bit literal k. The program
counter is loaded from the top of
the stack (the return address). This
is a two-cycle instruction.
RLF Rotate Left f through Carry
Syntax: [ label ] RLF f,d
Operands: 0 f 31
d [0,1]
Operation: See description below
Status Affected: C
Description: The contents of register f are
rotated one bit to the left through
the Carry flag. If d is 0, the result
is placed in the W register. If d is
1, the result is stored back in
register f.
RRF Rotate Right f through Carry
Syntax: [ label ] RRF f,d
Operands: 0 f 31
d [0,1]
Operation: See description below
Status Affected: C
Description: The contents of register f are
rotated one bit to the right through
the Carry flag. If d is 0, the result
is placed in the W register. If d is
1, the result is placed back in
register f.
C
register f
C
register f
SLEEP Enter SLEEP Mode
Syntax:
[label ]
SLEEP
Operands: None
Operation: 00h WDT;
0 WDT prescaler;
1 TO;
0 PD
Status Affected: TO, PD, RBWUF
Description: Time-out Status bit (TO) is set. The
Power-down Status bit (PD) is
cleared.
RBWUF is unaffected.
The WDT and its prescaler are
cleared.
The processor is put into Sleep
mode with the oscillator stopped.
See Section 7.9 Power-down
Mode (Sleep) on Sleep for more
details.
SUBWF Subtract W from f
Syntax:
[label ] SUBWF f,d
Operands: 0 f 31
d [0,1]
Operation: (f) (W) (dest)
Status Affected: C, DC, Z
Description: Subtract (2s complement method)
the W register from register f. If d
is 0, the result is stored in the W
register. If d is 1, the result is
stored back in register f.
SWAPF Swap Nibbles in f
Syntax: [ label ] SWAPF f,d
Operands: 0 f 31
d [0,1]
Operation: (f<3:0>) (dest<7:4>);
(f<7:4>) (dest<3:0>)
Status Affected: None
Description: The upper and lower nibbles of
register f are exchanged. If d is
0, the result is placed in W
register. If d is 1, the result is
placed in register f.
PIC12F508/509/16F505
DS41236E-page 64 2009 Microchip Technology Inc.
TRIS Load TRIS Register
Syntax: [ label ] TRIS f
Operands: f = 6
Operation: (W) TRIS register f
Status Affected: None
Description: TRIS register f (f = 6 or 7) is
loaded with the contents of the W
register
XORLW Exclusive OR literal with W
Syntax:
[label ] XORLW k
Operands: 0 k 255
Operation: (W) .XOR. k (W)
Status Affected: Z
Description: The contents of the W register are
XORed with the eight-bit literal k.
The result is placed in the W
register.
XORWF Exclusive OR W with f
Syntax: [ label ] XORWF f,d
Operands: 0 f 31
d [0,1]
Operation: (W) .XOR. (f) (dest)
Status Affected: Z
Description: Exclusive OR the contents of the
W register with register f. If d is
0, the result is stored in the W
register. If d is 1, the result is
stored back in register f.
2009 Microchip Technology Inc. DS41236E-page 65
PIC12F508/509/16F505
9.0 DEVELOPMENT SUPPORT
The PIC
IDE Software
Assemblers/Compilers/Linkers
- MPASM
TM
Assembler
- MPLAB C18 and MPLAB C30 C Compilers
- MPLINK
TM
Object Linker/
MPLIB
TM
Object Librarian
- MPLAB ASM30 Assembler/Linker/Library
Simulators
- MPLAB SIM Software Simulator
Emulators
- MPLAB ICE 2000 In-Circuit Emulator
- MPLAB REAL ICE In-Circuit Emulator
In-Circuit Debugger
- MPLAB ICD 2
Device Programmers
- PICSTART
standard HEX
files, MAP files to detail memory usage and symbol
reference, absolute LST files that contain source lines
and generated machine code and COFF files for
debugging.
The MPASM Assembler features include:
Integration into MPLAB IDE projects
User-defined macros to streamline
assembly code
Conditional assembly for multi-purpose
source files
Directives that allow complete control over the
assembly process
9.3 MPLAB C18 and MPLAB C30
C Compilers
The MPLAB C18 and MPLAB C30 Code Development
Systems are complete ANSI C compilers for
Microchips PIC18 and PIC24 families of microcon-
trollers and the dsPIC30 and dsPIC33 family of digital
signal controllers. These compilers provide powerful
integration capabilities, superior code optimization and
ease of use not found with other compilers.
For easy source level debugging, the compilers provide
symbol information that is optimized to the MPLAB IDE
debugger.
9.4 MPLINK Object Linker/
MPLIB Object Librarian
The MPLINK Object Linker combines relocatable
objects created by the MPASM Assembler and the
MPLAB C18 C Compiler. It can link relocatable objects
from precompiled libraries, using directives from a
linker script.
The MPLIB Object Librarian manages the creation and
modification of library files of precompiled code. When
a routine from a library is called from a source file, only
the modules that contain that routine will be linked in
with the application. This allows large libraries to be
used efficiently in many different applications.
The object linker/library features include:
Efficient linking of single libraries instead of many
smaller files
Enhanced code maintainability by grouping
related modules together
Flexible creation of libraries with easy module
listing, replacement, deletion and extraction
9.5 MPLAB ASM30 Assembler, Linker
and Librarian
MPLAB ASM30 Assembler produces relocatable
machine code from symbolic assembly language for
dsPIC30F devices. MPLAB C30 C Compiler uses the
assembler to produce its object file. The assembler
generates relocatable object files that can then be
archived or linked with other relocatable object files and
archives to create an executable file. Notable features
of the assembler include:
Support for the entire dsPIC30F instruction set
Support for fixed-point and floating-point data
Command line interface
Rich directive set
Flexible macro language
MPLAB IDE compatibility
9.6 MPLAB SIM Software Simulator
The MPLAB SIM Software Simulator allows code
development in a PC-hosted environment by
simulating the PIC MCUs and dsPIC
DSCs on an
instruction level. On any given instruction, the data
areas can be examined or modified and stimuli can be
applied from a comprehensive stimulus controller.
Registers can be logged to files for further run-time
analysis. The trace buffer and logic analyzer display
extend the power of the simulator to record and track
program execution, actions on I/O, most peripherals
and internal registers.
The MPLAB SIM Software Simulator fully supports
symbolic debugging using the MPLAB C18 and
MPLAB C30 C Compilers, and the MPASM and
MPLAB ASM30 Assemblers. The software simulator
offers the flexibility to develop and debug code outside
of the hardware laboratory environment, making it an
excellent, economical software development tool.
2009 Microchip Technology Inc. DS41236E-page 67
PIC12F508/509/16F505
9.7 MPLAB ICE 2000
High-Performance
In-Circuit Emulator
The MPLAB ICE 2000 In-Circuit Emulator is intended
to provide the product development engineer with a
complete microcontroller design tool set for PIC
microcontrollers. Software control of the MPLAB ICE
2000 In-Circuit Emulator is advanced by the MPLAB
Integrated Development Environment, which allows
editing, building, downloading and source debugging
from a single environment.
The MPLAB ICE 2000 is a full-featured emulator
system with enhanced trace, trigger and data monitor-
ing features. Interchangeable processor modules allow
the system to be easily reconfigured for emulation of
different processors. The architecture of the MPLAB
ICE 2000 In-Circuit Emulator allows expansion to
support new PIC microcontrollers.
The MPLAB ICE 2000 In-Circuit Emulator system has
been designed as a real-time emulation system with
advanced features that are typically found on more
expensive development tools. The PC platform and
Microsoft
Windows
Flash DSCs
with the easy-to-use, powerful graphical user interface of
the MPLAB Integrated Development Environment (IDE),
included with each kit.
The MPLAB REAL ICE probe is connected to the design
engineers PC using a high-speed USB 2.0 interface and
is connected to the target with either a connector
compatible with the popular MPLAB ICD 2 system
(RJ11) or with the new high-speed, noise tolerant, Low-
Voltage Differential Signal (LVDS) interconnection
(CAT5).
MPLAB REAL ICE is field upgradeable through future
firmware downloads in MPLAB IDE. In upcoming
releases of MPLAB IDE, new devices will be supported,
and new features will be added, such as software break-
points and assembly code trace. MPLAB REAL ICE
offers significant advantages over competitive emulators
including low-cost, full-speed emulation, real-time
variable watches, trace analysis, complex breakpoints, a
ruggedized probe interface and long (up to three meters)
interconnection cables.
9.9 MPLAB ICD 2 In-Circuit Debugger
Microchips In-Circuit Debugger, MPLAB ICD 2, is a
powerful, low-cost, run-time development tool,
connecting to the host PC via an RS-232 or high-speed
USB interface. This tool is based on the Flash PIC
MCUs and can be used to develop for these and other
PIC MCUs and dsPIC DSCs. The MPLAB ICD 2 utilizes
the in-circuit debugging capability built into the Flash
devices. This feature, along with Microchips In-Circuit
Serial Programming
TM
(ICSP
TM
) protocol, offers cost-
effective, in-circuit Flash debugging from the graphical
user interface of the MPLAB Integrated Development
Environment. This enables a designer to develop and
debug source code by setting breakpoints, single step-
ping and watching variables, and CPU status and
peripheral registers. Running at full speed enables
testing hardware and applications in real time. MPLAB
ICD 2 also serves as a development programmer for
selected PIC devices.
9.10 MPLAB PM3 Device Programmer
The MPLAB PM3 Device Programmer is a universal,
CE compliant device programmer with programmable
voltage verification at VDDMIN and VDDMAX for
maximum reliability. It features a large LCD display
(128 x 64) for menus and error messages and a modu-
lar, detachable socket assembly to support various
package types. The ICSP cable assembly is included
as a standard item. In Stand-Alone mode, the MPLAB
PM3 Device Programmer can read, verify and program
PIC devices without a PC connection. It can also set
code protection in this mode. The MPLAB PM3
connects to the host PC via an RS-232 or USB cable.
The MPLAB PM3 has high-speed communications and
optimized algorithms for quick programming of large
memory devices and incorporates an SD/MMC card for
file storage and secure data applications.
PIC12F508/509/16F505
DS41236E-page 68 2009 Microchip Technology Inc.
9.11 PICSTART Plus Development
Programmer
The PICSTART Plus Development Programmer is an
easy-to-use, low-cost, prototype programmer. It
connects to the PC via a COM (RS-232) port. MPLAB
Integrated Development Environment software makes
using the programmer simple and efficient. The
PICSTART Plus Development Programmer supports
most PIC devices in DIP packages up to 40 pins.
Larger pin count devices, such as the PIC16C92X and
PIC17C76X, may be supported with an adapter socket.
The PICSTART Plus Development Programmer is CE
compliant.
9.12 PICkit 2 Development Programmer
The PICkit 2 Development Programmer is a low-cost
programmer and selected Flash device debugger with
an easy-to-use interface for programming many of
Microchips baseline, mid-range and PIC18F families
of Flash memory microcontrollers. The PICkit 2 Starter
Kit includes a prototyping development board, twelve
sequential lessons, software and HI-TECHs PICC
Lite C compiler, and is designed to help get up to speed
quickly using PIC
, PowerSmart
battery management, SEEVAL
evaluation system,
Sigma-Delta ADC, flow rate sensing, plus many more.
Check the Microchip web page (www.microchip.com)
for the complete list of demonstration, development
and evaluation kits.
2009 Microchip Technology Inc. DS41236E-page 69
PIC12F508/509/16F505
10.0 ELECTRICAL CHARACTERISTICS
Absolute Maximum Ratings
()
Ambient temperature under bias.......................................................................................................... -40C to +125C
Storage temperature ............................................................................................................................ -65C to +150C
Voltage on VDD with respect to VSS ............................................................................................................... 0 to +6.5V
Voltage on MCLR with respect to VSS.......................................................................................................... 0 to +13.5V
Voltage on all other pins with respect to VSS ............................................................................... -0.3V to (VDD + 0.3V)
Total power dissipation
(1)
.................................................................................................................................. 800 mW
Max. current out of VSS pin ................................................................................................................................ 200 mA
Max. current into VDD pin................................................................................................................................... 150 mA
Input clamp current, IIK (VI < 0 or VI > VDD)................................................................................................................... 20 mA
Output clamp current, IOK (VO < 0 or VO > VDD) ........................................................................................................... 20 mA
Max. output current sunk by any I/O pin .............................................................................................................. 25 mA
Max. output current sourced by any I/O pin......................................................................................................... 25 mA
Max. output current sourced by I/O port .............................................................................................................. 75 mA
Max. output current sunk by I/O port ................................................................................................................... 75 mA
Note 1: Power dissipation is calculated as follows: PDIS = VDD x {IDD IOH} + {(VDD VOH) x IOH} + (VOL x IOL)
NOTICE: Stresses above those listed under Absolute Maximum Ratings may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at those or any other conditions above
those indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions
for extended periods may affect device reliability.
PIC12F508/509/16F505
DS41236E-page 70 2009 Microchip Technology Inc.
FIGURE 10-1: PIC12F508/509/16F505 VOLTAGE-FREQUENCY GRAPH, -40C TA +125C
FIGURE 10-2: MAXIMUM OSCILLATOR FREQUENCY TABLE
6.0
2.5
4.0
3.0
0
3.5
4.5
5.0
5.5
4 10
Frequency (MHz)
VDD
20
(Volts)
25
2.0
8
(PIC16F505 only)
0 200 kHz 4 MHz 20 MHz
Frequency (MHz)
HS
(1)
EXTRC
XT
LP
O
s
c
i
l
l
a
t
o
r
M
o
d
e
EC
(1)
INTOSC
Note 1: For PIC16F505 only.
2009 Microchip Technology Inc. DS41236E-page 71
PIC12F508/509/16F505
10.1 DC Characteristics: PIC12F508/509/16F505 (Industrial)
DC Characteristics
Standard Operating Conditions (unless otherwise specified)
Operating Temperature -40C TA +85C (industrial)
Param
No.
Sym. Characteristic Min. Typ
(1)
Max. Units Conditions
D001 VDD Supply Voltage 2.0 5.5 V See Figure 10-1
D002 VDR RAM Data Retention Voltage
(2)
1.5* V Device in Sleep mode
D003 VPOR VDD Start Voltage to ensure
Power-on Reset
Vss V See Section 7.4 "Power-on
Reset (POR)" for details
D004 SVDD VDD Rise Rate to ensure
Power-on Reset
0.05* V/ms See Section 7.4 "Power-on
Reset (POR)" for details
D010 IDD Supply Current
(3,4)
175
0.625
275
1.1
A
mA
FOSC = 4 MHz, VDD = 2.0V
FOSC = 4 MHz, VDD = 5.0V
500
1.5
650
2.2
A
mA
FOSC = 10 MHz, VDD = 3.0V
FOSC = 20 MHz, VDD = 5.0V
(PIC16F505 only)
11
38
20
54
A
A
FOSC = 32 kHz, VDD = 2.0V
FOSC = 32 kHz, VDD = 5.0V
D020 IPD Power-down Current
(5)
0.1
0.35
1.2
2.4
A
A
VDD = 2.0V
VDD = 5.0V
D022 IWDT WDT Current
(5)
1.0
7.0
3.0
16.0
A
A
VDD = 2.0V
VDD = 5.0V
* These parameters are characterized but not tested.
Note 1: Data in the Typical (Typ) column is based on characterization results at 25C. This data is for design
guidance only and is not tested.
2: This is the limit to which VDD can be lowered in Sleep mode without losing RAM data.
3: The supply current is mainly a function of the operating voltage and frequency. Other factors such as bus
loading, oscillator type, bus rate, internal code execution pattern and temperature also have an impact on
the current consumption.
4: The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VSS, T0CKI = VDD, MCLR =
VDD; WDT enabled/disabled as specified.
5: For standby current measurements, the conditions are the same as IDD, except that the device is in Sleep
mode. If a module current is listed, the current is for that specific module enabled and the device in Sleep.
PIC12F508/509/16F505
DS41236E-page 72 2009 Microchip Technology Inc.
10.2 DC Characteristics: PIC12F508/509/16F505 (Extended)
DC Characteristics
Standard Operating Conditions (unless otherwise specified)
Operating Temperature -40C TA +125C (extended)
Param
No.
Sym. Characteristic Min. Typ
(1)
Max. Units Conditions
D001 VDD Supply Voltage 2.0 5.5 V See Figure 10-1
D002 VDR RAM Data Retention Voltage
(2)
1.5* V Device in Sleep mode
D003 VPOR VDD Start Voltage to ensure
Power-on Reset
Vss V See Section 7.4 "Power-on
Reset (POR)" for details
D004 SVDD VDD Rise Rate to ensure
Power-on Reset
0.05* V/ms See Section 7.4 "Power-on
Reset (POR)" for details
D010 IDD Supply Current
(3,4)
175
0.625
275
1.1
A
mA
FOSC = 4 MHz, VDD = 2.0V
FOSC = 4 MHz, VDD = 5.0V
500
1.5
650
2.2
A
mA
FOSC = 10 MHz, VDD = 3.0V
FOSC = 20 MHz, VDD = 5.0V
(PIC16F515 only)
11
38
26
110
A
A
FOSC = 32 kHz, VDD = 2.0V
FOSC = 32 kHz, VDD = 5.0V
D020 IPD Power-down Current
(5)
0.1
0.35
9.0
15.0
A
A
VDD = 2.0V
VDD = 5.0V
D022 IWDT WDT Current
(5)
1.0
7.0
18
22
A
A
VDD = 2.0V
VDD = 5.0V
* These parameters are characterized but not tested.
Note 1: Data in the Typical (Typ) column is based on characterization results at 25C. This data is for design
guidance only and is not tested.
2: This is the limit to which VDD can be lowered in Sleep mode without losing RAM data.
3: The supply current is mainly a function of the operating voltage and frequency. Other factors such as bus
loading, oscillator type, bus rate, internal code execution pattern and temperature also have an impact on
the current consumption.
4: The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VSS, T0CKI = VDD, MCLR =
VDD; WDT enabled/disabled as specified.
5: For standby current measurements, the conditions are the same as IDD, except that the device is in Sleep
mode. If a module current is listed, the current is for that specific module enabled and the device in Sleep.
2009 Microchip Technology Inc. DS41236E-page 73
PIC12F508/509/16F505
TABLE 10-1: DC CHARACTERISTICS: PIC12F508/509/16F505 (Industrial, Extended)
DC CHARACTERISTICS
Standard Operating Conditions (unless otherwise specified)
Operating temperature -40C TA +85C (industrial)
-40C TA +125C (extended)
Operating voltage VDD range as described in DC specification
Param
No.
Sym. Characteristic Min. Typ Max. Units Conditions
VIL Input Low Voltage
I/O ports:
D030 with TTL buffer Vss 0.8V V For all 4.5 VDD 5.5V
D030A Vss 0.15 VDD V Otherwise
D031 with Schmitt Trigger buffer Vss 0.15 VDD V
D032 MCLR, T0CKI Vss 0.15 VDD V
D033 OSC1 (in EXTRC) Vss 0.15 VDD V (Note1)
D033 OSC1 (in HS) Vss 0.3 VDD V (Note1)
D033 OSC1 (in XT and LP) Vss 0.3 V (Note1)
VIH Input High Voltage
I/O ports:
D040 with TTL buffer 2.0 VDD V 4.5 VDD 5.5V
D040A 0.25 VDD
+ 0.8
VDD V Otherwise
D041 with Schmitt Trigger buffer 0.85 VDD VDD V For entire VDD range
D042 MCLR, T0CKI 0.85 VDD VDD V
D043 OSC1 (in EXTRC) 0.85 VDD VDD V (Note1)
D043 OSC1 (in HS) 0.7 VDD VDD V (Note1)
D043 OSC1 (in XT and LP) 1.6 VDD V
D070 IPUR GPIO/PORTB weak pull-up
current
(4)
50 250 400 A VDD = 5V, VPIN = VSS
IIL Input Leakage Current
(2), (3)
D060 I/O ports 1 A Vss VPIN VDD, Pin at high-impedance
D061 GP3/RB3/MCLRI
(5)
0.7 5 A Vss VPIN VDD
D063 OSC1 5 A Vss VPIN VDD, XT, HS and LP oscillator
configuration
Output Low Voltage
D080 I/O ports/CLKOUT 0.6 V IOL = 8.5 mA, VDD = 4.5V, -40C to +85C
D080A 0.6 V IOL = 7.0 mA, VDD = 4.5V, -40C to +125C
D083 OSC2 0.6 V IOL = 1.6 mA, VDD = 4.5V, -40C to +85C
D083A 0.6 V IOL = 1.2 mA, VDD = 4.5V, -40C to +125C
Output High Voltage
D090 I/O ports/CLKOUT
(3)
VDD 0.7 V IOH = -3.0 mA, VDD = 4.5V, -40C to +85C
D090A VDD 0.7 V IOH = -2.5 mA, VDD = 4.5V, -40C to +125C
D092 OSC2 VDD 0.7 V IOH = -1.3 mA, VDD = 4.5V, -40C to +85C
D092A VDD 0.7 V IOH = -1.0 mA, VDD = 4.5V, -40C to +125C
Capacitive Loading Specs on
Output Pins
D100 OSC2 pin 15 pF In XT, HS and LP modes when external clock is
used to drive OSC1.
D101 All I/O pins and OSC2 50 pF
Data in Typ column is at 5V, 25C unless otherwise stated. These parameters are for design guidance only and are not tested.
Note 1: In EXTRC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended that the PIC12F508/509/
16F505 be driven with external clock in RC mode.
2: The leakage current on the MCLR pin is strongly dependent on the 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: The specification applies to all weak pull-up devices, including the weak pull-up on GP3/MCLR. The current listed will be the same
whether GP3/MCLR is configured as GP3 with a weak pull-up or enabled as MCLR.
5: This specification applies when GP3/RB3/MCLR is configured as an input with pull-up disabled. The leakage current of the MCLR circuit
is higher than the standard I/O logic.
PIC12F508/509/16F505
DS41236E-page 74 2009 Microchip Technology Inc.
TABLE 10-2: PULL-UP RESISTOR RANGES PIC12F508/509/16F505
VDD (Volts) Temperature (C) Min. Typ. Max.
GP0(RBO)/GP1(RB1)
2.0 40 73K 105K 186K
25 73K 113K 187K
85 82K 123K 190K
125 86K 132k 190K
5.5 40 15K 21K 33K
25 15K 22K 34K
85 19K 26k 35K
125 23K 29K 35K
GP3(RB3)
2.0 40 63K 81K 96K
25 77K 93K 116K
85 82K 96k 116K
125 86K 100K 119K
5.5 40 16K 20k 22K
25 16K 21K 23K
85 24K 25k 28K
125 26K 27K 29K
* These parameters are characterized but not tested.
2009 Microchip Technology Inc. DS41236E-page 75
PIC12F508/509/16F505
10.3 Timing Parameter Symbology and Load Conditions PIC12F508/509/16F505
The timing parameter symbols have been created following one of the following formats:
FIGURE 10-3: LOAD CONDITIONS PIC12F508/509/16F505
FIGURE 10-4: EXTERNAL CLOCK TIMING PIC12F508/509/16F505
1. TppS2ppS
2. TppS
T
F Frequency T Time
Lowercase subscripts (pp) and their meanings:
pp
2 to mc MCLR
ck CLKOUT osc Oscillator
cy Cycle time os OSC1
drt Device Reset Timer t0 T0CKI
io I/O port wdt Watchdog Timer
Uppercase letters and their meanings:
S
F Fall P Period
H High R Rise
I Invalid (high-impedance) V Valid
L Low Z High-impedance
CL
VSS
pin
Legend:
CL = 50 pF for all pins except OSC2
15 pF for OSC2 in XT, HS or LP
modes when external clock
is used to drive OSC1
OSC1
Q4 Q1 Q2 Q3 Q4 Q1
1 3 3
4 4
2
PIC12F508/509/16F505
DS41236E-page 76 2009 Microchip Technology Inc.
TABLE 10-3: EXTERNAL CLOCK TIMING REQUIREMENTS PIC12F508/509/16F505
AC CHARACTERISTICS
Standard Operating Conditions (unless otherwise specified)
Operating Temperature -40C TA +85C (industrial),
-40C TA +125C (extended)
Operating Voltage VDD range is described in Section 10.1 "Power-
on Reset (POR)"
Param
No.
Sym. Characteristic Min. Typ
(1)
Max. Units Conditions
1A FOSC External CLKIN Frequency
(2)
DC 4 MHz XT Oscillator mode
DC 20 MHz EC, HS Oscillator mode
(PIC16F505 only)
DC 200 kHz LP Oscillator mode
Oscillator Frequency
(2)
4 MHz EXTRC Oscillator mode
0.1 4 MHz XT Oscillator mode
4 20 MHz HS Oscillator mode (PIC16F505
only)
200 kHz LP Oscillator mode
1 TOSC External CLKIN Period
(2)
250 ns XT Oscillator mode
50 ns EC, HS Oscillator mode
(PIC16F505 only)
5 s LP Oscillator mode
Oscillator Period
(2)
250 ns EXTRC Oscillator mode
250 10,000 ns XT Oscillator mode
50 250 ns HS Oscillator mode (PIC16F505
only)
5 s LP Oscillator mode
2 TCY Instruction Cycle Time 200 4/FOSC ns
3 TosL,
TosH
Clock in (OSC1) Low or High
Time
50* ns XT Oscillator
2* s LP Oscillator
10* ns EC, HS Oscillator
(PIC16F505 only)
4 TosR,
TosF
Clock in (OSC1) Rise or Fall
Time
25* ns XT Oscillator
50* ns LP Oscillator
15* ns EC, HS Oscillator
(PIC16F505 only)
* These parameters are characterized but not tested.
Note 1: Data in the Typical (Typ) column is at 5V, 25C unless otherwise stated. These parameters are for
design guidance only and are not tested.
2: All specified values are based on characterization data for that particular oscillator type under standard
operating conditions with the device executing code. Exceeding these specified limits may result in an
unstable oscillator operation and/or higher than expected current consumption. When an external clock
input is used, the max cycle time limit is DC (no clock) for all devices.
2009 Microchip Technology Inc. DS41236E-page 77
PIC12F508/509/16F505
TABLE 10-4: CALIBRATED INTERNAL RC FREQUENCIES PIC12F508/509/16F505
FIGURE 10-5: I/O TIMING PIC12F508/509/16F505
AC CHARACTERISTICS
Standard Operating Conditions (unless otherwise specified)
Operating Temperature -40C TA +85C (industrial),
-40C TA +125C (extended)
Param
No.
Sym. Characteristic
Freq
Tolerance
Min. Typ Max. Units Conditions
F10 FOSC Internal Calibrated
INTOSC Frequency
(1)
1% 3.96 4.00 4.04 MHz VDD = 3.5V, TA = 25C
2% 3.92 4.00 4.08 MHz 2.5V VDD 5.5V
0C TA +85C
5% 3.80 4.00 4.20 MHz 2.0V VDD 5.5V
-40C TA +85C (Ind.)
-40C TA +125C (Ext.)
* These parameters are characterized but not tested.
Data in the Typical (Typ) column is at 5V, 25C unless otherwise stated. These parameters are for
design guidance only and are not tested.
Note 1: To ensure these oscillator frequency tolerances, VDD and VSS must be capacitively decoupled as close to
the device as possible. 0.1 uF and 0.01 uF values in parallel are recommended.
OSC1
I/O Pin
(input)
I/O Pin
(output)
Q4 Q1 Q2 Q3
17
20, 21
18
Old Value New Value
19
Note: All tests must be done with specified capacitive loads (see data sheet) 50 pF on I/O pins and CLKOUT.
PIC12F508/509/16F505
DS41236E-page 78 2009 Microchip Technology Inc.
TABLE 10-5: TIMING REQUIREMENTS PIC12F508/509/16F505
FIGURE 10-6: RESET, WATCHDOG TIMER AND DEVICE RESET TIMER TIMING
PIC12F508/509/16F505
AC
CHARACTERISTICS
Standard Operating Conditions (unless otherwise specified)
Operating Temperature -40C TA +85C (industrial)
-40C TA +125C (extended)
Operating Voltage VDD range is described in Section 10.1 "Power-on Reset (POR)"
Param
No.
Sym. Characteristic Min. Typ
(1)
Max. Units
17 TOSH2IOV OSC1 (Q1 cycle) to Port Out Valid
(2), (3)
100* ns
18 TOSH2IOI OSC1 (Q2 cycle) to Port Input Invalid (I/O in hold time)
(2)
50 ns
19 TIOV2OSH Port Input Valid to OSC1 (I/O in setup time) 20 ns
20 TIOR Port Output Rise Time
(3)
10 25** ns
21 TIOF Port Output Fall Time
(3)
10 25** ns
* These parameters are characterized but not tested.
** These parameters are design targets and are not tested.
Note 1: Data in the Typical (Typ) column is at 5V, 25C unless otherwise stated. These parameters are for design
guidance only and are not tested.
2: Measurements are taken in EXTRC mode.
3: See Figure 10-3 for loading conditions.
VDD
MCLR
Internal
POR
DRT
Timeout
(2)
Internal
Reset
Watchdog
Timer
Reset
32
31
34
I/O pin
(1)
32 32
34
30
Note 1: I/O pins must be taken out of High-Impedance mode by enabling the output drivers in software.
2: Runs in MCLR or WDT Reset only in XT, LP and HS (PIC16F505) modes.
2009 Microchip Technology Inc. DS41236E-page 79
PIC12F508/509/16F505
TABLE 10-6: RESET, WATCHDOG TIMER AND DEVICE RESET TIMER PIC12F508/509/16F505
AC CHARACTERISTICS
Standard Operating Conditions (unless otherwise specified)
Operating Temperature -40C TA +85C (industrial)
-40C TA +125C (extended)
Param
No.
Sym. Characteristic Min. Typ
(1)
Max. Units Conditions
30 TMCL MCLR Pulse Width (low) 2000* ns VDD = 5.0V
31 TWDT Watchdog Timer Time-out Period
(no prescaler)
9*
9*
18*
18*
30*
40*
ms
ms
VDD = 5.0V (Industrial)
VDD = 5.0V (Extended)
32 TDRT Device Reset Timer Period
(2)
9*
9*
18*
18*
30*
40*
ms
ms
VDD = 5.0V (Industrial)
VDD = 5.0V (Extended)
34 TIOZ I/O High-impedance from MCLR
low
2000* ns
* These parameters are characterized but not tested.
Note 1: Data in the Typical (Typ) column is at 5V, 25C unless otherwise stated. These parameters are for
design guidance only and are not tested.
PIC12F508/509/16F505
DS41236E-page 80 2009 Microchip Technology Inc.
FIGURE 10-7: TIMER0 CLOCK TIMINGS PIC12F508/509/16F505
TABLE 10-7: TIMER0 CLOCK REQUIREMENTS PIC12F508/509/16F505
AC CHARACTERISTICS
Standard Operating Conditions (unless otherwise specified)
Operating Temperature -40C TA +85C (industrial)
-40C TA +125C (extended)
Operating Voltage VDD range is described in
Section 10.1 "Power-on Reset (POR)"
Param
No.
Sym. Characteristic Min. Typ
(1)
Max. Units Conditions
40 Tt0H T0CKI High Pulse
Width
No Prescaler 0.5 TCY + 20* ns
With Prescaler 10* ns
41 Tt0L T0CKI Low Pulse
Width
No Prescaler 0.5 TCY + 20* ns
With Prescaler 10* ns
42 Tt0P T0CKI Period 20 or TCY + 40* N ns Whichever is greater.
N = Prescale Value
(1, 2, 4,..., 256)
* These parameters are characterized but not tested.
Note 1: Data in the Typical (Typ) column is at 5V, 25C unless otherwise stated. These parameters are for design
guidance only and are not tested.
T0CKI
40 41
42
2009 Microchip Technology Inc. DS41236E-page 81
PIC12F508/509/16F505
11.0 DC AND AC CHARACTERISTICS GRAPHS AND CHARTS
Typical represents the mean of the distribution at 25C. Maximum or minimum represents (mean + 3) or (mean -
3) respectively, where s is a standard deviation, over each temperature range.
FIGURE 11-1: IDD vs. VDD at FOSC = 4 MHz
Note: The graphs and tables provided following this note are a statistical summary based on a limited number of
samples and are provided for informational purposes only. The performance characteristics listed herein are
not tested or guaranteed. In some graphs or tables, the data presented may be outside the specified
operating range (e.g., outside specified power supply range) and therefore, outside the warranted range.
0
200
400
600
800
1,000
1,200
1,400
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
I
D
D
(
A
)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
4 MHz
4 MHz
Maximum
Typical
PIC12F508/509/16F505
DS41236E-page 82 2009 Microchip Technology Inc.
FIGURE 11-2: IDD VS. FOSC Over VDD (HS MODE, PIC16F505 only)
FIGURE 11-3: TYPICAL IPD vs. VDD (SLEEP MODE, ALL PERIPHERALS DISABLED)
3.00
2.50
2.00
1.50
1.00
0.50
0.00
5 10 15 20 25
Max. 5V
Typical 5V
Max. 3V
Typical 3V
Fosc (MHz)
I
D
D
(
m
A
)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
Typical
(Sleep Mode all Peripherals Disabled)
0.0
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
0.45
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
I
P
D
(
A
)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
2009 Microchip Technology Inc. DS41236E-page 83
PIC12F508/509/16F505
FIGURE 11-4: MAXIMUM IPD vs. VDD (SLEEP MODE, ALL PERIPHERALS DISABLED)
FIGURE 11-5: TYPICAL WDT IPD vs. VDD
Maximum
(Sleep Mode all Peripherals Disabled)
Max. 125C
Max. 85C
0.0
2.0
4.0
6.0
8.0
10.0
12.0
14.0
16.0
18.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
I
P
D
(
A
)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
0
1
2
3
4
5
6
7
8
9
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
I
P
D
(
A
)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
PIC12F508/509/16F505
DS41236E-page 84 2009 Microchip Technology Inc.
FIGURE 11-6: MAXIMUM WDT IPD vs. VDD OVER TEMPERATURE
FIGURE 11-7: WDT TIME-OUT or DEVICE RESET TIMER vs. VDD OVER TEMPERATURE (NO
WDT PRESCALER)
(1)
Maximum
Max. 125C
Max. 85C
0.0
5.0
10.0
15.0
20.0
25.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
I
P
D
(
A
)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
0
5
10
15
20
25
30
35
40
45
50
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
T
i
m
e
(
m
s
)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
Max. 125C
Max. 85C
Typical. 25C
Min. -40C
Note 1: Device Reset Timer (DRT) values are for case of Reset of power-up. Table 7-6 shows DRT values for
the case of other types of Reset events.
2009 Microchip Technology Inc. DS41236E-page 85
PIC12F508/509/16F505
FIGURE 11-8: VOL vs. IOL OVER TEMPERATURE (VDD = 3.0V)
FIGURE 11-9: VOL vs. IOL OVER TEMPERATURE (VDD = 5.0V)
(VDD = 3V, -40C TO 125C)
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0
IOL (mA)
V
O
L
(
V
)
Max. 85C
Max. 125C
Typical 25C
Min. -40C
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
0.45
5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0
IOL (mA)
V
O
L
(
V
)
Typical: Statistical Mean @25C
Maximum: Meas + 3 (-40C to 125C)
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
Max. 85C
Typ. 25C
Min. -40C
Max. 125C
PIC12F508/509/16F505
DS41236E-page 86 2009 Microchip Technology Inc.
FIGURE 11-10: VOH vs. IOH OVER TEMPERATURE (VDD = 3.0V)
FIGURE 11-11: VOH vs. IOH OVER TEMPERATURE (VDD = 5.0V)
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
-4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0
IOH (mA)
V
O
H
(
V
)
Typ. 25C
Max. -40C
Min. 125C
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
( , )
3.0
3.5
4.0
4.5
5.0
5.5
-5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0
IOH (mA)
V
O
H
(
V
)
Max. -40C
Typ. 25C
Min. 125C
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
2009 Microchip Technology Inc. DS41236E-page 87
PIC12F508/509/16F505
FIGURE 11-12: TTL INPUT THRESHOLD VIN vs. VDD
FIGURE 11-13: SCHMITT TRIGGER INPUT THRESHOLD VIN vs. VDD
(TTL Input, -40C TO 125C)
0.5
0.7
0.9
1.1
1.3
1.5
1.7
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
V
I
N
(
V
) Typ. 25C
Max. -40C
Min. 125C
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
(ST Input, -40C TO 125C)
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
V
I
N
(
V
)
VIH Max. 125C
VIH Min. -40C
VIL Min. 125C
VIL Max. -40C
Typical: Statistical Mean @25C
Maximum: Mean (Worst-Case Temp) + 3
(-40C to 125C)
PIC12F508/509/16F505
DS41236E-page 88 2009 Microchip Technology Inc.
FIGURE 11-14: TYPICAL INTOSC FREQUENCY CHANGE vs VDD (25C)
FIGURE 11-15: TYPICAL INTOSC FREQUENCY CHANGE vs VDD (-40C)
-5
-4
-3
-2
-1
0
1
2
3
4
5
2 2.5 3 3.5 4 4.5 5 5.5
VDD (V)
C
h
a
n
g
e
f
r
o
m
C
a
l
i
b
r
a
t
i
o
n
(
%
)
2 2.5 3 3.5 4 4.5 5 5.5
4
5
3
2
1
0
-1
-2
-3
-4
-5
-5
-4
-3
-2
-1
0
1
2
3
4
5
2 2.5 3 3.5 4 4.5 5 5.5
C
h
a
n
g
e
f
r
o
m
C
a
l
i
b
r
a
t
i
o
n
(
%
)
VDD (V)
2 2.5 3 3.5 4 4.5 5 5.5
4
5
3
2
1
0
-1
-2
-3
-4
-5
2009 Microchip Technology Inc. DS41236E-page 89
PIC12F508/509/16F505
FIGURE 11-16: TYPICAL INTOSC FREQUENCY CHANGE vs VDD (85C)
FIGURE 11-17: TYPICAL INTOSC FREQUENCY CHANGE vs VDD (125C
-5
-4
-3
-2
-1
0
1
2
3
4
5
2 2.5 3 3.5 4 4.5 5 5.5
C
h
a
n
g
e
f
r
o
m
C
a
l
i
b
r
a
t
i
o
n
(
%
)
VDD (V)
4
5
3
2
1
0
-1
-2
-3
-4
-5
2 2.5 3 3.5 4 4.5 5 5.5
-5
-4
-3
-2
-1
0
1
2
3
4
5
2 2.5 3 3.5 4 4.5 5 5.5
VDD (V)
C
h
a
n
g
e
f
r
o
m
C
a
l
i
b
r
a
t
i
o
n
(
%
)
2 2.5 3 3.5 4 4.5 5 5.5
4
5
3
2
1
0
-1
-2
-3
-4
-5
PIC12F508/509/16F505
DS41236E-page 90 2009 Microchip Technology Inc.
NOTES:
2009 Microchip Technology Inc. DS41236E-page 91
PIC12F508/509/16F505
12.0 PACKAGING INFORMATION
12.1 Package Marking Information
8-Lead SOIC (3.90 mm)
XXXXXXXX
XXXXYYWW
NNN
Example
12F509-I
/SN 0610
017
8-Lead MSOP
XXXXXX
YWWNNN
Example
12F509
0610017
3 e
X X X
Y W W
N N
8-Lead 2x3 DFN*
B E Q
6 1 0
1 7
Example
XXXXXNNN
8-Lead PDIP
XXXXXXXX
YYWW
/P 017
Example
12F508-I
0610
3 e
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 PIC
device marking consists of Microchip part number, year code, week code, and traceability
code. For PIC 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.
Legend: XX...X Customer-specific information
Y Year code (last digit of calendar year)
YY Year code (last 2 digits of calendar year)
WW Week code (week of January 1 is week 01)
NNN Alphanumeric traceability code
Pb-free JEDEC designator for Matte Tin (Sn)
* This package is Pb-free. The Pb-free JEDEC designator ( )
can be found on the outer packaging for this package.
3 e
3 e
PIC12F508/509/16F505
DS41236E-page 92 2009 Microchip Technology Inc.
12.1 Package Marking Information (Continued)
XXXXXXXXXXXXXX
XXXXXXXXXXXXXX
YYWWNNN
14-Lead PDIP (300 mil)
14-Lead SOIC (3.90 mm)
XXXXXXXXXXX
YYWWNNN
Example
PIC16F505-E
0610017
XXXXXXXXXXX
14-Lead TSSOP (4.4 mm)
XXXXXXXX
YYWW
Example
16F505-I
0610
NNN 017
/SL0125
Example
PIC16F505
0610017
0215 3 e -I/P
TABLE 12-1: 8-LEAD 2X3 DFN (MC) TOP MARKING
Part Number Marking
PIC12F508 (T) - I/MC BN0
PIC12F508-E/MC BP0
PIC12F509 (T) - I/MC BQ0
PIC12F509-E/MC BR0
XXXXXXX
16-Lead QFN
XXXXXXX
YYWWNNN
16F505
Example
-I/MG
0610017
2009 Microchip Technology Inc. DS41236E-page 93
PIC12F508/509/16F505
8-Lead PIastic DuaI In-Line (P) - 300 miI Body [PDIP]
Notes:
1. Pin 1 visual index feature may vary, but must be located with the hatched area.
2. Significant Characteristic.
3. Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed .010" per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Units NCHES
Dimension Limits MN NOM MAX
Number of Pins N 8
Pitch e .100 BSC
Top to Seating Plane A .210
Molded Package Thickness A2 .115 .130 .195
Base to Seating Plane A1 .015
Shoulder to Shoulder Width E .290 .310 .325
Molded Package Width E1 .240 .250 .280
Overall Length D .348 .365 .400
Tip to Seating Plane L .115 .130 .150
Lead Thickness c .008 .010 .015
Upper Lead Width b1 .040 .060 .070
Lower Lead Width b .014 .018 .022
Overall Row Spacing eB .430
N
E1
NOTE 1
D
1 2 3
A
A1
A2
L
b1
b
e
E
eB
c
Microchip Technology Drawing C04-018B
PIC12F508/509/16F505
DS41236E-page 94 2009 Microchip Technology Inc.
8-Lead PIastic SmaII OutIine (SN) - Narrow, 3.90 mm Body [SOIC]
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Significant Characteristic.
3. Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed 0.15 mm per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Units MLLMETERS
Dimension Limits MN NOM MAX
Number of Pins N 8
Pitch e 1.27 BSC
Overall Height A 1.75
Molded Package Thickness A2 1.25
Standoff A1 0.10 0.25
Overall Width E 6.00 BSC
Molded Package Width E1 3.90 BSC
Overall Length D 4.90 BSC
Chamfer (optional) h 0.25 0.50
Foot Length L 0.40 1.27
Footprint L1 1.04 REF
Foot Angle I 0 8
Lead Thickness c 0.17 0.25
Lead Width b 0.31 0.51
Mold Draft Angle Top D 5 15
Mold Draft Angle Bottom E 5 15
D
N
e
E
E1
NOTE 1
1 2 3
b
A
A1
A2
L
L1
c
h
h