Professional Documents
Culture Documents
30561C
30561C
30561C
PIC12C672
PIC12C671
• PIC12CE673 GP5/OSC1/CLKIN 2 7 GP0/AN0
• PIC12CE674 GP4/OSC2/AN3/
3 6 GP1/AN1/VREF
CLKOUT
GP3/MCLR/VPP 4 5 GP2/T0CKI/AN2/
Note: Throughout this data sheet PIC12C67X INT
refers to the PIC12C671, PIC12C672,
PIC12CE673 and PIC12CE674.
PIC12CE67X refers to PIC12CE673 and PDIP, Windowed CERDIP
PIC12CE674.
VSS
PIC12CE674
PIC12CE673
VDD 1 8
High-Performance RISC CPU: GP5/OSC1/CLKIN 2 7 GP0/AN0
GP4/OSC2/AN3/ GP1/AN1/VREF
• Only 35 single word instructions to learn 3 6
CLKOUT GP2/T0CKI/AN2/
GP3/MCLR/VPP 4 5
• All instructions are single cycle (400 ns) except for INT
program branches which are two-cycle
• Operating speed: DC - 10 MHz clock input
DC - 400 ns instruction cycle Special Microcontroller Features:
Memory • In-Circuit Serial Programming (ICSP™)
• Internal 4 MHz oscillator with programmable calibration
Device Data Data
Program • Selectable clockout
RAM EEPROM • Power-on Reset (POR)
PIC12C671 1024 x 14 128 x 8 — • Power-up Timer (PWRT) and Oscillator Start-up
PIC12C672 2048 x 14 128 x 8 — Timer (OST)
• Watchdog Timer (WDT) with its own on-chip RC
PIC12CE673 1024 x 14 128 x 8 16 x 8 oscillator for reliable operation
PIC12CE674 2048 x 14 128 x 8 16 x 8 • Programmable code protection
• 14-bit wide instructions • Power saving SLEEP mode
• 8-bit wide data path • Interrupt-on-pin change (GP0, GP1, GP3)
• Interrupt capability • Internal pull-ups on I/O pins (GP0, GP1, GP3)
• Special function hardware registers
• Internal pull-up on MCLR pin
• 8-level deep hardware stack
• Direct, indirect and relative addressing modes for • Selectable oscillator options:
data and instructions - INTRC: Precision internal 4 MHz oscillator
- EXTRC: External low-cost RC oscillator
Peripheral Features: - XT: Standard crystal/resonator
• Four-channel, 8-bit A/D converter - HS: High speed crystal/resonator
• 8-bit real time clock/counter (TMR0) with 8-bit - LP: Power saving, low frequency crystal
programmable prescaler CMOS Technology:
• 1,000,000 erase/write cycle EEPROM data • Low-power, high-speed CMOS EPROM/EEPROM
memory technology
• EEPROM data retention > 40 years
• Fully static design
• Wide operating voltage range 2.5V to 5.5V
• Commercial, Industrial and Extended
temperature ranges
• Low power consumption
< 2 mA @ 5V, 4 MHz
15 A typical @ 3V, 32 kHz
< 1 A typical standby current
All PIC12C67X devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high I/O current capability.
All PIC12C67X devices use serial programming with data pin GP0 and clock pin GP1.
13 8 GPIO
Data Bus
Program Counter
GP0/AN0
EPROM
GP1/AN1/VREF
Program
RAM GP2/T0CKI/AN2/INT
Memory 8 Level Stack 128 bytes GP3/MCLR/VPP
(13 bit) File GP4/OSC2/AN3/CLKOUT
Registers GP5/OSC1/CLKIN
Program 14
Bus RAM Addr (1) 9
SDA
SCL
Addr MUX
Instruction reg
Direct Addr 7 Indirect
8 Addr 16x8
EEPROM
FSR reg Data PIC12CE673
Memory PIC12CE674
STATUS reg
8
3 MUX
Power-up
Timer
Instruction Oscillator
Decode & Start-up Timer ALU
Control
Watchdog 8
Timer
OSC1/CLKIN Timing
Generation Power-on W reg
OSC2/CLKOUT Reset
Internal
4 MHz Clock Timer0
MCLR
VDD, VSS
A/D
I/O/P Buffer
Name DIP Pin # Description
Type Type
GP0/AN0 7 I/O TTL/ST Bi-directional I/O port/serial programming data/analog input 0.
Can be software programmed for internal weak pull-up and
interrupt-on-pin change. This buffer is a Schmitt Trigger input
when used in serial programming mode.
GP1/AN1/VREF 6 I/O TTL/ST Bi-directional I/O port/serial programming clock/analog input 1/
voltage reference. Can be software programmed for internal
weak pull-up and interrupt-on-pin change. This buffer is a
Schmitt Trigger input when used in serial programming mode.
GP2/T0CKI/AN2/INT 5 I/O ST Bi-directional I/O port/analog input 2. Can be configured as
T0CKI or external interrupt.
GP3/MCLR/VPP 4 I TTL/ST Input port/master clear (reset) input/programming voltage
input. 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. Can be software pro-
grammed for internal weak pull-up and interrupt-on-pin
change. Weak pull-up always on if configured as MCLR . This
buffer is Schmitt Trigger when in MCLR mode.
GP4/OSC2/AN3/CLKOUT 3 I/O TTL Bi-directional I/O port/oscillator crystal output/analog input 3.
Connections to crystal or resonator in crystal oscillator mode
(HS, XT and LP modes only, GPIO in other modes). In EXTRC
and INTRC modes, the pin output can be configured to CLK-
OUT, which has 1/4 the frequency of OSC1 and denotes the
instruction cycle rate.
GP5/OSC1/CLKIN 2 I/O TTL/ST Bi-directional IO port/oscillator crystal input/external clock
source input (GPIO in INTRC mode only, OSC1 in all other
oscillator modes). Schmitt trigger input for EXTRC oscillator
mode.
VDD 1 P — Positive supply for logic and I/O pins.
VSS 8 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.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Q1
Q2 Internal
phase
Q3 clock
Q4
PC PC PC+1 PC+2
OSC2/CLKOUT
(EXTRC and
INTRC modes) Fetch INST (PC)
Execute INST (PC-1) Fetch INST (PC+1)
Execute INST (PC) Fetch INST (PC+2)
Execute INST (PC+1)
All instructions are single cycle, except for any program branches. These take two cycles since the fetched
instruction is “flushed” from the pipeline while the new instruction is being fetched and then executed.
Stack Level 1 The register file can be accessed either directly or indi-
rectly through the File Select Register FSR
(Section 4.5).
Stack Level 8
On-Chip Program
Memory
03FFh
0400h
(PIC12C672 and
PIC12CE674 only) 07FFh
0800h
1FFFh
Bank 0
00h(1) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
04h(1) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
05h GPIO SCL(5) SDA(5) GP5 GP4 GP3 GP2 GP1 GP0 11xx xxxx 11uu uuuu
06h — Unimplemented — —
07h — Unimplemented — —
08h — Unimplemented — —
09h — Unimplemented — —
0Ah(1,2) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
0Bh(1) INTCON GIE PEIE T0IE INTE GPIE T0IF INTF GPIF 0000 000x 0000 000u
0Dh — Unimplemented — —
0Eh — Unimplemented — —
0Fh — Unimplemented — —
10h — Unimplemented — —
11h — Unimplemented — —
12h — Unimplemented — —
13h — Unimplemented — —
14h — Unimplemented — —
15h — Unimplemented — —
16h — Unimplemented — —
17h — Unimplemented — —
18h — Unimplemented — —
19h — Unimplemented — —
1Ah — Unimplemented — —
1Bh — Unimplemented — —
1Ch — Unimplemented — —
1Dh — Unimplemented — —
1Eh ADRES A/D Result Register xxxx xxxx uuuu uuuu
1Fh ADCON0 ADCS1 ADCS0 reserved CHS1 CHS0 GO/DONE reserved ADON 0000 0000 0000 0000
Bank 1
80h(1) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
81h OPTION GPPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
82h(1) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(1) (4) (4)
83h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 000q quuu
84h(1) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
85h TRIS — — GPIO Data Direction Register --11 1111 --11 1111
86h — Unimplemented — —
87h — Unimplemented — —
88h — Unimplemented — —
89h — Unimplemented — —
8Ah(1,2) PCLATH — — — Write Buffer for the upper 5 bits of the PC ---0 0000 ---0 0000
8Bh(1) INTCON GIE PEIE T0IE INTE GPIE T0IF INTF GPIF 0000 000x 0000 000u
8Dh — Unimplemented — —
8Fh OSCCAL CAL3 CAL2 CAL1 CAL0 CALFST CALSLW — — 0111 00-- uuuu uu--
90h — Unimplemented — —
91h — Unimplemented — —
92h — Unimplemented — —
93h — Unimplemented — —
94h — Unimplemented — —
95h — Unimplemented — —
96h — Unimplemented — —
97h — Unimplemented — —
98h — Unimplemented — —
99h — Unimplemented — —
9Ah — Unimplemented — —
9Bh — Unimplemented — —
9Ch — Unimplemented — —
9Dh — Unimplemented — —
9Eh — Unimplemented — —
Note: For borrow the polarity is reversed. A subtraction is executed by adding the two’s complement of the sec-
ond operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high or low order bit of
the source register.
This register contains the individual enable bits for the Note: Bit PEIE (INTCON<6>) must be set to
Peripheral interrupts. enable any peripheral interrupt.
not used
Data
Memory
7Fh 1FFh
Bank 0 Bank 1 Bank 2 Bank 3
For register file map detail see Figure 4-2.
Note 1: The RP1 and IRP bits are reserved; always maintain these bits clear.
GPPU
Data Bus
D Q VDD
VDD VDD
WR PORT
CK Q P
P I/O Pin
Data Latch
D Q
VSS VSS
WR TRIS
CK Q
TRIS Latch
Analog
Input TTL
Mode Input
Buffer
RD TRIS
Q D
EN
RD PORT
To A/D Converter
Data Bus
D Q
VDD VDD
WR PORT
CK Q
P I/O Pin
Data Latch
D Q
VSS VSS
WR TRIS
CK Q
TRIS Latch
Analog
Input Schmitt Trigger
Mode Input Buffer
RD TRIS
Q D
EN
RD PORT
GP2/INT
To A/D Converter
VDD
GPPU
MCLREN P Input Pin
VSS
MCLR
Schmitt Trigger
Input Buffer
Program Mode
HV Detect
TTL Input
Buffer
Data Bus
Q D
EN
RD PORT
RD TRIS VSS
GP3/INT(1)
VSS
INTRC/ VSS
D Q EXTRC
WR TRIS INTRC or EXTRC
CK Q w/o CLKOUT
TRIS Latch
Analog
Input TTL
Mode Input Buffer
RD TRIS
Q D
EN
RD PORT
To A/D Converter
To OSC2 Oscillator
Circuit
Data Bus
D Q
VDD VDD
WR PORT
EN Q
P
Data Latch
I/O Pin
N
D Q
TRIS Latch
INTRC
TTL
Input Buffer
RD TRIS
Q D
EN
RD PORT
85h TRIS — — GPIO Data Direction Register --11 1111 --11 1111
81h OPTION GPPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
03h STATUS (1) (1) RP0 TO PD Z DC C
IRP RP1 0001 1xxx 000q quuu
05h GPIO SCL(2) SDA(2) GP5 GP4 GP3 GP2 GP1 GP0 11xx xxxx 11uu uuuu
Legend: Shaded cells not used by Port Registers, read as ‘0’, — = unimplemented, read as '0', x = unknown, u = unchanged,
q = see tables in Section 9.4 for possible values.
Note 1: The IRP and RP1 bits are reserved on the PIC12C67X; always maintain these bits clear.
2: The SCL and SDA bits are unimplemented on the PIC12C671 and PIC12C672.
5.4 I/O Programming Considerations Example 5-1 shows the effect of two sequential read-
modify-write instructions on an I/O port.
5.4.1 BI-DIRECTIONAL I/O PORTS
VDD
Reset
To EEPROM SDA
Pad
D
EN P
Write CK Q
Data Bus GPIO
Output Latch
Q D
EN
CK
Schmitt Trigger
Input Latch
Read ltchpin
GPIO
VDD
D P To EEPROM SCL
Pad
EN
Write CK Q
Data Bus GPIO
Output Latch N
Q D
EN
CK
Schmitt Trigger
Read ltchpin
GPIO
SDA
Acknowledge
Bit
SCL 1 2 3 4 5 6 7 8 9 1 2 3
Transmitter must release the SDA line at this point Receiver must release the SDA line at this
allowing the Receiver to pull the SDA line low to point so the Transmitter can continue
acknowledge the previous eight bits of data. sending data.
Did EEPROM
NO
Acknowledge
(ACK = 0)?
YES
Next
Operation
SDA LINE P
ACTIVITY
A A A A N
C C C C O
K K K K
A
C
K
PC Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
(Program
Counter) PC-1 PC PC+1 PC+2 PC+3 PC+4 PC+5 PC+6
Instruction MOVWF TMR0 MOVF TMR0,WMOVF TMR0,WMOVF TMR0,WMOVF TMR0,WMOVF TMR0,W
Fetch
Instruction
Executed
Write TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0
executed reads NT0 reads NT0 reads NT0 reads NT0 + 1 reads NT0 + 2
PC Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
(Program
Counter) PC-1 PC PC+1 PC+2 PC+3 PC+4 PC+5 PC+6
Instruction
Execute Write TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0
executed reads NT0 reads NT0 reads NT0 reads NT0 reads NT0 + 1
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
CLKOUT(3)
GIE bit
(INTCON<7>)
INSTRUCTION
FLOW
PC PC PC +1 PC +1 0004h 0005h
Instruction
fetched Inst (PC) Inst (PC+1) Inst (0004h) Inst (0005h)
Instruction
Inst (PC-1) Inst (PC) Dummy cycle Dummy cycle Inst (0004h)
executed
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Small pulse
External Clock Input or misses sampling
Prescaler output(2)
(1)
(3)
External Clock/Prescaler
Output after sampling
Timer0 T0 T0 + 1 T0 + 2
Note 1: Delay from clock input change to Timer0 increment is 3TOSC to 7TOSC. (Duration of Q = TOSC). Therefore, the error
in measuring the interval between two edges on Timer0 input = ±4TOSC max.
2: External clock if no prescaler selected; prescaler output otherwise.
3: The arrows indicate the points in time where sampling occurs.
8
M 1
0
U M
GP2/T0CKI/ SYNC
AN2/INT X U
1 0 2 TMR0 reg
X Cycles
T0SE
T0CS
PSA Set flag bit T0IF
on Overflow
0
M 8-bit Prescaler
U
Watchdog 1 X 8
Timer
8 - to - 1MUX PS<2:0>
PSA
0 1
WDT Enable bit
MUX PSA
WDT
Time-out
CHS<1:0>
11
GP4/AN3
VIN
(Input voltage) 10
GP2/AN2
01
A/D GP1/AN1/VREF
Converter
00
GP0/AN0
VDD
VREF
(Reference
voltage)
PCFG<2:0>
Example 8-1 shows the calculation of the minimum TC = -CHOLD (RIC + RSS + RS) ln(1/512)
required acquisition time TACQ. This calculation is -51.2 pF (1 k + 7 k + 10 k) ln(0.0020)
based on the following system assumptions. -51.2 pF (18 k) ln(0.0020)
Rs = 10 k -0.921 s (-6.2146)
1/2 LSb error 5.724 s
VDD = 5V Rss = 7 k TACQ = 5 s + 5.724 s + [(50C - 25C)(0.05 s/C)]
Temp (system max.) = 50C 10.724 s + 1.25 s
VHOLD = 0 @ t = 0 11.974 s
VDD
Sampling
Switch
VT = 0.6V
Rs RAx RIC 1k SS Rss
CHOLD
VA CPIN I leakage = DAC capacitance
5 pF VT = 0.6V ± 500 nA = 51.2 pF
VSS
Device Frequency
AD Clock Source (TAD)
Yes
ADON = 0?
No
Acquire
Selected Channel
Yes
GO = 0?
No
A/D Clock
Yes Start of A/D SLEEP Yes Finish Conversion
Conversion Delayed Instruction? GO = 0
= RC? 1 Instruction Cycle ADIF = 1
No No
No No
Wait 2 TAD
Value on Value on
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Power-on all other
Reset Resets
0Bh/8Bh INTCON(1) GIE PEIE T0IE INTE GPIE T0IF INTF GPIF 0000 000x 0000 000u
0Ch PIR1 — ADIF — — — — — — -0-- ---- -0-- ----
1Fh ADCON0 ADCS1 ADCS0 reserved CHS1 CHS0 GO/DONE reserved ADON 0000 0000 0000 0000
05h GPIO SCL(2) SDA(2) GP5 GP4 GP3 GP2 GP1 GP0 11xx xxxx 11uu uuuu
85h TRIS — — TRIS5 TRIS4 TRIS3 TRIS2 TRIS1 TRIS0 --11 1111 --11 1111
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used for A/D conversion.
Note 1: These registers can be addressed from either bank.
2: The SCL (GP7) and SDA (GP6) bits are unimplemented on the PIC12C671/672 and read as ’0’.
Note 1: All of the CP<1:0> pairs have to be given the same value to enable the code protection scheme listed.
REXT Internal
Figure 9-4 shows a series resonant oscillator circuit. OSC1 clock
This circuit is also designed to use the fundamental
frequency of the crystal. The inverter performs a 180- N
degree phase shift in a series resonant oscillator CEXT PIC12C67X
circuit. The 330 resistors provide the negative VSS
feedback to bias the inverters in their linear region.
FOSC/4 OSC2/CLKOUT
FIGURE 9-4: EXTERNAL SERIES
RESONANT CRYSTAL
OSCILLATOR CIRCUIT
To Other
330 330 Devices
XTAL
Note: Please note that erasing the device will TABLE 9-3: CLKIN/CLKOUT PIN STATES
also erase the pre-programmed internal WHEN MCLR ASSERTED
calibration value for the internal oscillator.
The calibration value must be saved prior Oscillator Mode OSC1/CLKIN Pin OSC2/CLKout Pin
to erasing the part. EXTRC, CLKOUT OSC1 pin is OSC2 pin is driven
on OSC2 tristated and low
9.2.6 CLKOUT driven by external
circuit
The PIC12C67X can be configured to provide a clock EXTRC, OSC2 is OSC1 pin is OSC2 pin is
out signal (CLKOUT) on pin 3 when the configuration I/O tristated and tristate input
word address (2007h) is programmed with FOSC2, driven by external
FOSC1, and FOSC0, equal to 101 for INTRC or 111 for circuit
EXTRC. The oscillator frequency, divided by 4, can be INTRC, CLKOUT OSC1 pin is OSC2 pin is driven
used for test purposes or to synchronize other logic. on OSC2 tristate input low
INTRC, OSC2 is OSC1 pin is OSC2 pin is
I/O tristate input tristate input
Weak
Pull-up
GP3/MCLR/VPP Pin
MCLRE
INTERNAL MCLR
WDT SLEEP
Module
WDT Time-out
VDD rise
detect Power-on Reset
VDD
OST/PWRT
OST Chip_Reset
10-bit Ripple-counter R Q
OSC1/
CLKIN
Pin PWRT
On-chip(1)
RC OSC 10-bit Ripple-counter
Enable PWRT
See Table 9-4 for time-out situations.
Enable OST
Note 1: This is a separate oscillator from the RC oscillator of the CLKIN pin.
VDD
MCLR
INTERNAL POR
TPWRT
OST TIME-OUT
INTERNAL RESET
FIGURE 9-8: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 2
VDD
MCLR
INTERNAL POR
TPWRT
OST TIME-OUT
INTERNAL RESET
VDD
MCLR
INTERNAL POR
TPWRT
OST TIME-OUT
INTERNAL RESET
D 10k
R MCLR
R1 4.3k
MCLR PIC12C67X
C PIC12C67X
Q1
MCLR
R2 4.3k PIC12C67X
ADIF PEIE
ADIE
GIE
CLKOUT 3
4
INT pin
1
1
INTF flag 5 Interrupt Latency 2
(INTCON<1>)
GIE bit
(INTCON<7>)
INSTRUCTION FLOW
PC PC PC+1 PC+1 0004h 0005h
Instruction
fetched Inst (PC) Inst (PC+1) — Inst (0004h) Inst (0005h)
EXAMPLE 9-1: SAVING STATUS AND W REGISTERS USING GENERAL PURPOSE RAM
(0x20 - 0x6F)
MOVWF W_TEMP ;Copy W to TEMP register, could be bank one or zero
SWAPF STATUS,W ;Swap status to be saved into W
BCF STATUS,RP0 ;Change to bank zero, regardless of current bank
MOVWF STATUS_TEMP ;Save status to bank zero STATUS_TEMP register
:
:(ISR)
:
SWAPF STATUS_TEMP,W ;Swap STATUS_TEMP register into W
;(sets bank to original state)
MOVWF STATUS ;Move W into STATUS register
SWAPF W_TEMP,F ;Swap W_TEMP
SWAPF W_TEMP,W ;Swap W_TEMP into W
RETFIE ;Return from interrupt
EXAMPLE 9-2: SAVING STATUS AND W REGISTERS USING SHARED RAM (0x70 - 0x7F)
MOVWF W_TEMP ;Copy W to TEMP register (bank independent)
MOVF STATUS,W ;Move STATUS register into W
MOVWF STATUS_TEMP ;Save contents of STATUS register
:
:(ISR)
:
MOVF STATUS_TEMP,W ;Retrieve copy of STATUS register
MOVWF STATUS ;Restore pre-isr STATUS register contents
SWAPF W_TEMP,F ;
SWAPF W_TEMP,W ;Restore pre-isr W register contents
RETFIE ;Return from interrupt
0
M Postscaler
1 U
WDT Timer
X 8
8 - to - 1 MUX PS<2:0>
PSA
WDT
Enable Bit
To TMR0 (Figure 7-5)
0 1
MUX PSA
WDT
Note: PSA and PS<2:0> are bits in the OPTION register. Time-out
2007h Config. bits(1) MCLRE CP1 CP0 PWRTE WDTE FOSC2 FOSC1 FOSC0
81h OPTION GPPU INTEDG T0CS T0SE PSA PS2 PS1 PS0
Legend: Shaded cells are not used by the Watchdog Timer.
Note 1: See Register 9-1 for operation of these bits. Not all CP0 and CP1 bits are shown.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
CLKOUT(4) TOST(2)
GPIO pin
GPIF flag
(INTCON<0>) Interrupt Latency
(Note 3)
GIE bit Processor in
(INTCON<7>)
SLEEP
INSTRUCTION FLOW
PC PC PC+1 PC+2 PC+2 PC + 2 0004h 0005h
Instruction
Inst(PC) = SLEEP Inst(PC + 1) Inst(PC + 2) Inst(0004h) Inst(0005h)
fetched
Instruction Dummy cycle Dummy cycle
Inst(PC - 1) SLEEP Inst(PC + 1) Inst(0004h)
executed
9.9 Program Verification/Code Protection After reset, and if the device is placed into program-
ming/verify mode, the program counter (PC) is at loca-
If the code protection bit(s) have not been pro-
tion 00h. A 6-bit command is then supplied to the
grammed, the on-chip program memory can be read
device. Depending on the command, 14-bits of pro-
out for verification purposes.
gram data are then supplied to or from the device,
Note: Microchip does not recommend code pro- depending if the command was a load or a read. For
tecting windowed devices. complete details of serial programming, please refer to
the PIC12C67X Programming Specifications.
9.10 ID Locations
FIGURE 9-17: TYPICAL IN-CIRCUIT SERIAL
Four memory locations (2000h - 2003h) are designated
PROGRAMMING
as ID locations, where the user can store checksum or
other code-identification numbers. These locations are CONNECTION
not accessible during normal execution, but are read-
able and writable during program/verify. It is recom- To Normal
mended that only the 4 least significant bits of the ID External Connections
location are used. Connector PIC12C67X
Signals
9.11 In-Circuit Serial Programming +5V VDD
PIC12C67X microcontrollers can be serially pro- 0V VSS
grammed while in the end application circuit. This is VPP MCLR/VPP
simply done with two lines for clock and data, and three
other lines for power, ground and the programming volt- CLK GP1
age. This allows customers to manufacture boards with
unprogrammed devices, and then program the micro- Data I/O GP0
controller just before shipping the product. This also
allows the most recent firmware or a custom firmware
VDD
to be programmed.
To Normal
The device is placed into a program/verify mode by Connections
holding the GP1 and GP0 pins low, while raising the
MCLR (VPP) pin from VIL to VIHH (see programming
specification). GP1 (clock) becomes the programming
clock and GP0 (data) becomes the programming data.
Both GP0 and GP1 are Schmitt Trigger inputs in this
mode.
TABLE 10-1: OPCODE FIELD All examples use the following format to represent a
hexadecimal number:
DESCRIPTIONS
0xhh
Field Description
where h signifies a hexadecimal digit.
f Register file address (0x00 to 0x7F)
W Working register (accumulator) FIGURE 10-1: GENERAL FORMAT FOR
b Bit address within an 8-bit file register INSTRUCTIONS
k Literal field, constant data or label Byte-oriented file register operations
13 8 7 6 0
x Don't care location (= 0 or 1)
The assembler will generate code with x = 0. It is the OPCODE d f (FILE #)
recommended form of use for compatibility with all d = 0 for destination W
Microchip software tools. d = 1 for destination f
d Destination select; d = 0: store result in W, f = 7-bit file register address
d = 1: store result in file register f.
Default is d = 1 Bit-oriented file register operations
13 10 9 7 6 0
label Label name
OPCODE b (BIT #) f (FILE #)
TOS Top of Stack
PC Program Counter b = 3-bit bit address
PCLATH Program Counter High Latch f = 7-bit file register address
GIE Global Interrupt Enable bit Literal and control operations
WDT Watchdog Timer/Counter General
TO Time-out bit 13 8 7 0
PD Power-down bit OPCODE k (literal)
dest Destination either the W register or the specified k = 8-bit immediate value
register file location
CALL and GOTO instructions only
[ ] Options
13 11 10 0
( ) Contents
OPCODE k (literal)
Assigned to
<> Register bit field k = 11-bit immediate value
In the set of
italics User defined term (font is courier)
Words: 1 Words: 1
Cycles: 1 Cycles: 1
Description: If bit 'b' in register 'f' is '1', then the Description: The contents of register 'f' are
next instruction is skipped. cleared and the Z bit is set.
If bit 'b' is '1', then the next instruc- Words: 1
tion fetched during the current
instruction execution, is discarded Cycles: 1
and a NOP is executed instead,
making this a 2 cycle instruction. Example CLRF FLAG_REG
CLRW Clear W
CALL Call Subroutine
Syntax: [ label ] CLRW
Syntax: [ label ] CALL k
Operands: None
Operands: 0 k 2047
Operation: 00h (W)
Operation: (PC)+ 1 TOS, 1Z
k PC<10:0>,
(PCLATH<4:3>) PC<12:11> Status Affected: Z
Encoding: 10 0kkk kkkk kkkk Description: W register is cleared. Zero bit (Z)
is set.
Description: Call Subroutine. First, return
address (PC+1) is pushed onto Words: 1
the stack. The eleven bit immedi- Cycles: 1
ate address is loaded into PC bits
<10:0>. The upper bits of the PC Example CLRW
are loaded from PCLATH. CALL is
a two cycle instruction. Before Instruction
W = 0x5A
Words: 1 After Instruction
W = 0x00
Cycles: 2 Z = 1
Example HERE CALL
THER
E
Before Instruction
PC = Address HERE
After Instruction
PC = Address THERE
TOS = Address HERE+1
Words: 1 Cycles: 1
COMF Complement f
DECFSZ Decrement f, Skip if 0
Syntax: [ label ] COMF f,d
Syntax: [ label ] DECFSZ f,d
Operands: 0 f 127
d [0,1] Operands: 0 f 127
d [0,1]
Operation: (f) (dest)
Operation: (f) - 1 (dest); skip if result = 0
Status Affected: Z
Status Affected: None
Encoding: 00 1001 dfff ffff
Encoding: 00 1011 dfff ffff
Description: The contents of register 'f' are
complemented. If 'd' is 0, the Description: The contents of register 'f' are
result is stored in W. If 'd' is 1, the decremented. If 'd' is 0, the result
result is stored back in register 'f'. is placed in the W register. If 'd' is
1, the result is placed back in reg-
Words: 1 ister 'f'.
If the result is 0, the next instruc-
Cycles: 1 tion, which is already fetched, is
Example COMF REG1,0 discarded. A NOP is executed
instead making it a two cycle
Before Instruction instruction.
REG1 = 0x13
After Instruction Words: 1
REG1 = 0x13 Cycles: 1(2)
W = 0xEC
Example HERE DECFSZ CNT, 1
GOTO LOOP
CONTINUE •
•
•
Before Instruction
PC = address HERE
After Instruction
CNT = CNT - 1
if CNT = 0,
PC = address CONTINUE
if CNT 0,
PC = address HERE+1
INCF Increment f
Syntax: [ label ] INCF f,d IORLW Inclusive OR Literal with W
Operands: 0 f 127 Syntax: [ label ] IORLW k
d [0,1] Operands: 0 k 255
Operation: (f) + 1 (dest) Operation: (W) .OR. k (W)
Status Affected: Z Status Affected: Z
Encoding: 00 1010 dfff ffff
Encoding: 11 1000 kkkk kkkk
Description: The contents of register 'f' are Description: The contents of the W register are
incremented. If 'd' is 0, the result OR’ed with the eight bit literal 'k'.
is placed in the W register. If 'd' is The result is placed in the W reg-
1, the result is placed back in reg- ister.
ister 'f'.
Words: 1
Words: 1
Cycles: 1
Cycles: 1
Example IORLW 0x35
Example INCF CNT, 1
Before Instruction
Before Instruction W = 0x9A
CNT = 0xFF
Z = 0
After Instruction
W = 0xBF
After Instruction Z = 1
CNT = 0x00
Z = 1
MOVWF Move W to f
MOVLW Move Literal to W Syntax: [ label ] MOVWF f
Syntax: [ label ] MOVLW k Operands: 0 f 127
Operands: 0 k 255 Operation: (W) (f)
Operation: k (W) Status Affected: None
Status Affected: None Encoding: 00 0000 1fff ffff
Encoding: 11 00xx kkkk kkkk Description: Move data from W register to reg-
Description: The eight bit literal 'k' is loaded ister 'f'.
into W register. The don’t cares Words: 1
will assemble as 0’s.
Cycles: 1
Words: 1
Example MOVWF OPTION
Cycles: 1
Before Instruction
Example MOVLW 0x5A OPTION = 0xFF
After Instruction W = 0x4F
W = 0x5A After Instruction
OPTION = 0x4F
W = 0x4F
93CXX
24CXX/
25CXX/
HCSXXX
PIC14000
MCP2510
PIC16C5X
PIC16C6X
PIC16C7X
PIC16C8X
PIC17C4X
MCRFXXX
PIC16F62X
PIC16F8XX
PIC16C7XX
PIC16C9XX
PIC17C7XX
PIC18CXX2
PIC12CXXX
PIC16CXXX
®
MPLAB Integrated
Development Environment
®
MPLAB C17 Compiler
®
MPLAB C18 Compiler
Software Tools
MPASM/MPLINK
®
MPLAB -ICE **
Emulators
In-Circuit Emulator
®
MPLAB -ICD In-Circuit
Debugger * *
PICSTARTPlus
Low-Cost Universal Dev. Kit **
PRO MATE II
Universal Programmer **
Programmers Debugger
SIMICE
DEVELOPMENT TOOLS FROM MICROCHIP
PICDEM-1 †
PICDEM-2 † †
PICDEM-3
PICDEM-14A
PICDEM-17
KEELOQ® Evaluation Kit
KEELOQ Transponder Kit
microID™ Programmer’s Kit
125 kHz microID Developer’s Kit
125 kHz Anticollision microID
DS30561C-page 10-87
PIC12C67X
NOTES:
5.5
5.0
4.5
VDD
(Volts)
4.0
3.5
3.0
2.5
2.0
0 4 10 20 25
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: The maximum rated speed of the part limits the permissible combinations of voltage and frequency.
Please reference the Product Identification System section for the maximum rated speed of the parts.
6.0
5.5
5.0
4.5
VDD
(Volts)
4.0
3.5
3.0
2.5
0 4 10 20 25
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: The maximum rated speed of the part limits the permissible combinations of voltage and frequency.
Please reference the Product Identification System section for the maximum rated speed of the parts.
5.5
5.0
4.5
VDD
(Volts)
4.0
3.5
3.0
2.5
2.0
0 4 10 20 25
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: The maximum rated speed of the part limits the permissible combinations of voltage and frequency.
Please reference the Product Identification System section for the maximum rated speed of the parts.
VDD/2
RL
CL CL
Pin Pin
VSS VSS
RL = 464
CL = 50 pF for all pins except OSC2
15 pF for OSC2 output
OSC1
1 3 3 4 4
2
CLKOUT
Parameter
No.
Sym Characteristic Min* Typ(1) Max* Units Conditions
Q4 Q1 Q2 Q3
OSC1
10 11
CLKOUT
13 12
19 18
14 16
I/O Pin
(input)
17 15
20, 21
VDD
MCLR
30
Internal
POR
33
PWRT
Timeout
32
OSC
Timeout
Internal
RESET
Watchdog
Timer
RESET 36
34
31
34
I/O Pins
TABLE 12-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER
Parameter Sym Characteristic Min Typ† Max Units Conditions
No.
30 TmcL MCLR Pulse Width (low) 2 — — s VDD = 5V, –40°C to +125°C
31* Twdt Watchdog Timer Time-out Period 7 18 33 ms VDD = 5V, –40°C to +125°C
(No Prescaler)
32 Tost Oscillation Start-up Timer Period — 1024TOSC — — TOSC = OSC1 period
33* Tpwrt Power up Timer Period 28 72 132 ms VDD = 5V, –40°C to +125°C
34 TIOZ I/O Hi-impedance from MCLR — — 2.1 s
Low or Watchdog Timer Reset
* These parameters are characterized but not tested.
† Data in "Typ" column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only and
are not tested.
GP2/T0CKI
40 41
42
TMR0
A/D DATA 7 6 5 4 3 2 1 0
ADIF
GO DONE
SAMPLING STOPPED
SAMPLE
Note 1: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
4.40 4.40
4.30 4.30
Max.
4.20 4.20
Max.
Frequency (MHz)
4.10 4.10
Frequency (MHz)
4.00 4.00
3.90 3.90
3.80 3.80
3.60 3.60
Min.
3.50 3.50
-40 0 25 85 125 -40 0 25 85 125
FIGURE 13-3: WDT TIMER TIME-OUT FIGURE 13-4: IOH vs. VOH, VDD = 2.5 V
PERIOD vs. VDD
55 -0
-1
50
-2
45
-3
40 -4
IOH (mA)
Min +125C
WDT period (mS)
-5 Min +85C
35
Max +125C
-6
30 Typ +25C
Max +85C
-7
25
-8
20
-9
Typ +25C Max -40C
15 -10
.5 .75 1.0 1.25 1.5 1.75 2.0 2.25 2.5
MIn –40C
VOH (Volts)
10
0 2.5 3.5 4.5 5.5 6.5
VDD (Volts)
30
-5
Max -40C
Min +125C
IOH (mA)
25
-10
Min +85C 20
IOL (mA)
Typ +25C
Typ +25C
-15
15
Max -40C Min +85C
-20
10
Min +125C
-25
1.5 2.0 2.5 3.0 3.5 5
VOH (Volts)
0
FIGURE 13-6: IOH vs. VOH, VDD = 5.5 V 0 0.25 0.5 0.75 1.0
VOL (Volts)
0
-5
FIGURE 13-8: IOL vs. VOL, VDD = 3.5 V
45
-10
Max -40C
C 40
25
+1
-15 Mi
n
C
+ 85
in
M 35
IOH (mA)
-20 C
25
p+
Ty
-25 30
Typ +25C
C
0
–4
-30 25
IOL (mA)
ax
M
-35 20
-40 15
3.5 4.0 4.5 5.0 5.5 Min +85C
VOH (Volts)
Min +125C
10
0
0 0.25 0.5 0.75 1.0
VOL (Volts)
VTH (Volts)
45
1.4
40
Typ (25
1.2
35
Typ +25C Min (-40 to 125)
1.0
IOL (mA)
30
0.8
25
15 0
2.5 3.5 4.5 5.5
Min +125C
VDD (Volts)
10
0
0 0.25 0.5 0.75 1.0
VOL (Volts)
3.5
VIH Max (-40 to 125)
VIH Typ (25
3.0 VIH Min (-40 to 125)
VIL, VIH (Volts)
2.5
2.0
VIL Max (-40 to 125)
1.0
0.5
2.5 3.5 4.5 5.5
VDD (Volts)
MMMMMMM 12C671
XXXXXXX 04I/SM
AABBCDE 9924SAZ
MM JW
MMMMMM CE674
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 OTP marking consists of Microchip part number, year code, week code, facility code, mask
rev#, and assembly code. For OTP 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.
Note: For the most current package drawings, please see the Microchip Packaging Specification located
at http://www.microchip.com/packaging
E1
n 1
A A2
L
c
A1
B1
p
eB B
Note: For the most current package drawings, please see the Microchip Packaging Specification located
at http://www.microchip.com/packaging
E1
D
2
n 1
B
c
A A2
A1
L
Note: For the most current package drawings, please see the Microchip Packaging Specification located
at http://www.microchip.com/packaging
E1 W
T D
2
n 1
A
A2
L
A1
c B1
p
eB B
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________ FAX: (______) _________ - _________
Application (optional):
Would you like a reply? Y N
Questions:
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
4. What additions to the document do you think would enhance the structure and subject?
5. What deletions from the document could be made without affecting the overall usefulness?
* JW Devices are UV erasable and can be programmed to any device configuration. JW Devices meet the electrical requirement
of each oscillator type (including LC devices).
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s 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.
QUALITY MANAGEMENT SYSTEM Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
CERTIFIED BY DNV Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
== ISO/TS 16949 ==
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® 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.