PIC16C9XX - 8-Bit CMOS Microcontroller With LCD Driver - 30444e
PIC16C9XX - 8-Bit CMOS Microcontroller With LCD Driver - 30444e
ICSP is a trademark of Microchip Technology Inc. I2C is a trademark of Philips Corporation. SPI is a trademark of Motorola Corporation.
RD7/SEG31/COM1
RD6/SEG30/COM2
MCLR/VPP
COM0
PLCC
RA3
RA2
RA1
RA0
RB2
RB3
RB4
RB5
RB7
RB6
VDD
VSS
N/C
9
8
7
6
5
4
3
2
1
68
67
66
65
64
63
62
61
RA4/T0CKI 10 60 RD5/SEG29/COM3
RA5/SS 11 59 RG6/SEG26
RB1 12 58 RG5/SEG25
RB0/INT 13 57 RG4/SEG24
RC3/SCK/SCL 14 56 RG3/SEG23
RC4/SDI/SDA 15 55 RG2/SEG22
RC5/SDO 16 54 RG1/SEG21
C1 17 RG0/SEG20
C2 18 PIC16C923 53
52 RG7/SEG28
VLCD2 19 51 RF7/SEG19
VLCD3 20 50 RF6/SEG18
VDD 21 49 RF5/SEG17
VDD 22 48 RF4/SEG16
VSS 23 47 RF3/SEG15
OSC1/CLKIN 24 46 RF2/SEG14
OSC2/CLKOUT 25 45 RF1/SEG13
RC0/T1OSO/T1CKI 26 44 RF0/SEG12
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Shrink PDIP (750 mil)
MCLR/VPP 1 64 RB4
RC1/T1OSI
RC2/CCP1
VLCDADJ
RD0/SEG00
RD1/SEG01
RD2/SEG02
RD3/SEG03
RD4/SEG04
RE7/SEG27
RE0/SEG05
RE1/SEG06
RE2/SEG07
RE3/SEG08
RE4/SEG09
RE5/SEG10
RE6/SEG11
VLCD1
RB3 2 63 RB5
RB2 3 62 RB7
RA0 4 61 RB6
RA1 5 60 VDD
VSS 6 59 COM0
RA2 7 58 RD7/SEG31/COM1
RA3 8 57 RD6/SEG30/COM2
RA4/T0CKI 9 56 RD5/SEG29/COM3
RA5/SS 10 55 RG6/SEG26
RB1 11 54 RG5/SEG25
PIC16C923
RB0/INT 12 53 RG4/SEG24
RC3/SCK/SCL 13 52 RG3/SEG23
RC4/SDI/SDA 14 51 RG2/SEG22
RC5/SDO 15 50 RG1/SEG21
C1 16 49 RG0/SEG20
C2 17 48 RF7/SEG19
VLCD2 18 47 RF6/SEG18
VLCD3 19 46 RF5/SEG17
VDD 20 45 RF4/SEG16
VSS 21 44 RF3/SEG15
OSC1/CLKIN 22 43
RD7/SEG31/COM1
RF2/SEG14 RD6/SEG30/COM2
OSC2/CLKOUT 23 42 RF1/SEG13
RC0/T1OSO/T1CKI 24 41 RF0/SEG12
RC1/T1OSI 40
MCLR/VPP
25 RE6/SEG11
RC2/CCP1 26 39 RE5/SEG10
COM0
VLCD1 27 38 RE4/SEG09
RA3
RA2
RA1
RA0
RB2
RB4
RB5
RB7
RB6
RB3
VDD
VSS
RA4/T0CKI 1 48 RD5/SEG29/COM3
RA5/SS 2 47 RG6/SEG26
RB1 3 46 RG5/SEG25
RB0/INT 4 45 RG4/SEG24
RC3/SCK/SCL 5 44 RG3/SEG23
RC4/SDI/SDA 6 43 RG2/SEG22
RC5/SDO 7 42 RG1/SEG21
C1 8 41 RG0/SEG20
C2 9 PIC16C923 40 RF7/SEG19
VLCD2 10 39 RF6/SEG18
VLCD3 11 38 RF5/SEG17
VDD 12 37 RF4/SEG16
VSS 13 36 RF3/SEG15
OSC1/CLKIN 14 35 RF2/SEG14
OSC2/CLKOUT 15 34 RF1/SEG13
RC0/T1OSO/T1CKI 16 33 RF0/SEG12
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
RC1/T1OSI
RC2/CCP1
VLCDADJ
RD0/SEG00
RD1/SEG01
RD2/SEG02
RD3/SEG03
RD4/SEG04
RE0/SEG05
RE1/SEG06
RE2/SEG07
RE3/SEG08
RE4/SEG09
RE5/SEG10
RE6/SEG11
VLCD1
LEGEND:
Input Pin
Output Pin
Input/Output Pin
Digital Input/LCD Output Pin
LCD Output Pin
RD7/SEG31/COM1
RD6/SEG30/COM2
RA3/AN3/VREF
MCLR/VPP
RA2/AN2
RA1/AN1
RA0/AN0
PLCC
COM0
RB2
RB3
RB4
RB5
RB7
RB6
VDD
VSS
N/C
9
8
7
6
5
4
3
2
1
68
67
66
65
64
63
62
61
RA4/T0CKI 10 60 RD5/SEG29/COM3
RA5/AN4/SS 11 59 RG6/SEG26
RB1 12 58 RG5/SEG25
RB0/INT 13 57 RG4/SEG24
RC3/SCK/SCL 14 56 RG3/SEG23
RC4/SDI/SDA 15 55 RG2/SEG22
RC5/SDO 16 54 RG1/SEG21
C1
C2
17
18 PIC16C924 53
52
RG0/SEG20
RG7/SEG28
VLCD2 19 51 RF7/SEG19
VLCD3 20 50 RF6/SEG18
AVDD 21 49 RF5/SEG17
VDD 22 48 RF4/SEG16
VSS 23 47 RF3/SEG15
OSC1/CLKIN 24 46 RF2/SEG14
Shrink PDIP (750 mil) OSC2/CLKOUT 25 45 RF1/SEG13
RC0/T1OSO/T1CKI 26 44 RF0/SEG12
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
MCLR/VPP 1 64 RB4
RB3 2 63 RB5
RB2 3 62 RB7
RC1/T1OSI
RC2/CCP1
VLCDADJ
RD0/SEG00
RD1/SEG01
RD2/SEG02
RD3/SEG03
RD4/SEG04
RE7/SEG27
RE0/SEG05
RE1/SEG06
RE2/SEG07
RE3/SEG08
RE4/SEG09
RE5/SEG10
RE6/SEG11
VLCD1
RA0/AN0 4 61 RB6
RA1/AN1 5 60 VDD
VSS 6 59 COM0
RA2/AN2 7 58 RD7/SEG31/COM1
RA3/AN3/VREF 8 57 RD6/SEG30/COM2
RA4/T0CKI 9 56 RD5/SEG29/COM3
RA5/AN4/SS 10 55 RG6/SEG26
RB1 11 54 RG5/SEG25
PIC16C924
RB0/INT 12 53 RG4/SEG24
RC3/SCK/SCL 13 52 RG3/SEG23
RC4/SDI/SDA 14 51 RG2/SEG22
RC5/SDO 15 50 RG1/SEG21
C1 16 49 RG0/SEG20
C2 17 48 RF7/SEG19
VLCD2 18 47 RF6/SEG18
VLCD3 19 46 RF5/SEG17
VDD 20 45 RF4/SEG16
VSS 21 44 RF3/SEG15
OSC1/CLKIN 22 43 RF2/SEG14
OSC2/CLKOUT 23 42 RF1/SEG13
RD7/SEG31/COM1
RD6/SEG30/COM2
RC0/T1OSO/T1CKI 24 41 RF0/SEG12
RC1/T1OSI 25 40 RE6/SEG11
RA3/AN3/VREF
RC2/CCP1 26 39 RE5/SEG10
MCLR/VPP
VLCD1 27 38 RE4/SEG09
RA2/AN2
RA1/AN1
RA0/AN0
VLCDADJ 28 37 RE3/SEG08
COM0
RD0/SEG00 36
RB2
RB4
RB5
RB7
RB6
RB3
RE2/SEG07
VDD
29
VSS
RD1/SEG01 30 35 RE1/SEG06
RD2/SEG02 31 34 RE0/SEG05
RD3/SEG03 32 33 RD4/SEG04
TQFP
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
RA4/T0CKI 1 48 RD5/SEG29/COM3
RA5/AN4/SS 2 47 RG6/SEG26
RB1 3 46 RG5/SEG25
RB0/INT 4 45 RG4/SEG24
RC3/SCK/SCL 5 44 RG3/SEG23
RC4/SDI/SDA 6 43 RG2/SEG22
RC5/SDO 7 42 RG1/SEG21
C1 8 41 RG0/SEG20
C2 9 PIC16C924 40 RF7/SEG19
VLCD2 10 39 RF6/SEG18
VLCD3 11 38 RF5/SEG17
VDD 12 37 RF4/SEG16
VSS 13 36 RF3/SEG15
OSC1/CLKIN 14 35 RF2/SEG14
OSC2/CLKOUT 15 34 RF1/SEG13
RC0/T1OSO/T1CKI 16 33 RF0/SEG12
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
RC1/T1OSI
RC2/CCP1
VLCDADJ
RD0/SEG00
RD1/SEG01
RD2/SEG02
RD3/SEG03
RD4/SEG04
RE0/SEG05
RE1/SEG06
RE2/SEG07
RE3/SEG08
RE4/SEG09
RE5/SEG10
RE6/SEG11
VLCD1
LEGEND:
Input Pin
Output Pin
Input/Output Pin
Digital Input/LCD Output Pin
LCD Output Pin
STATUS reg
8 PORTC
RC0/T1OSO/T1CKI
RC1/T1OSI
3 RC2/CCP1
Power-up MUX
RC3/SCK/SCL
Timer
RC4/SDI/SDA
Instruction Oscillator RC5/SDO
Decode & Start-up Timer ALU
Control
Power-on
Reset 8 PORTD
Timing Watchdog
Generation Timer W reg RD0-RD4/SEGnn
OSC1/CLKIN
OSC2/CLKOUT
RD5-RD7/SEGnn/COMn
RE0-RE7/SEGnn
PORTF
RF0-RF7/SEGnn
PORTG
RG0-RG7/SEGnn
Timer1, Timer2,
Timer0
CCP1
Synchronous COM0
Serial Port VLCD1
VLCD2
LCD VLCD3
C1
C2
VLCDADJ
STATUS reg
8 PORTC
RC0/T1OSO/T1CKI
RC1/T1OSI
3 RC2/CCP1
Power-up MUX
RC3/SCK/SCL
Timer
RC4/SDI/SDA
Instruction Oscillator RC5/SDO
Decode & Start-up Timer ALU
Control
Power-on
Reset 8 PORTD
Timing Watchdog
Generation Timer W reg RD0-RD4/SEGnn
OSC1/CLKIN
OSC2/CLKOUT
RD5-RD7/SEGnn/COMn
RE0-RE7/SEGnn
PORTF
RF0-RF7/SEGnn
PORTG
RG0-RG7/SEGnn
Timer1, Timer2,
Timer0 A/D
CCP1
Synchronous COM0
Serial Port VLCD1
VLCD2
LCD VLCD3
C1
C2
VLCDADJ
OSC1/CLKIN 22 24 14 I ST/CMOS Oscillator crystal input or external clock source input. This
buffer is a Schmitt Trigger input when configured in RC
oscillator mode and a CMOS input otherwise.
OSC2/CLKOUT 23 25 15 O — Oscillator crystal output. Connects to crystal or resonator
in crystal oscillator mode. In RC mode, OSC2 pin outputs
CLKOUT which has 1/4 the frequency of OSC1, and
denotes the instruction cycle rate.
MCLR/VPP 1 2 57 I/P ST Master clear (reset) input or programming voltage input.
This pin is an active low reset to the device.
PORTA is a bi-directional I/O port. The AN and VREF multi-
plexed functions are used by the PIC16C924 only.
RA0/AN0 4 5 60 I/O TTL RA0 can also be Analog input0.
RA1/AN1 5 6 61 I/O TTL RA1 can also be Analog input1.
RA2/AN2 7 8 63 I/O TTL RA2 can also be Analog input2.
RA3/AN3/VREF 8 9 64 I/O TTL RA3 can also be Analog input3 or A/D Voltage Refer-
ence.
RA4/T0CKI 9 10 1 I/O ST RA4 can also be the clock input to the Timer0
timer/counter. Output is open drain type.
RA5/AN4/SS 10 11 2 I/O TTL RA5 can be the slave select for the synchronous serial
port or Analog input4.
PORTB is a bi-directional I/O port. PORTB can be software
programmed for internal weak pull-ups on all inputs.
RB0/INT 12 13 4 I/O TTL/ST RB0 can also be the external interrupt pin. This buffer
is a Schmitt Trigger input when configured as an exter-
nal interrupt.
RB1 11 12 3 I/O TTL
RB2 3 4 59 I/O TTL
RB3 2 3 58 I/O TTL
RB4 64 68 56 I/O TTL Interrupt on change pin.
RB5 63 67 55 I/O TTL Interrupt on change pin.
RB6 61 65 53 I/O TTL/ST Interrupt on change pin. Serial programming clock.
This buffer is a Schmitt Trigger input when used in
serial programming mode.
RB7 62 66 54 I/O TTL/ST Interrupt on change pin. Serial programming data.
This buffer is a Schmitt Trigger input when used in
serial programming mode.
PORTC is a bi-directional I/O port.
RC0/T1OSO/T1CKI 24 26 16 I/O ST RC0 can also be the Timer1 oscillator output or
Timer1 clock input.
RC1/T1OSI 25 27 17 I/O ST RC1 can also be the Timer1 oscillator input.
RC2/CCP1 26 28 18 I/O ST RC2 can also be the Capture1 input/Compare1 out-
put/PWM1 output.
RC3/SCK/SCL 13 14 5 I/O ST RC3 can also be the synchronous serial clock
input/output for both SPI and I2C modes.
RC4/SDI/SDA 14 15 6 I/O ST RC4 can also be the SPI Data In (SPI mode) or data
I/O (I2C mode).
RC5/SDO 15 16 7 I/O ST RC5 can also be the SPI Data Out (SPI mode).
C1 16 17 8 P LCD Voltage Generation.
C2 17 18 9 P LCD Voltage Generation.
Legend: I = input O = output P = power L = LCD Driver
— = 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
(RC mode)
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 fetch
instruction is “flushed” from the pipeline while the new instruction is being fetched and then executed.
Interrupt Vector 0004h These locations are used for common access across
0005h
Space
0FFFh
1000h
1FFFh
Indirect addr.(1) 00h Indirect addr.(1) 80h Indirect addr.(1) 100h Indirect addr.(1) 180h
TMR0 01h OPTION 81h TMR0 101h OPTION 181h
PCL 02h PCL 82h PCL 102h PCL 182h
STATUS 03h STATUS 83h STATUS 103h STATUS 183h
FSR 04h FSR 84h FSR 104h FSR 184h
PORTA 05h TRISA 85h 105h 185h
PORTB 06h TRISB 86h PORTB 106h TRISB 186h
PORTC 07h TRISC 87h PORTF 107h TRISF 187h
PORTD 08h TRISD 88h PORTG 108h TRISG 188h
PORTE 09h TRISE 89h 109h 189h
PCLATH 0Ah PCLATH 8Ah PCLATH 10Ah PCLATH 18Ah
INTCON 0Bh INTCON 8Bh INTCON 10Bh INTCON 18Bh
PIR1 0Ch PIE1 8Ch 10Ch 18Ch
0Dh 8Dh LCDSE 10Dh 18Dh
TMR1L 0Eh PCON 8Eh LCDPS 10Eh 18Eh
TMR1H 0Fh 8Fh LCDCON 10Fh 18Fh
T1CON 10h 90h LCDD00 110h 190h
TMR2 11h 91h LCDD01 111h 191h
T2CON 12h PR2 92h LCDD02 112h 192h
SSPBUF 13h SSPADD 93h LCDD03 113h 193h
SSPCON 14h SSPSTAT 94h LCDD04 114h 194h
CCPR1L 15h 95h LCDD05 115h 195h
CCPR1H 16h 96h LCDD06 116h 196h
CCP1CON 17h 97h LCDD07 117h 197h
18h 98h LCDD08 118h 198h
19h 99h LCDD09 119h 199h
1Ah 9Ah LCDD10 11Ah 19Ah
1Bh 9Bh LCDD11 11Bh 19Bh
1Ch 9Ch LCDD12 11Ch 19Ch
1Dh 9Dh LCDD13 11Dh 19Dh
ADRES(2) 1Eh 9Eh LCDD14 11Eh 19Eh
ADCON0(2) 1Fh ADCON1(2) 9Fh LCDD15 11Fh 19Fh
20h A0h 120h 1A0h
General
Purpose
Register
General
Purpose
Register EFh 16F 1EFh
Mapped in F0h Mapped in 170 Mapped in 1F0h
Bank 0 Bank 0 Bank 0
70h-7Fh 70h-7Fh 70h-7Fh
7Fh FFh 17F 1FFh
Bank 0 Bank 1 Bank 2 Bank 3
Bank 0
00h INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
01h TMR0 Timer0 module’s register xxxx xxxx uuuu uuuu
02h PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
03h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 000q quuu
04h FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
05h PORTA — — PORTA Data Latch when written: PORTA pins when read (4) (4)
06h PORTB PORTB Data Latch when written: PORTB pins when read xxxx xxxx uuuu uuuu
07h PORTC — — PORTC Data Latch when written: PORTC pins when read --xx xxxx --uu uuuu
08h PORTD PORTD Data Latch when written: PORTD pins when read 0000 0000 0000 0000
09h PORTE PORTE pins when read 0000 0000 0000 0000
0Ah PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
0Bh INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
0Ch PIR1 LCDIF ADIF(2) — — SSPIF CCP1IF TMR2IF TMR1IF 00-- 0000 00-- 0000
0Dh — Unimplemented — —
0Eh TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
0Fh TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
11h TMR2 Timer2 module’s register 0000 0000 0000 0000
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
15h CCPR1L Capture/Compare/PWM Register (LSB) xxxx xxxx uuuu uuuu
16h CCPR1H Capture/Compare/PWM Register (MSB) xxxx xxxx uuuu uuuu
17h CCP1CON — — CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
18h — Unimplemented — —
19h — Unimplemented — —
1Ah — Unimplemented — —
1Bh — Unimplemented — —
1Ch — Unimplemented — —
1Dh — Unimplemented — —
1Eh(1) ADRES A/D Result Register xxxx xxxx uuuu uuuu
1Fh(1) ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE (5)
ADON 0000 0000 0000 0000
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0',
shaded locations are unimplemented, read as ‘0’.
Note 1: Registers ADRES, ADCON0, and ADCON1 are not implemented in the PIC16C923, read as '0'.
2: These bits are reserved on the PIC16C923, always maintain these bits clear.
3: These pixels do not display, but can be used as general purpose RAM.
4: PIC16C923 reset values for PORTA: --xx xxxx for a POR, and --uu uuuu for all other resets,
PIC16C924 reset values for PORTA: --0x 0000 when read.
5: Bit1 of ADCON0 is reserved on the PIC16C924, always maintain this bit clear.
4.3.2 STACK
Data
Memory
7Fh 7Fh
Bank 0 Bank 1 Bank 2 Bank 3
EN
EN
RD PORT
05h PORTA — — RA5 RA4 RA3 RA2 RA1 RA0 (2) (2)
85h TRISA — — PORTA Data Direction Control Register --11 1111 --11 1111
9Fh(1) ADCON1 — — — — — PCFG2 PCFG1 PCFG0 ---- -000 ---- -000
Legend: x = unknown, u = unchanged, - = unimplemented locations read as '0'. Shaded cells are not used by PORTA.
Note 1: The ADCON1 register is implemented on the PIC16C924 only.
2: PIC16C923 reset values for PORTA: --xx xxxx for a POR, and --uu uuuu for all other resets,
PIC16C924 reset values for PORTA: --0x 0000 when read.
Four of PORTB’s pins, RB7:RB4, have an interrupt on Note 1: I/O pins have diode protection to VDD and VSS.
change feature. Only pins configured as inputs can 2: To enable weak pull-ups, set the appropriate TRIS bit
and clear the RBPU bit (OPTION<7>).
cause this interrupt to occur (i.e. any RB7:RB4 pin con-
figured as an output is excluded from the interrupt on
change comparison). The input pins (of RB7:RB4) are
compared with the old value latched on the last read of
06h, 106h PORTB RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 xxxx xxxx uuuu uuuu
86h, 186h TRISB PORTB Data Direction Control Register 1111 1111 1111 1111
81h, 181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
Legend: x = unknown, u = unchanged. Shaded cells are not used by PORTB.
RC0/T1OSO/T1CKI bit0 ST Input/output port pin or Timer1 oscillator output or Timer1 clock input
RC1/T1OSI bit1 ST Input/output port pin or Timer1 oscillator input
RC2/CCP1 bit2 ST Input/output port pin or Capture input/Compare output/PWM output
RC3/SCK/SCL bit3 ST Input/output port pin or the synchronous serial clock for both SPI and
I2C modes.
RC4/SDI/SDA bit4 ST Input/output port pin or the SPI Data In (SPI mode) or data I/O (I2C
mode).
RC5/SDO bit5 ST Input/output port pin or Synchronous Serial Port data out
Legend: ST = Schmitt Trigger input
07h PORTC — — RC5 RC4 RC3 RC2 RC1 RC0 --xx xxxx --uu uuuu
87h TRISC — — PORTC Data Direction Control Register --11 1111 --11 1111
Legend: x = unknown, u = unchanged, - = unimplemented, read as '0'. Shaded cells are not used by PORTC.
Data Latch
Note: To configure the pins as a digital port, the
corresponding bits in the LCDSE register D Q
must be cleared. Any bit set in the LCDSE WR
TRIS
register overrides any bit settings in the CK
corresponding TRIS register. Schmitt
TRIS Latch Trigger
input
EXAMPLE 5-4: INITIALIZING PORTD buffer
RD TRIS
BCF STATUS,RP0 ;Select Bank2
BSF STATUS,RP1 ;
BCF LCDSE,SE29 ;Make RD<7:5> digital LCDSE<n>
BCF LCDSE,SE0 ;Make RD<4:0> digital
BSF STATUS,RP0 ;Select Bank1 Q D
BCF STATUS,RP1 ;
MOVLW 0x07 ;Make RD<4:0> outputs
EN
EN
MOVWF TRISD ;Make RD<7:5> inputs
RD
PORT
LCD Segment
Output Enable
LCD
Common Data
LCDSE<n>
Schmitt
Trigger
input
buffer
Data Bus
Q D
EN
EN
RD PORT
VDD
RD TRIS
Buffer
Name Bit# Function
Type
RD0/SEG00 bit0 ST Input/output port pin or Segment Driver00
RD1/SEG01 bit1 ST Input/output port pin or Segment Driver01
RD2/SEG02 bit2 ST Input/output port pin or Segment Driver02
RD3/SEG03 bit3 ST Input/output port pin or Segment Driver03
RD4/SEG04 bit4 ST Input/output port pin or Segment Driver04
RD5/SEG29/COM3 bit5 ST Digital input pin or Segment Driver29 or Common Driver3
RD6/SEG30/COM2 bit6 ST Digital input pin or Segment Driver30 or Common Driver2
RD7/SEG31/COM1 bit7 ST Digital input pin or Segment Driver31 or Common Driver1
Legend: ST = Schmitt Trigger input
08h PORTD RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0 0000 0000 0000 0000
88h TRISD PORTD Data Direction Control Register 1111 1111 1111 1111
10Dh LCDSE SE29 SE27 SE20 SE16 SE12 SE9 SE5 SE0 1111 1111 1111 1111
Legend: Shaded cells are not used by PORTD.
RD PORT
VDD
RD TRIS
09h PORTE RE7 RE6 RE5 RE4 RE3 RE2 RE1 RE0 0000 0000 0000 0000
89h TRISE PORTE Data Direction Control Register 1111 1111 1111 1111
10Dh LCDSE SE29 SE27 SE20 SE16 SE12 SE9 SE5 SE0 1111 1111 1111 1111
Legend: Shaded cells are not used by PORTE.
LCDSE<n>
EXAMPLE 5-6: INITIALIZING PORTF
EN
EN
RD PORT
VDD
RD TRIS
107h PORTF RF7 RF6 RF5 RF4 RF3 RF2 RF1 RF0 0000 0000 0000 0000
187h TRISF PORTF Data Direction Control Register 1111 1111 1111 1111
10Dh LCDSE SE29 SE27 SE20 SE16 SE12 SE9 SE5 SE0 1111 1111 1111 1111
Legend: Shaded cells are not used by PORTF.
LCDSE<n>
RD PORT
VDD
RD TRIS
108h PORTG RG7 RG6 RG5 RG4 RG3 RG2 RG1 RG0 0000 0000 0000 0000
188h TRISG PORTG Data Direction Control Register 1111 1111 1111 1111
10Dh LCDSE SE29 SE27 SE20 SE16 SE12 SE9 SE5 SE0 1111 1111 1111 1111
Legend: Shaded cells are not used by PORTG.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Note:
PC PC PC + 1 PC + 2 PC + 3 This example shows a write to PORTB
Instruction followed by a read from PORTB.
fetched MOVWF PORTB MOVF PORTB,W
write to NOP NOP
PORTB Note that:
RB7:RB0 data setup time = (0.25TCY - TPD)
where TCY = instruction cycle
Port pin
sampled here TPD = propagation delay
TPD Therefore, at higher clock frequencies,
Instruction
executed NOP
a write followed by a read may be prob-
MOVWF PORTB MOVF PORTB,W
write to lematic.
PORTB
Data bus
FOSC/4 0
PSout 8
1
Sync with
1 Internal TMR0
clocks
RA4/T0CKI Programmable 0 PSout
pin Prescaler
T0SE (2 cycle delay)
3
Set interrupt
PS2, PS1, PS0 PSA flag bit T0IF
T0CS on overflow
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,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF 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 MOVWF TMR0 MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W
Fetch
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
Increment Timer0 (Q4)
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
RA4/T0CKI U M
X SYNC
pin U 2 TMR0 reg
1 0
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 PS2:PS0
PSA
0 1
WDT Enable bit
MUX PSA
WDT
Time-out
01h, 101h TMR0 Timer0 module’s register xxxx xxxx uuuu uuuu
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
81h, 181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
85h TRISA — — PORTA Data Direction Control Register --11 1111 --11 1111
Legend: x = unknown, u = unchanged, - = unimplemented locations read as '0'. Shaded cells are not used by Timer0.
TMR1CS = 1
1 = Do not synchronize external clock input
0 = Synchronize external clock input
TMR1CS = 0
This bit is ignored. Timer1 uses the internal clock when TMR1CS = 0.
bit 1: TMR1CS: Timer1 Clock Source Select bit
1 = External clock from pin T1CKI (on the rising edge)
0 = Internal clock (Fosc/4)
bit 0: TMR1ON: Timer1 On bit
1 = Enables Timer1
0 = Stops Timer1
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
0Ch PIR1 LCDIF ADIF(1) — — SSPIF CCP1IF TMR2IF TMR1IF 00-- 0000 00-- 0000
8Ch PIE1 LCDIE ADIE(1) — — SSPIE CCP1IE TMR2IE TMR1IE 00-- 0000 00-- 0000
0Eh TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
0Fh TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by theTimer1 module.
Note 1: Bits ADIE and ADIF are reserved on the PIC16C923, always maintain these bits clear.
PR2 reg 4
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
0Ch PIR1 LCDIF ADIF(1) — — SSPIF CCP1IF TMR2IF TMR1IF 00-- 0000 00-- 0000
8Ch PIE1 LCDIE ADIE(1) — — SSPIE CCP1IE TMR2IE TMR1IE 00-- 0000 00-- 0000
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
92h PR2 Timer2 Period Register 1111 1111 1111 1111
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the Timer2 module.
Note 1: Bits ADIE and ADIF are reserved on the PIC16C923, always maintain these bits clear.
and Capture Special event trigger will reset Timer1, but not
edge detect Enable set interrupt flag bit TMR1IF (PIR1<0>).
TMR1H TMR1L
CCP1CON<3:0> Set CCP1IF
Trigger
PIR1<2>
Q’s
CCPR1H CCPR1L
TMR1 register pair and starts an A/D conversion. This Clear Timer,
CCP1 pin and
allows the CCPR1H:CCPR1L register pair to effectively PR2
latch D.C.
be a 16-bit programmable period register for Timer1.
Note: The "special event trigger" from the CCP1 Note 1: 8-bit timer is concatenated with 2-bit internal Q clock
module will not set interrupt flag bit or 2 bits of the prescaler to create 10-bit time-base.
TMR1IF (PIR1<0>).
A PWM output (Figure 10-5) has a time-base (period)
10.3 PWM Mode and a time that the output stays high (duty cycle). The
In Pulse Width Modulation (PWM) mode, the CCP1 pin frequency of the PWM is the inverse of the period
produces up to a 10-bit resolution PWM output. Since (1/period).
the CCP1 pin is multiplexed with the PORTC data latch,
the TRISC<2> bit must be cleared to make the CCP1 FIGURE 10-5: PWM OUTPUT
pin an output. Period
Note: Clearing the CCP1CON register will force
the CCP1 PWM output latch to the default
low level. This is not the PORTC I/O data
latch.
Duty Cycle TMR2 = PR2
Figure 10-4 shows a simplified block diagram of the
CCP module in PWM mode. TMR2 = Duty Cycle
For a step by step procedure on how to set up the CCP TMR2 = PR2
module for PWM operation, see Section 10.3.3.
10.3.1 PWM PERIOD
PWM Frequency 488 Hz 1.95 kHz 7.81 kHz 31.25 kHz 62.5 kHz 250 kHz
Timer Prescaler (1, 4, 16) 16 4 1 1 1 1
PR2 Value 0xFF 0xFF 0xFF 0x3F 0x1F 0x07
Maximum Resolution (bits) 10 10 10 8 7 5
87h TRISC — — PORTC Data Direction Control Register --11 1111 --11 1111
0Eh TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
0Fh TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
17h CCP1CON — — CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
Legend: x = unknown, u = unchanged, - = unimplemented locations read as '0’. Shaded cells are not used in these modes.
Note 1: Bits ADIE and ADIF reserved on the PIC16C923, always maintain these bits clear.
SDO SDI
SDI SDO
Shift Register Shift Register
(SSPSR) (SSPSR)
PROCESSOR 1 PROCESSOR 2
SCK (CKP = 0,
CKE = 0)
SCK (CKP = 0,
CKE = 1)
SCK (CKP = 1,
CKE = 0)
SCK (CKP = 1,
CKE = 1)
SDI (SMP = 0)
bit7 bit0
SDI (SMP = 1)
bit7 bit0
SSPIF
SCK (CKP = 0)
SCK (CKP = 1)
SDI (SMP = 0)
bit7 bit0
SSPIF
SS
(not optional)
SCK (CKP = 0)
SCK (CKP = 1)
SDI (SMP = 0)
bit7 bit0
SSPIF
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
0Ch PIR1 LCDIF ADIF(1) — — SSPIF CCP1IF TMR2IF TMR1IF 00-- 0000 00-- 0000
8Ch PIE1 LCDIE ADIE(1) — — SSPIE CCP1IE TMR2IE TMR1IE 00-- 0000 00-- 0000
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
85h TRISA — — PORTA Data Direction Control Register --11 1111 --11 1111
87h TRISC — — PORTC Data Direction Control Register --11 1111 --11 1111
94h SSPSTAT SMP CKE D/A P S R/W UA BF 0000 0000 0000 0000
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the SSP in SPI mode.
Note 1: Bits ADIE and ADIF are reserved on the PIC16C923, always maintain these bits clear.
Term Description
Receiver The device that receives the data from the bus.
Master The device which initiates the transfer, generates the clock and terminates the transfer.
Multi-master More than one master device in a system. These masters can attempt to control the bus at the
same time without corrupting the message.
Arbitration Procedure that ensures that only one of the master devices will control the bus. This ensure that
the transfer data does not get corrupted.
Synchronization Procedure where the clock signals of two or more devices are synchronized.
S
MSb LSb Start Clock Pulse for
Condition Acknowledgment
S R/W ACK
SDA
MSB acknowledgment acknowledgment
signal from receiver byte complete signal from receiver
interrupt with receiver
clock line held low while
interrupts are serviced
SCL S 1 2 7 8 9 1 2 3•8 9 P
Start Stop
Condition Address R/W ACK Wait Data ACK
State Condition
S Slave Address R/W A Data A/A Sr Slave Address R/W A Data A/A P
Combined format:
Sr Slave Address R/W A Slave Address A Data A Data A/A Sr Slave Address R/W A Data A Data A P
First 7 bits Second byte First 7 bits
(write) (read)
Combined format - A master addresses a slave with a 10-bit address, then transmits
data to this slave and reads data from this slave.
A = acknowledge (SDA low)
From master to slave A = not acknowledge (SDA high)
S = Start Condition
From slave to master P = Stop Condition
The I2C protocol allows a system to have more than Clock synchronization occurs after the devices have
one master. This is called multi-master. When two or started arbitration. This is performed using a
more masters try to transfer data at the same time, arbi- wired-AND connection to the SCL line. A high to low
tration and synchronization occur. transition on the SCL line causes the concerned
devices to start counting off their low period. Once a
11.2.4.1 ARBITRATION device clock has gone low, it will hold the SCL line low
until its SCL high state is reached. The low to high tran-
Arbitration takes place on the SDA line, while the SCL sition of this clock may not change the state of the SCL
line is high. The master which transmits a high when the line, if another device clock is still within its low period.
other master transmits a low loses arbitration The SCL line is held low by the device with the longest
(Figure 11-16), and turns off its data output stage. A low period. Devices with shorter low periods enter a
master which lost arbitration can generate clock pulses high wait-state, until the SCL line comes high. When the
until the end of the data byte where it lost arbitration. SCL line comes high, all devices start counting off their
When the master devices are addressing the same high periods. The first device to complete its high period
device, arbitration continues into the data. will pull the SCL line low. The SCL line high time is
determined by the device with the shortest high period,
FIGURE 11-16: MULTI-MASTER Figure 11-17.
ARBITRATION
(TWO MASTERS) FIGURE 11-17: CLOCK SYNCHRONIZATION
DATA 2 CLK
1
SDA counter
CLK reset
2
SCL
SCL
SCL S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SSPOV (SSPCON<6>)
Bit SSPOV is set because the SSPBUF register is still full.
ACK is not sent.
SCL 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
Data in SCL held low
sampled while CPU
responds to SSPIF
SSPIF (PIR1<3>) cleared in software
BF (SSPSTAT<0>)
From SSP interrupt
SSPBUF is written in software service routine
CKP (SSPCON<4>)
Master mode of operation is supported, in firmware, In multi-master mode, the interrupt generation on the
using interrupt generation on the detection of the detection of the START and STOP conditions allows the
START and STOP conditions. The STOP (P) and determination of when the bus is free. The STOP (P)
START (S) bits are cleared from a reset or when the and START (S) bits are cleared from a reset or when
SSP module is disabled. The STOP and START bits will the SSP module is disabled. The STOP and START bits
toggle based on the start and stop conditions. Control will toggle based on the start and stop conditions. Con-
of the I 2C bus may be taken when the P bit is set, or the trol of the I 2C bus may be taken when bit P (SSP-
bus is idle with both the S and P bits clear. STAT<4>) is set, or the bus is idle with both the S and
In master mode the SCL and SDA lines are manipu- P bits clear. When the bus is busy, enabling the SSP
lated by clearing the corresponding TRISC<4:3> bit(s). Interrupt will generate the interrupt when the STOP
The output level is always low, irrespective of the condition occurs.
value(s) in PORTC<4:3>. So when transmitting data, a In multi-master operation, the SDA line must be moni-
'1' data bit must have the TRISC<4> bit set (input) and tored to see if the signal level is the expected output
a '0' data bit must have the TRISC<4> bit cleared (out- level. This check only needs to be done when a high
put). The same scenario is true for the SCL line with the level is output. If a high level is expected and a low level
TRISC<3> bit. is present, the device needs to release the SDA and
The following events will cause SSP Interrupt Flag bit, SCL lines (set TRISC<4:3>). There are two stages
SSPIF, to be set (SSP Interrupt if enabled): where this arbitration can be lost, they are:
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
0Ch PIR1 LCDIF ADIF(1) — — SSPIF CCP1IF TMR2IF TMR1IF 00-- 0000 00-- 0000
8Ch PIE1 LCDIE ADIE(1) — — SSPIE CCP1IE TMR2IE TMR1IE 00-- 0000 00-- 0000
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
94h SSPSTAT SMP CKE D/A P S R/W UA BF 0000 0000 0000 0000
87h TRISC — — PORTC Data Direction Control Register --11 1111 --11 1111
Legend: I2
x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by SSP in C mode.
Note 1: Bits ADIE and ADIF are reserved on the PIC16C923, always maintain these bits clear.
IDLE_MODE (7-bit):
if (Addr_match) { Set interrupt;
if (R/W = 1) { Send ACK = 0;
set XMIT_MODE;
}
else if (R/W = 0) set RCV_MODE;
}
RCV_MODE:
if ((SSPBUF=Full) OR (SSPOV = 1))
{ Set SSPOV;
Do not acknowledge;
}
else { transfer SSPSR → SSPBUF;
send ACK = 0;
}
Receive 8-bits in SSPSR;
Set interrupt;
XMIT_MODE:
While ((SSPBUF = Empty) AND (CKP=0)) Hold SCL Low;
Send byte;
Set interrupt;
if ( ACK Received = 1) { End of transmission;
Go back to IDLE_MODE;
}
else if ( ACK Received = 0) Go back to XMIT_MODE;
IDLE_MODE (10-Bit):
If (High_byte_addr_match AND (R/W = 0))
{ PRIOR_ADDR_MATCH = FALSE;
Set interrupt;
if ((SSPBUF = Full) OR ((SSPOV = 1))
{ Set SSPOV;
Do not acknowledge;
}
else { Set UA = 1;
Send ACK = 0;
While (SSPADD not updated) Hold SCL low;
Clear UA = 0;
Receive Low_addr_byte;
Set interrupt;
Set UA = 1;
If (Low_byte_addr_match)
{ PRIOR_ADDR_MATCH = TRUE;
Send ACK = 0;
while (SSPADD not updated) Hold SCL low;
Clear UA = 0;
Set RCV_MODE;
}
}
}
else if (High_byte_addr_match AND (R/W = 1)
{ if (PRIOR_ADDR_MATCH)
{ send ACK = 0;
set XMIT_MODE;
}
else PRIOR_ADDR_MATCH = FALSE;
}
The ADRES register contains the result of the A/D con- 3. Wait the required acquisition time.
version. When the A/D conversion is complete, the 4. Start conversion:
result is loaded into the ADRES register, the GO/DONE • Set GO/DONE bit (ADCON0)
bit (ADCON0<2>) is cleared, and A/D interrupt flag bit
5. Wait for A/D conversion to complete, by either:
ADIF is set. The block diagram of the A/D module is
shown in Figure 12-3. • Polling for the GO/DONE bit to be cleared
100
RA5/AN4
VAIN
(Input voltage) 011
RA3/AN3/VREF
010
A/D RA2/AN2
Converter
001
RA1/AN1
AVDD 000
RA0/AN0
000 or
VREF 010 or
100
(Reference
voltage) 001 or
011
PCFG2:PCFG0
VHOLD = (VREF - (VREF/512)) • (1 - e(-Tc/CHOLD(RIC + RSS + RS))) TACQ = 5 µs + Tc + [(Temp - 25°C)(0.05 µs/°C)]
Given: VHOLD = (VREF/512), for 1/2 LSb resolution TC = -CHOLD (RIC + RSS + RS) ln(1/511)
The above equation reduces to: -51.2 pF (1 kΩ + 7 kΩ + 10 kΩ) ln(0.0020)
TC = -(51.2 pF)(1 kΩ - RSS + RS) ln(1/511) -51.2 pF (18 kΩ) ln(0.0020)
Example 12-1 shows the calculation of the minimum -0.921 µs (-6.2364)
required acquisition time (TACQ). This calculation is 5.747 µs
based on the following system assumptions.
TACQ = 5 µs + 5.747 µs + [(50°C - 25°C)(0.05 µs/°C)]
CHOLD = 51.2 pF
10.747 µs + 1.25 µs
Rs = 10 kΩ
11.997 µs
1/2 LSb error
VDD = 5V → Rss = 7 kΩ
Temp (system max.) = 50°C
VHOLD = 0 @ t = 0
FIGURE 12-4: ANALOG INPUT MODEL
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
(full scale)
255 LSb
256 LSb
0.5 LSb
1 LSb
2 LSb
3 LSb
4 LSb
sion is out of specification.
An external RC filter is sometimes added for anti-alias-
ing of the input signal. The R component should be
Analog input voltage
selected to ensure that the total source impedance is
kept under the 10 kΩ recommended specification. Any
external components connected (via hi-impedance) to
an analog input pin (capacitor, zener diode, etc.) should
have very little leakage current at the pin.
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
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
0Ch PIR1 LCDIF ADIF — — SSPIF CCP1IF TMR2IF TMR1IF 00-- 0000 00-- 0000
8Ch PIE1 LCDIE ADIE — — SSPIE CCP1IE TMR2IE TMR1IE 00-- 0000 00-- 0000
1Fh ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE (1) 0000 0000 0000 0000
ADON
9Fh ADCON1 — — — — — PCFG2 PCFG1 PCFG0 ---- -000 ---- -000
05h PORTA — — RA5 RA4 RA3 RA2 RA1 RA0 --0x 0000 --0u 0000
85h TRISA — — PORTA Data Direction Control Register --11 1111 --11 1111
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used for A/D conversion.
Note 1: Bit1 of ADCON0 is reserved, always maintain this bit clear.
128
LCD
to SEG<31:0>
Data Bus RAM
32 x 4 32 TO I/O PADS
MUX
Timing Control
LCDCON
COM3:COM0
LCDPS TO I/O PADS
LCDSE
V1
COM0
V0
COM0
V1
SEG0
V0
V1
SEG1
V0
V1
COM0-SEG0 V0
-V1
COM0-SEG1 V0
1 Frame
SEG1
SEG2
SEG7
SEG5
SEG4
SEG0
SEG6
SEG3
V2
COM0
V1
COM1
V0
V3
COM0
V2
COM1
V1
V0
V3
V2
SEG0
V1
V0
V3
SEG0
SEG1
SEG2
SEG3
V2
SEG1
V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
1 Frame
-V3
V3
V2
COM0
V1
V0
COM2 V3
V2
COM1
V1
COM1
V0
COM0
V3
V2
COM2
V1
V0
V3
V2
SEG0
V1
V0
SEG2
SEG1
SEG0
V3
V2
SEG1
V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
-V3
1 Frame
COM3
V3
V2
COM2 COM0 V1
V0
V3
COM1 COM1
V2
V1
COM0 V0
V3
V2
COM2 V1
V0
V3
V2
COM3 V1
V0
V3
V2
SEG0 V1
V0
SEG1
SEG0
V3
V2
SEG1 V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
-V3
1 Frame
• Internal RC oscillator The third source is the system clock divided by 256.
This divider ratio is chosen to provide about 32 kHz
• Timer1 oscillator
output when the external oscillator is 8 MHz. The
• System clock divided by 256 divider is not programmable. Instead the LCDPS regis-
The first timing source is an internal RC oscillator which ter is used to set the LCD frame clock rate.
runs at a nominal frequency of 14 kHz. This oscillator All of the clock sources are selected with bits CS1:CS0
provides a lower speed clock which may be used to (LCDCON<3:2>). Refer to Figure 13-1 for details of the
continue running the LCD while the processor is in register programming.
sleep. The RC oscillator will power-down when it is not
selected or when the LCD module is disabled.
COM0
COM1
COM2
COM3
FOSC ÷256
TMR1 32 kHz
crystal oscillator ÷4 Static
4-bit Programmable ÷32 ÷1,2,3,4
÷2 1/2 Prescaler Ring Counter
CS1:CS0 LMUX1:LMUX0
internal
data bus
V3
COM1 V2
V1
V0
V3
COM2 V2
V1
V0
V3
COM3 V2
V1
V0
1 Frame
TFINT
Frame Frame
Boundary TFWR Boundary
TFWR = TFRAME/(LMUX1:LMUX0 + 1)
TFINT = (TFWR /2 - (2TCY + 40 ns)) → min.
(TFWR /2 - (1TCY + 40 ns)) → max.
3/3V
Pin 2/3V
COM0
1/3V
0/3V
3/3V
Pin 2/3V
COM1
1/3V
0/3V
3/3V
Pin 2/3V
COM3
1/3V
0/3V
3/3V
Pin 2/3V
SEG0
1/3V
0/3V
interrupted
frame
VDD
10 µA
nominal
LCDEN
Charge Pump
SLPEN
Connections for
external R-ladder,
1/3 Bias,
10k* 10k* 10k* 5k* VGEN = 0
VDD
Connections for
external R-ladder,
10k* Static Bias,
VDD 5k* VGEN = 0
* These values are provided for design guidance only and should be
optimized to the application by the designer.
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 GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh, 18Bh
(1)
0Ch PIR1 LCDIF ADIF — — SSPIF CCP1IF TMR2IF TMR1IF 00-- 0000 00-- 0000
8Ch PIE1 LCDIE ADIE(1) — — SSPIE CCP1IE TMR2IE TMR1IE 00-- 0000 00-- 0000
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
10Dh LCDSE SE29 SE27 SE20 SE16 SE12 SE9 SE5 SE0 1111 1111 1111 1111
10Eh LCDPS — — — — LP3 LP2 LP1 LP0 ---- 0000 ---- 0000
10Fh LCDCON LCDEN SLPEN — VGEN CS1 CS0 LMUX1 LMUX0 00-0 0000 00-0 0000
SEG07 SEG06 SEG05 SEG04 SEG03 SEG02 SEG01 SEG00
110h LCDD00 xxxx xxxx uuuu uuuu
COM0 COM0 COM0 COM0 COM0 COM0 COM0 COM0
SEG15 SEG14 SEG13 SEG12 SEG11 SEG10 SEG09 SEG08
111h LCDD01 xxxx xxxx uuuu uuuu
COM0 COM0 COM0 COM0 COM0 COM0 COM0 COM0
SEG23 SEG22 SEG21 SEG20 SEG19 SEG18 SEG17 SEG16
112h LCDD02 xxxx xxxx uuuu uuuu
COM0 COM0 COM0 COM0 COM0 COM0 COM0 COM0
SEG31 SEG30 SEG29 SEG28 SEG27 SEG26 SEG25 SEG24
113h LCDD03 xxxx xxxx uuuu uuuu
COM0 COM0 COM0 COM0 COM0 COM0 COM0 COM0
SEG07 SEG06 SEG05 SEG04 SEG03 SEG02 SEG01 SEG00
114h LCDD04 xxxx xxxx uuuu uuuu
COM1 COM1 COM1 COM1 COM1 COM1 COM1 COM1
SEG15 SEG14 SEG13 SEG12 SEG11 SEG10 SEG09 SEG08
115h LCDD05 xxxx xxxx uuuu uuuu
COM1 COM1 COM1 COM1 COM1 COM1 COM1 COM1
SEG23 SEG22 SEG21 SEG20 SEG19 SEG18 SEG17 SEG16
116h LCDD06 xxxx xxxx uuuu uuuu
COM1 COM1 COM1 COM1 COM1 COM1 COM1 COM1
SEG31 SEG30 SEG29 SEG28 SEG27 SEG26 SEG25 SEG24
117h LCDD07 xxxx xxxx uuuu uuuu
COM1(2) COM1 COM1 COM1 COM1 COM1 COM1 COM1
SEG07 SEG06 SEG05 SEG04 SEG03 SEG02 SEG01 SEG00
118h LCDD08 xxxx xxxx uuuu uuuu
COM2 COM2 COM2 COM2 COM2 COM2 COM2 COM2
SEG15 SEG14 SEG13 SEG12 SEG11 SEG10 SEG09 SEG08
119h LCDD09 xxxx xxxx uuuu uuuu
COM2 COM2 COM2 COM2 COM2 COM2 COM2 COM2
SEG23 SEG22 SEG21 SEG20 SEG19 SEG18 SEG17 SEG16
11Ah LCDD10 xxxx xxxx uuuu uuuu
COM2 COM2 COM2 COM2 COM2 COM2 COM2 COM2
SEG31 SEG30 SEG29 SEG28 SEG27 SEG26 SEG25 SEG24
11Bh LCDD11 xxxx xxxx uuuu uuuu
COM2(2) COM2(2) COM2 COM2 COM2 COM2 COM2 COM2
SEG07 SEG06 SEG05 SEG04 SEG03 SEG02 SEG01 SEG00
11Ch LCDD12 xxxx xxxx uuuu uuuu
COM3 COM3 COM3 COM3 COM3 COM3 COM3 COM3
SEG15 SEG14 SEG13 SEG12 SEG11 SEG10 SEG09 SEG08
11Dh LCDD13 xxxx xxxx uuuu uuuu
COM3 COM3 COM3 COM3 COM3 COM3 COM3 COM3
SEG23 SEG22 SEG21 SEG20 SEG19 SEG18 SEG17 SEG16
11Eh LCDD14 xxxx xxxx uuuu uuuu
COM3 COM3 COM3 COM3 COM3 COM3 COM3 COM3
SEG31 SEG30 SEG29 SEG28 SEG27 SEG26 SEG25 SEG24
11Fh LCDD15 xxxx xxxx uuuu uuuu
COM3(2) COM3(2) COM3(2) COM3 COM3 COM3 COM3 COM3
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the LCD Module.
Note 1: These bits are reserved on the PIC16C923, always maintain these bits clear.
2: These pixels do not display, but can be used as general purpose RAM.
CP1 CP0 CP1 CP0 CP1 CP0 — — CP1 CP0 PWRTE WDTE FOSC1 FOSC0 Register: CONFIG
Address 2007h
bit13 bit0
bit 13-8 CP1:CP0 Code protection bits (1)
5-4: 11 = Code protection off
10 = Upper half of program memory code protected
01 = Upper 3/4 of program memory code protected
00 = All memory is code protected
bit 6: Unimplemented: Read as '1'
bit 3: PWRTE: Power-up Timer Enable bit
1 = PWRT disabled
0 = PWRT enabled
bit 2: WDTE: Watchdog Timer Enable bit
1 = WDT enabled
0 = WDT disabled
bit 1-0: FOSC1:FOSC0: Oscillator Selection bits
11 = RC oscillator
10 = HS oscillator
01 = XT oscillator
00 = LP oscillator
Note 1: All of the CP1:CP0 bits have to be given the same value to enable the code protection scheme listed.
MCLR
SLEEP
WDT WDT
Module Time-out
VDD rise
detect
Power-on Reset
VDD
OST/PWRT
OST
Chip_Reset
10-bit Ripple counter R Q
OSC1
(1) PWRT
On-chip
RC OSC 10-bit Ripple counter
Enable PWRT(2)
Enable OST(2)
Note 1: This is a separate oscillator from the RC oscillator of the CLKIN pin.
2: See Table 14-3 for time-out situations.
POR TO PD
0 1 1 Power-on Reset
0 0 x Illegal, TO is set on POR
0 x 0 Illegal, PD is set on POR
1 0 1 WDT Reset
1 0 0 WDT Wake-up
1 u u MCLR Reset during normal operation
1 1 0 MCLR Reset during SLEEP or interrupt wake-up from SLEEP
Legend: u = unchanged, x = unknown
TABLE 14-5: RESET CONDITION FOR SPECIAL REGISTERS
VDD
MCLR
INTERNAL POR
TPWRT
OST TIME-OUT
INTERNAL RESET
FIGURE 14-9: 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 MCLR
R
R1 40k
MCLR PIC16CXXX
C PIC16CXXX
Q1
MCLR
R2 40k
PIC16CXXX
TMR1IF
Wake-up (If in SLEEP mode)
TMR1IE T0IF
T0IE
INTF
TMR2IF INTE
TMR2IE Interrupt to CPU
RBIF
RBIE
LCDIF PEIF
LCDIE
PEIE
GIE
CCP1IF
CCP1IE
SSPIF
SSPIE
ADIF
ADIE
The A/D module interrupt is implemented on the PIC16C924 only.
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)
0
M Postscaler
1 U
WDT Timer
X 8
8 - to - 1 MUX PS2:PS0
PSA
WDT
Enable Bit
To TMR0 (Figure 7-6)
0 1
MUX PSA
WDT
Note: PSA and PS2:PS0 are bits in the OPTION register. Time-out
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
2007h Config. bits (1) (1) CP1 CP0 PWRTE(1) WDTE FOSC1 FOSC0
81h, 181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0
Legend: Shaded cells are not used by the Watchdog Timer.
Note 1: See Figure 14-1 for operation of these bits.
The following peripheral interrupts can wake the device To ensure that the WDT is cleared, a CLRWDT instruc-
from SLEEP: tion should be executed before a SLEEP instruction.
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)
INT pin
INTF flag
(INTCON<1>) Interrupt Latency
(Note 2)
GIE bit Processor in
(INTCON<7>)
SLEEP
INSTRUCTION FLOW
PC PC PC+1 PC+2 PC+2 PC + 2 0004h 0005h
Instruction
fetched Inst(PC) = SLEEP Inst(PC + 1) Inst(PC + 2) Inst(0004h) Inst(0005h)
14.9 Program Verification/Code Protection After reset, to place the device into program/verify
mode, the program counter (PC) is at location 00h. A
If the code protection bit(s) have not been pro-
6-bit command is then supplied to the device. Depend-
grammed, the on-chip program memory can be read
ing on the command, 14-bits of program data are then
out for verification purposes.
supplied to or from the device, depending if the com-
Note: Microchip does not recommend code pro- mand was a load or a read. For complete details of
tecting windowed devices. serial programming, please refer to the PIC16C6X/7X
Programming Specifications (Literature #DS30228).
14.10 ID Locations
Four memory locations (2000h - 2003h) are designated FIGURE 14-19:TYPICAL IN-CIRCUIT SERIAL
as ID locations where the user can store checksum or PROGRAMMING
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-
mended that only the 4 least significant bits of the ID To Normal
Connections
location are used. External
Connector PIC16CXXX
Signals
14.11 In-Circuit Serial Programming
+5V VDD
PIC16CXXX microcontrollers can be serially pro-
grammed while in the end application circuit. This is 0V VSS
simply done with two lines for clock and data, and three VPP MCLR/VPP
other lines for power, ground, and the programming
CLK RB6
voltage. This allows customers to manufacture boards
with unprogrammed devices, and then program the Data I/O RB7
microcontroller just before shipping the product. This
also allows the most recent firmware or a custom firm-
ware to be programmed. VDD
The device is placed into a program/verify mode by To Normal
holding the RB6 and RB7 pins low while raising the Connections
MCLR (VPP) pin from VIL to VIHH (see programming
specification). RB6 becomes the programming clock
and RB7 becomes the programming data. Both RB6
and RB7 are Schmitt Trigger inputs in this mode.
Before Instruction
W = 0x10 Example ADDWF FSR, 0
After Instruction
W = 0x25 Before Instruction
W = 0x17
FSR = 0xC2
After Instruction
W = 0xD9
FSR = 0xC2
Cycles: 1 Words: 1
Q Cycle Activity: Q1 Q2 Q3 Q4 Cycles: 1
Decode Read Process Write to Q Cycle Activity: Q1 Q2 Q3 Q4
literal "k" data W
Decode Read Process Write to
register data destination
ANDLW 0x5F 'f'
Example
Before Instruction
Example ANDWF FSR, 1
W = 0xA3
After Instruction Before Instruction
W = 0x03
W = 0x17
FSR = 0xC2
After Instruction
W = 0x17
FSR = 0x02
Words: 1
Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read Process Write
register data register 'f'
'f'
Before Instruction
FLAG_REG = 0xC7
After Instruction
FLAG_REG = 0x47
Description: Bit 'b' in register 'f' is set. Description: If bit 'b' in register 'f' is '1' then the next
instruction is executed.
Words: 1 If bit 'b', in register 'f', is '0' then the next
instruction is discarded, and a NOP is
Cycles: 1 executed instead, making this a 2TCY
Q Cycle Activity: Q1 Q2 Q3 Q4 instruction.
Before Instruction
PC = address HERE
After Instruction
if FLAG<1> = 0,
PC = address TRUE
if FLAG<1>=1,
PC = address FALSE
Example CLRW
Example CLRF FLAG_REG
COMF Complement f
CLRWDT Clear Watchdog Timer
Syntax: [ label ] COMF f,d
Syntax: [ label ] CLRWDT
Operands: 0 ≤ f ≤ 127
Operands: None
d ∈ [0,1]
Operation: 00h → WDT
Operation: (f) → (destination)
0 → WDT prescaler,
1 → TO Status Affected: Z
1 → PD 00 1001 dfff ffff
Encoding:
Status Affected: TO, PD
Description: The contents of register 'f' are comple-
Encoding: 00 0000 0110 0100 mented. If 'd' is 0 the result is stored in
W. If 'd' is 1 the result is stored back in
register 'f'.
Description: CLRWDT instruction resets the Watch-
dog Timer. It also resets the prescaler
of the WDT. Status bits TO and PD are Words: 1
set.
Cycles: 1
Words: 1
Q Cycle Activity: Q1 Q2 Q3 Q4
Cycles: 1
Decode Read Process Write to
register data destination
Q Cycle Activity: Q1 Q2 Q3 Q4 'f'
Decode No- Process Clear
Operation data WDT
Counter Example COMF REG1,0
Before Instruction
Example CLRWDT REG1 = 0x13
After Instruction
Before Instruction REG1 = 0x13
WDT counter = ? W = 0xEC
After Instruction
WDT counter = 0x00
DECF Decrement f
WDT prescaler= 0
TO = 1 Syntax: [label] DECF f,d
PD = 1
Operands: 0 ≤ f ≤ 127
d ∈ [0,1]
Operation: (f) - 1 → (destination)
Status Affected: Z
Encoding: 00 0011 dfff ffff
Words: 1
Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read Process Write to
register data destination
'f'
Before Instruction
CNT = 0x01
Z = 0
After Instruction
CNT = 0x00
Z = 1
Q1 Q2 Q3 Q4 After Instruction
No- No- No- No-
PC = Address THERE
Operation Operation Operation Operation
Before Instruction
PC = address HERE
After Instruction
CNT = CNT - 1
if CNT = 0,
PC = address CONTINUE
if CNT ≠ 0,
PC = address HERE+1
Before Instruction
PC = address HERE
After Instruction
CNT = CNT + 1
if CNT= 0,
PC = address CONTINUE
if CNT≠ 0,
PC = address HERE +1
Cycles: 1 Words: 1
Q Cycle Activity: Q1 Q2 Q3 Q4
Example MOVWF OPTION_REG
Decode Read Process Write to
register data destination
'f' Before Instruction
OPTION = 0xFF
W = 0x4F
Example MOVF FSR, 0 After Instruction
OPTION = 0x4F
After Instruction W = 0x4F
W = value in FSR register
Z =1
Words: 1
Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read Process Write to
literal 'k' data W
After Instruction
W = 0x5A
Example RETFIE
After Interrupt
PC = TOS
GIE = 1
OPTION Load Option Register
Syntax: [ label ] OPTION
Operands: None
Operation: (W) → OPTION
Status Affected: None
Encoding: 00 0000 0110 0010
Words: 1 Cycles: 2
1st Cycle Decode Read No- Write to W, 2nd Cycle No- No- No- No-
literal 'k' Operation Pop from Operation Operation Operation Operation
the Stack
Before Instruction
W = 0x07
After Instruction
W = value of k8
RLF Rotate Left f through Carry RRF Rotate Right f through Carry
Syntax: [ label ] RLF f,d Syntax: [ label ] RRF f,d
Operands: 0 ≤ f ≤ 127 Operands: 0 ≤ f ≤ 127
d ∈ [0,1] d ∈ [0,1]
Operation: See description below Operation: See description below
Status Affected: C Status Affected: C
Encoding: 00 1101 dfff ffff Encoding: 00 1100 dfff ffff
Description: The contents of register 'f' are rotated Description: The contents of register 'f' are rotated
one bit to the left through the Carry one bit to the right through the Carry
Flag. If 'd' is 0 the result is placed in the Flag. If 'd' is 0 the result is placed in the
W register. If 'd' is 1 the result is stored W register. If 'd' is 1 the result is placed
back in register 'f'. back in register 'f'.
C Register f C Register f
Words: 1 Words: 1
Cycles: 1 Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read Process Write to Decode Read Process Write to
register data destination register data destination
'f' 'f'
Words: 1
Example 1: SUBLW 0x02
Cycles: 1
Before Instruction
Q Cycle Activity: Q1 Q2 Q3 Q4
W = 1
Decode No- No- Go to
C = ?
Operation Operation Sleep
Z = ?
After Instruction
Example: SLEEP
W = 1
C = 1; result is positive
Z = 0
After Instruction
W = 0
C = 1; result is zero
Z = 1
After Instruction
W = 0xFF
C = 0; result is nega-
tive
Z = 0
Emulator Products
MPLAB
PIC16C9XX
Integrated
Development
Environment ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
MPLAB C
Compiler ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
fuzzyTECH-MP
Explorer/Edition
Fuzzy Logic
Dev. Tool ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
Software Tools
MP-DriveWay
Applications
Code Generator ✔ ✔ ✔ ✔ ✔ ✔
Total Endurance
Software Model ✔
PICSTART
DEVELOPMENT TOOLS FROM MICROCHIP
Programmers
Programmer ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
KEELOQ
Programmer ✔
SEEVAL
Designers Kit ✔
PICDEM-1 ✔ ✔ ✔ ✔
PICDEM-2 ✔ ✔
PICDEM-3 ✔
Demo Boards
KEELOQ
✔
† 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.
TABLE 17-1: CROSS REFERENCE OF DEVICE SPECS FOR OSCILLATOR CONFIGURATIONS AND
FREQUENCIES OF OPERATION (COMMERCIAL DEVICES)
PIC16C923-04 PIC16C923-08 PIC16LC923-04
OSC CL Devices
PIC16C924-04 PIC16C924-08 PIC16LC924-04
VDD: 4.0V to 6.0V VDD: 4.5V to 5.5V VDD: 2.5V to 6.0V VDD: 2.5V to 6.0V
IDD: 5 mA max. at 5.5V IDD: 2.7 mA typ. at 5.5V IDD: 3.8 mA max. at 3.0V IDD: 5 mA max. at 5.5V
RC
IPD: 21 µA max. at 4V IPD: 1.5 µA typ. at 4V IPD: 5 µA max. at 3V IPD: 21 µA max. at 4V
Freq: 4 MHz max. Freq: 4 MHz max. Freq: 4 MHz max. Freq: 4 MHz max.
VDD: 4.0V to 6.0V VDD: 4.5V to 5.5V VDD: 2.5V to 6.0V VDD: 2.5V to 6.0V
IDD: 5 mA max. at 5.5V IDD: 2.7 mA typ. at 5.5V IDD: 3.8 mA max. at 3.0V IDD: 5 mA max. at 5.5V
XT
IPD: 21 µA max. at 4V IPD: 1.5 µA typ. at 4V IPD: 5 µA max. at 3V IPD: 21 µA max. at 4V
Freq: 4 MHz max. Freq: 4 MHz max. Freq: 4 MHz max. Freq: 4 MHz max.
VDD: 4.5V to 5.5V VDD: 4.5V to 5.5V VDD: 4.5V to 5.5V
IDD: 3.5 mA typ. at 5.5V IDD: 7 mA max. at 5.5V IDD: 7 mA max. at 5.5V
HS Do not use in HS mode
IPD: 1.5 µA typ. at 4.5V IPD: 1.5 µA typ. at 4.5V IPD: 1.5 µA typ. at 4.5V
Freq: 4 MHz max. Freq: 8 MHz max. Freq: 8 MHz max.
VDD: 4.0V to 6.0V VDD: 2.5V to 6.0V
VDD: 2.5V to 6.0V
IDD: 22.5 µA typ. IDD: 30 µA max.
IDD: 30 µA max. at 32 kHz, 3.0V
LP at 32 kHz, 4.0V Do not use in LP mode at 32 kHz, 3.0V
IPD: 5 µA max. at 3.0V
IPD: 1.5 µA typ. at 4.0V IPD: 5 µA max. at 3.0V
Freq: 200 kHz max.
Freq: 200 kHz max. Freq: 200 kHz max.
The shaded sections indicate oscillator selections which are tested for functionality, but not for MIN/MAX specifications.
It is recommended that the user select the device type that ensures the specifications required.
D223 D224
VLCD3
VLCD2
VLCD1
VSS
Parameter
Symbol Characteristic Min Typ Max Units Conditions
No.
VDD/2
RL
CL CL
Pin Pin
VSS VSS
RL = 464Ω
CL = 50 pF for all pins except OSC2 unless otherwise noted.
15 pF for OSC2 output
OSC1
1 3 3 4 4
2
CLKOUT
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
Time-out 32
OSC
Time-out
Internal
RESET
Watchdog
Timer
RESET
31
34
34
I/O Pins
TABLE 17-6: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER AND POWER-UP TIMER
REQUIREMENTS
Parameter Sym Characteristic Min Typ† Max Units Conditions
No.
30 TmcL MCLR Pulse Width (low) 2 — — µs
31* Twdt Watchdog Timer Time-out Period 7 18 33 ms VDD = 5V, -40˚C to +85˚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 +85˚C
34 TIOZ I/O Hi-impedance from MCLR Low — — 2.1 µs
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.
RA4/T0CKI
40 41
42
RC0/T1OSO/T1CKI
45 46
47 48
TMR0 or
TMR1
Refer to Figure 17-2 for load conditions.
RC2/CCP1
(Capture Mode)
50 51
52
RC2/CCP1
(Compare or PWM Mode)
53 54
SS
70
SCK
(CKP = 0)
71 72
78 79
SCK
(CKP = 1)
79 78
80
75, 76
SS
81
SCK
(CKP = 0)
71 72
79
73
SCK
(CKP = 1)
80
78
75, 76
74
SS
70
SCK
(CKP = 0) 83
71 72
78 79
SCK
(CKP = 1)
79 78
80
75, 76 77
74
73
Refer to Figure 17-2 for load conditions.
82
SS
70
SCK 83
(CKP = 0)
71 72
SCK
(CKP = 1)
80
75, 76 77
SDI
MSb IN BIT6 - - - -1 LSb IN
74
SCL
91 93
90 92
SDA
START STOP
Condition Refer to Figure 17-2 for load conditions. Condition
SDA
Out
Refer to Figure 17-2 for load conditions.
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.
FIGURE 18-1: TYPICAL IPD vs. VDD (WDT FIGURE 18-3: TYPICAL IPD vs. VDD (WDT
DISABLED, RC MODE @ ENABLED, RC MODE @
25°C) 25°C)
280 25.0
260 20.0
IPD(µA)
240
15.0
220
IPD(nA)
10.0
200
180 5.0
160 0.0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
140 VDD (VOLTS)
120
FIGURE 18-4: MAXIMUM IPD vs. VDD (WDT
100 ENABLED, RC MODE -40°C TO
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 +85°C)
VDD (VOLTS)
40.0
35.0
FIGURE 18-2: MAXIMUM IPD vs. VDD (WDT
30.0
DISABLED, RC MODE -40°C
TO +85°C) 25.0
3.5
IPD(µA)
20.0
3.0
15.0
2.5
10.0
2.0
5.0
IPD(µA)
1.5
0.0
1.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
0.5
0.0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
55 80
50 70
IPD(µA)
45 60
IPD(µA)
40 50
35 40
30 30
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (VOLTS) 20
C Spec @ 4.0V = 41
LC Spec @ 3.0V = 37 10
0
FIGURE 18-6: MAXIMUM IPD vs. VDD (LCD ON 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
(32 kHz(1)), INTERNAL RC (32 VDD (VOLTS)
kHz(2)), RC MODE -40°C TO
+85°C)
70 FIGURE 18-8: MAXIMUM IPD vs. VDD (LCD
ON(1), TIMER1(32 kHz(2)), RC
65
MODE -40°C TO +85°C)
Data based on process characterization samples. See first page of this section for details.
60 180
IPD(µA)
55 160
50
140
45 120
IPD(µA)
40 100
35 80
30 60
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
C Spec @ 4.0V = 45 VDD (VOLTS) 40
LC Spec @ 3.0V = 40
20
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
Note 1: The LCD module is turned on, internal charge pump enabled, 1/4 MUX, 32 Hz frame frequency and no load
on LCD segments/commons. IPD will increase depending on the LCD panel connected to the PIC16C9XX.
Note 2: Indicates the clock source to the LCD module.
3.5
20
3.0
R = 10k
IPD(µA)
2.5 15
2.0
1.5 10
1.0
R = 100k 5
0.5
0.0 0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (VOLTS) VDD (VOLTS)
Data based on process characterization samples. See first page of this section for details.
1.6 40
Fosc(MHz)
R = 5k
1.4 35
1.2 30
1.0 25
IPD(µA)
R = 10k
0.8 20
0.6
15
0.4
R = 100k 10
0.2
5
0.0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 0
VDD (VOLTS) 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (Volts)
600
R = 5k
500
400
R = 10k
300
200
100 R = 100k
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
2500
6.0V
5.5V
2000
5.0V
4.5V
IDD(µA)
4.0V
1500
3.5V
3.0V
1000
2.5V
500
0
0.0 1.00 2.00 3.00 4.00 5.00
Frequency (MHz) Shaded area is
Typical 2.7 mA @ 4 MHz, 5.5V beyond recommended range
Data based on process characterization samples. See first page of this section for details.
FIGURE 18-15:MAXIMUM IDD vs. FREQUENCY (RC MODE @ 20 pF, -40°C TO +85°C)
3500
6.0V
3000
5.5V
5.0V
2500
IDD(µA)
4.5V
4.0V
2000
3.5V
3.0V
1500 2.5V
1000
500
0
0.0 1.00 2.00 3.00 4.00 5.00
Frequency (MHz) Shaded area is
Maximum 5.0 mA @ 4 MHz, 5.5V beyond recommended range
1400
6.0V
5.5V
1200
5.0V
4.5V
1000
4.0V
3.5V
IDD(µA)
800
3.0V
2.5V
600
400
200
0
0 200 400 600 800 1000 1200 1400 1600
Shaded area is Frequency (kHz)
beyond recommended range
Data based on process characterization samples. See first page of this section for details.
FIGURE 18-17:MAXIMUM IDD vs. FREQUENCY (RC MODE @ 100 pF, -40°C TO +85°C)
1600
6.0V
5.5V
1400
5.0V
4.5V
1200
4.0V
3.5V
1000
3.0V
IDD(µA)
2.5V
800
600
400
200
0
0 200 400 600 800 1000 1200 1400 1600
Shaded area is Frequency (kHz)
beyond recommended range
1200
6.0V
5.5V
1000
5.0V
4.5V
800 4.0V
3.5V
IDD(µA)
600 3.0V
2.5V
400
200
0
0 100 200 300 400 500 600 700
Frequency (kHz)
Data based on process characterization samples. See first page of this section for details.
FIGURE 18-19:MAXIMUM IDD vs. FREQUENCY (RC MODE @ 300 pF, -40°C TO +85°C)
1400
6.0V
1200 5.5V
5.0V
1000 4.5V
4.0V
3.5V
800
IDD(µA)
3.0V
2.5V
600
400
200
0
0 100 200 300 400 500 600 700
Frequency (kHz)
gm(mA/V)
100 pF 3.3k 1.80 MHz ± 1.0% 2.0
60 Typ 25°C
50
Data based on process characterization samples. See first page of this section for details.
40
30
20 Min 85°C
10
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0
Shaded areas are VDD (VOLTS)
beyond recommended range
FIGURE 18-22:TRANSCONDUCTANCE(gm)
OF XT OSCILLATOR vs. VDD
1000
900 Max -40°C
800
700
gm(µA/V)
3.0
120
2.5
100
Startup Time(Seconds)
IDD(µA)
1.0
40
FIGURE 18-24:TYPICAL XTAL STARTUP TIME LC Spec -> Typical = 22.5 µA, 32 kHz, 4.0V
vs. VDD (HS MODE, 25°C)
7
FIGURE 18-27:MAXIMUM IDD vs. VDD
6 (LP MODE -40°C TO +85°C)
Startup Time(ms)
Data based on process characterization samples. See first page of this section for details.
5
140
4
8 MHz, 33 pF/33 pF 120
3
8 MHz, 15 pF/15 pF
100
2
200 kHz, 15 pF/15 pF
1 80
4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
60
FIGURE 18-25:TYPICAL XTAL STARTUP TIME
IDD(µA)
50 0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
Startup Time(ms)
40 VDD (VOLTS)
200 kHz, 68 pF/68 pF
10 4 MHz, 15 pF/15 pF
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
7
1600
1400 6
1200
5
4 MHz, 15 pF/15 pF
1000
4
IDD(µA)
800 8 MHz, 15 pF/15 pF
1 MHz, 15 pF/15 pF
600 3
IDD(µA)
400 2
200
1
200 kHz, 33 pF/33 pF
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 0
4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
VDD (VOLTS)
Typical = 2.7 µA, 4 MHz, 5.5V
Typical = 3.5 mA, 8 MHz, 5.5V
Data based on process characterization samples. See first page of this section for details.
2500 8
2000 7
1500 6
IDD(µA)
1000 5
500 4
IDD (MA)
0
4.0 4.5 5.0 5.5 6.0
VDD (VOLTS)
e/2
A
E1 A E
DETAIL A
e
E/2
See Detail A
8 Places
11/13° 0° min.
A
A2
See Detail B Datum Plane
0.25
b 0.08
with Lead Finish A1 R min. 0-7°
Gauge Plane
0.09/0.20 0.09/0.16 0.20 min.
L
b1 1.00 ref.
Base Metal
DETAIL B
α
E1 E C
eA
Pin No. 1 eB
Indicator Area
D
S S1
Base
Plane
Seating
Plane L
B1 e1 A1 A2 A
B
D1
D 0.812/0.661 N Pics
0.177 1.27 .032/.026
.007 S B D-E S .050
2 Sides -H- 0.177
-A- .007 S B A S
D1 A
A1 2 Sides
-D- 3 9
D3/E3
0.101 Seating
D2 D
.004 Plane
0.38 -C-
3 .015 F-G S 4
3 -G-
8 E2
-F-
E1 E
0.38
.015 F-G S 4
-B-
3 -E- 0.177
.007 S A F-G S
10
0.812/0.661
0.254 0.254 3
.032/.026
.010 Max 11 .010 Max 11
1.524
0.508 0.508
2 -H- .060 Min
.020 .020 -H- 2
6
6
-C-
5
1.651 1.651 0.64 Min 0.533/0.331
.065 .065 .025 .021/.013
R 1.14/0.64 R 1.14/0.64
.045/.025 .045/.025 0.177
, D-E S
.007 M A F-G S
MMMMMMMMMMMMMMMMM PIC16C924-04/CL
AABBCDE 9650CAE
MMMMMMMMMM PIC16C923
MMMMMMM -08I/PT
AABBCDE 9712CAE
MMMMMMMMMM PIC16C924
MMMMMMM -08/L
AABBCDE 9648CAE
MMMMMMMMMMMMMMMMM PIC16C924-04I/SP
AABBCDE 9736CAE
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 data sheet easy to follow? If not, why?
4. What additions to the data sheet do you think would enhance the structure and subject?
5. What deletions from the data sheet could be made without affecting the overall usefulness?
8. How would you improve our software, systems, and silicon products?
* CL Devices are UV erasable and can be programmed to any device configuration. CL Devices meet the electrical requirement of
each oscillator type (including LC devices).
• The PICmicro family meets the specifications contained in the Microchip Data Sheet.
• Microchip believes that its family of PICmicro microcontrollers is one of the most secure products 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 knowl-
edge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet.
The person doing so may be 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 product.
If you have any further questions about this matter, please contact the local sales office nearest to you.
03/01/02