Microchip received ISO/TS-16949:2002 quality system certification for
its worldwide headquarters, design and wafer fabrication facilities in
Chandler and Tempe, Arizona and Mountain View, California in
October 2003. The Company’s quality system processes and
procedures are for its PICmicro
®
8-bit MCUs, K
EE
L
OQ
®
code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS41236A-page ii
Preliminary
2004 Microchip Technology Inc.
PIC12F508/509/16F505
8/14-Pin, 8-Bit Flash Microcontroller
Devices Included In This Data Sheet:
• PIC12F508
• PIC12F509
• PIC16F505
- LP:
- EC:
Power-saving, low-frequency crystal
High-speed external clock input
(PIC16F505 only)
Low-Power Features/CMOS Technology:
• Operating Current:
- < 350
µA
@ 2V, 4 MHz
• 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: -40°C to +85°C
- Extended: -40°C to +125°C
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
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
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-up 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)
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
2004 Microchip Technology Inc.
Preliminary
DS41236A-page 1
PIC12F508/509/16F505
Pin Diagrams
PDIP, SOIC, TSSOP
PDIP, SOIC, MSOP
V
DD
RB5/OSC1/CLKIN
RB4/OSC2/CLKOUT
RB3/MCLR/V
PP
RC5/T0CKI
RC4
RC3
1
2
PIC16F505
3
4
5
6
7
14
13
12
11
10
9
8
V
SS
RB0/ICSPDAT
RB1/ISCPCLK
RB2
RC0
RC1
RC2
PIC12F508/509
V
DD
GP5/OSC1/CLKIN
GP4/OSC2
GP3/MCLR/V
PP
1
2
3
4
8
7
6
5
V
SS
GP0/ICSPDAT
GP1/ICSPCLK
GP2/T0CKI
Program Memory
Device
Flash (words)
PIC12F508
PIC12F509
PIC16F505
512
1024
1024
Data Memory
I/O
SRAM (bytes)
25
41
72
6
6
12
Timers
8-bit
1
1
1
DS41236A-page 2
Preliminary
2004 Microchip Technology Inc.
PIC12F508/509/16F505
Table of Contents
1.0 General Description...................................................................................................................................................................... 5
5.0 I/O Port ....................................................................................................................................................................................... 29
6.0 Timer0 Module and TMR0 Register ........................................................................................................................................... 33
7.0 Special Features Of The CPU.................................................................................................................................................... 39
8.0 Instruction Set Summary ............................................................................................................................................................ 55
9.0 Development Support................................................................................................................................................................. 63
11.0 DC and AC Characteristics Graphs and Charts ......................................................................................................................... 81
Index .................................................................................................................................................................................................... 91
Systems Information and Upgrade Hot Line ........................................................................................................................................ 93
Product Identification System .............................................................................................................................................................. 95
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Micro-
chip 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
docerrors@mail.microchip.com
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:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
• The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (include lit-
erature 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.
[i=s]This post was last edited by jameswangsynnex on 2015-3-3 20:00[/i]TCP/IP is a necessary protocol for data transmission on the Internet. This network communication mode has been perfected between ...
Now there is a 100MHZ signal. It needs 74VHC164 frequency division. So does the signal need to add a pull-down resistor? I will order the board soon. Please let me know if you know....
[b][size=5][color=red]The analog interface is shown in the figure. I want to connect two wires SDA and SCL from the IIC bus on the computer motherboard to the P13 and P12 ports of the microcontroller ...
[i=s] This post was last edited by Shi Yu on 2016-10-31 16:36 [/i] Hi everyone, I am currently working on a high-speed signal acquisition project using socFPGA. The FPGA drives the AD chip to generate...
[i=s]This post was last edited by azxyqcr on 2019-9-16 10:36[/i]I recently purchased a set of AI vision module Visionseed. I plan to try out the Visionseed tool in Ubuntu to understand this vision mod...
Free TI Cortex M3/M4 emulator blank board, requires a high level of welding skills, interested parties please hurry, first come first served!The website for the gift is http://item.taobao.com/item.htm...
In
circuit design,
current
measurement
is widely used, and the main fields are divided into three categories: in measurement,
the electric meter
is used to measure the curre...[Details]
0 Introduction
With the development of my country's economy, the number of motor vehicles continues to increase. The growth of existing roads and other hardware facilities can no longer meet t...[Details]
Remote keyless entry (RKE) systems have become popular with users, with more than 80% of new cars in North America and more than 70% in Europe equipped with RKE systems. In addition to the obvious ...[Details]
introduction
In the discharge process of tokamak plasma physics, the study of rupture and sawtooth is of great significance. Rupture and sawtooth exist in most tokamaks. Rupture is a notew...[Details]
The Mobile Industry Processor Interface (MIPI) Alliance is an organization responsible for promoting the standardization of software and hardware in mobile devices. It has released the D-PHY specif...[Details]
The data collector of the automatic weather station is generally designed based on a single-chip microcomputer or a PC/104 bus controller. It has the characteristics of good compatibility with PC, low...[Details]
1 Introduction
Ultrasonic waves have strong directivity, slow energy consumption, and can propagate over long distances in a medium, so they are used for distance measurement. Ultrasonic detec...[Details]
Editor's note: In order to help technicians or engineers who have knowledge of PIC microcontroller assembly language quickly master the method of using C language to program PIC microcontrollers, t...[Details]
AD8205 is
a single-supply high-performance differential
amplifier
launched by
Analog
Devices of the United States
. The typical single-supply voltage is 5V, and its common-mode volta...[Details]
1. System Structure
This system is a simulation system of indoor air-conditioning temperature/humidity control system. The data acquisition and control center collects temperature/humidity...[Details]
Continuity test
A variety of devices need to be checked for continuity, including cable assemblies, printed circuit boards, and connectors to ensure that these components have the expected contin...[Details]
hint:
The number of speakers and their spacing limit the sound field of a portable stereo system.
Spatial audio attempts to artificially recreate the experience of listening to sounds i...[Details]
This article will introduce a design method for a distributed control system used in a tracking car, which can perform distributed control of motor modules, sensor modules, and lighting control mod...[Details]