Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in 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.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
K
rfPIC and UNI/O are registered trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
logo, REAL ICE, rfLAB, Select Mode, Total
Endurance, TSHARC, UniWinDriver, WiperLock and ZENA
are trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
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.
®
MCUs and dsPIC® DSCs, KEELOQ
®
code hopping
DS41364D-page 2Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
28/40/44-Pin Flash-Based, 8-Bit CMOS Microc ontrollers with
LCD Driver with nanoWatt XLP Technology
Devices Included In This Data Sheet:
PIC16F193X Devices:
• PIC16F1933• PIC16F1934
• PIC16F1936• PIC16F1937
• PIC16F1938• PIC16F1939
PIC16LF193X Devices:
• PIC16LF1933• PIC16LF1934
• PIC16LF1936• PIC16LF1937
• PIC16LF1938• PIC16LF1939
High-Performance RISC CPU:
• Only 49 Instructions to Learn:
- All single-cycle instructions except branches
• Operating Speed:
- DC – 32 MHz oscillator/clock input
- DC – 125 ns instruction cycle
• Up to 16K x 14 Words of Flash Program Memory
• Up to 1024 Bytes of Data Memory (RAM)
• Interrupt Capability with automatic context saving
• 16-Level Deep Hardware Stack
• Direct, Indirect and Relative Addressing modes
• Processor Read Access to Program Memory
• Pinout Compatible to other 28/40-pin PIC16CXXX
and PIC16FXXX Microcontrollers
Special Microcontroller Features:
• Precision Internal Oscillator:
- Factory calibrated to ±1%, typical
- Software selectable frequency range from
32 MHz to 31 kHz
• Power-Saving Sleep mode
• Power-on Reset (POR)
• Power-up Timer (PWRT) and Oscillator Start-up
Timer (OST)
11.0 Data EEPROM and Flash Program Memory Control ............................................................................................................... 115
18.0 SR Latch................................................................................................................................................................................... 183
23.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 237
27.0 In-Circuit Serial Programming™ (ICSP™) ............................................................................................................................... 361
28.0 Instruction Set Summary.......................................................................................................................................................... 365
32.0 DC and AC Characteristics Graphs and Charts ....................................................................................................................... 475
33.0 Development Support............................................................................................................................................................... 477
Appendix A: Data Sheet Revision History .......................................................................................................................................... 495
Appendix B: Migrating From Other PIC
Index .................................................................................................................................................................................................. 497
The Microchip Web Site..................................................................................................................................................................... 505
Customer Change Notification Service .............................................................................................................................................. 505
Customer Support .............................................................................................................................................................................. 505
DS41364D-page 12Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@mail.microchip.com or fax the Reader Response Form in the back of this data sheet to (480) 792-4150.
We welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
• The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (include
literature number) you are using.
Customer Notification System
Register on our web site at www.microchip.com/cn to receive the most current information on all of our products.
DS41364D-page 14Preliminary 2009 Microchip Technology Inc.
1.0DEVICE OVERVIEW
The PIC16F193X/LF193X are described within this
data sheet. They are available in 28/40/44-pin packages. Figure 1-1 shows a block diagram of the
PIC16F193X/LF193X devices. Table 1-2 shows the
pinout descriptions.
Reference Table 1-1 for peripherals available per
device.
TABLE 1-1:DEVICE PERIPHERAL
SUMMARY
Peripheral
PIC16F193X/LF193X
PIC16F193X
ADC●●
Capacitive Sensing Module●●
Digital-to-Analog Converter (DAC)●●
EUSART●●
Fixed Voltage Reference (FVR)●●
LCD●●
SR Latch●●
Capture/Compare/PWM Modules
Note 1:See applicable chapters for more information on peripherals.
CPU
Program
Flash Memory
EEPROM
RAM
Timing
Generation
INTRC
Oscillator
MCLR
Figure 2-1
OSC1/CLKI
OSC2/CLKO
FIGURE 1-1:PIC16F193X/LF193X BLOCK DIAGRAM
DS41364D-page 16Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
T ABLE 1-2:PIC16F193X/LF193X PINOUT DESCRIPTION
Input
NameFunction
RA0/AN0/C12IN0-/C2OUT
(1)
(1)
/SS
SRNQ
/VCAP
(2)
/SEG12
(1)
/
RA0TTLCMOS General purpose I/O.
AN0AN—A/D Channel 0 input.
C12IN0-
C2OUT—CMOS Comparator C2 output.
SRNQ—CMOS SR Latch inverting output.
SS
CAPPower Power Filter capacitor for Voltage Regulator (PIC16F193X only).
V
SEG12—ANLCD Analog output.
RA1/AN1/C12IN1-/SEG7RA1TTLCMOS General purpose I/O.
AN1AN—A/D Channel 1 input.
C12IN1-
SEG7—ANLCD Analog output.
RA2/AN2/C2IN+/V
DACOUT/COM2
REF-/
RA2TTLCMOS General purpose I/O.
AN2AN—A/D Channel 2 input.
C2IN+
VREF-AN—A/D Negative Voltage Reference input.
DACOUT—ANVoltage Reference output.
COM2—ANLCD Analog output.
RA3/AN3/C1IN+/V
(3)
COM3
/SEG15
REF+/
RA3TTLCMOS General purpose I/O.
AN3AN—A/D Channel 3 input.
C1IN+
VREF+AN—A/D Voltage Reference input.
(3)
COM3
SEG15—ANLCD Analog output.
RA4/C1OUT/CPS6/T0CKI/SRQ/
CCP5/SEG4
RA4TTLCMOS General purpose I/O.
C1OUT—CMOS Comparator C1 output.
CPS6AN—Capacitive sensing input 6.
T0CKIST—Timer0 clock input.
SRQ
CCP5STCMOS Capture/Compare/PWM5.
SEG4—ANLCD Analog output.
RA5/AN4/C2OUT
(1)
(1)
/SS
SRNQ
/VCAP
(1)
/CPS7/
(2)
/SEG5
RA5TTLCMOS General purpose I/O.
AN4AN—A/D Channel 4 input.
C2OUT—CMOS Comparator C2 output.
CPS7AN—Capacitive sensing input 7.
SRNQ—CMOS SR Latch inverting output.
SS
V
CAPPower Power Filter capacitor for Voltage Regulator (PIC16F193X only).
SEG5—ANLCD Analog output.
Legend: AN = Analog input or output CMOS= CMOS compatible input or outputOD = Open Drain
TTL = TTL compatible inputST= Schmitt Trigger input with CMOS levels I
HV = High VoltageXTAL = Crystallevels
Note 1:Pin function is selectable via the APFCON register.
2:PIC16F193X devices only.
3:PIC16F/LF1933/1936/1938 devices only.
4:PORTD is available on PIC16F/LF1934/1937/1939 devices only.
5:RE<2:0> are available on PIC16F/LF1934/1937/1939 devices only.
RA7/OSC1/CLKIN/SEG2RA7TTLCMOS General purpose I/O.
RB0/AN12/CPS0/CCP4/SRI/INT/
SEG0
RB1/AN10/C12IN3-/CPS1/P1C/
VLCD1
RB2/AN8/CPS2/P1B/VLCD2RB2TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
RB3/AN9/C12IN2-/CPS3/
(1)
(1)
/P2A
CCP2
Legend: AN = Analog input or output CMOS= CMOS compatible input or outputOD = Open Drain
Note 1:Pin function is selectable via the APFCON register.
/VLCD3
TTL = TTL compatible inputST= Schmitt Trigger input with CMOS levels I
HV = High VoltageXTAL = Crystallevels
2:PIC16F193X devices only.
3:PIC16F/LF1933/1936/1938 devices only.
4:PORTD is available on PIC16F/LF1934/1937/1939 devices only.
5:RE<2:0> are available on PIC16F/LF1934/1937/1939 devices only.
CAP
(2)
/
RA6TTLCMOS General purpose I/O.
OSC2—XTAL Crystal/Resonator (LP, XT, HS modes).
CLKOUT—CMOS F
CAPPower Power Filter capacitor for Voltage Regulator (PIC16F193X only).
V
SEG1—ANLCD Analog output.
OSC1XTAL—Crystal/Resonator (LP, XT, HS modes).
CLKINCMOS—External clock input (EC mode).
SEG2—ANLCD Analog output.
RB0TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
AN12AN—A/D Channel 12 input.
CPS0AN—Capacitive sensing input 0.
CCP4STCMOS Capture/Compare/PWM4.
SRI—STSR Latch input.
INTST—External interrupt.
SEG0—ANLCD analog output.
RB1TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
AN10AN—A/D Channel 10 input.
C12IN3-
CPS1AN—Capacitive sensing input 1.
P1C—CMOS PWM output.
VLCD1AN—LCD analog input.
AN8AN—A/D Channel 8 input.
CPS2AN—Capacitive sensing input 2.
P1B—CMOS PWM output.
VLCD2AN—LCD analog input.
RB3TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
AN9AN—A/D Channel 9 input.
C12IN2-
CPS3AN—Capacitive sensing input 3.
CCP2STCMOS Capture/Compare/PWM2.
P2A—CMOS PWM output.
VLCD3AN—LCD analog input.
Output
Type
Type
OSC/4 output.
Individually enabled pull-up.
Individually enabled pull-up.
AN—Comparator C1 or C2 negative input.
Individually enabled pull-up.
Individually enabled pull-up.
AN—Comparator C1 or C2 negative input.
Description
2
C™ = Schmitt Trigger input with I2C
DS41364D-page 18Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
T ABLE 1-2:PIC16F193X/LF193X PINOUT DESCRIPTION (CONTINUED)
Input
NameFunction
RB4/AN11/CPS4/P1D/COM0RB4TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
AN11AN—A/D Channel 11 input.
CPS4AN—Capacitive sensing input 4.
P1D—CMOS PWM output.
COM0—ANLCD Analog output.
(1)
/
RB5/AN13/CPS5/P2B/CCP3
(1)
P3A
RB6/ICSPCLK/ICDCLK/SEG14RB6TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
RB7/ICSPDAT/ICDDAT/SEG13RB7TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
RC0/T1OSO/T1CKI/P2B
RC1/T1OSI/CCP2
RC2/CCP1/P1A/SEG3RC2STCMOS General purpose I/O.
RC3/SCK/SCL/SEG6RC3STCMOS General purpose I/O.
Legend: AN = Analog input or output CMOS= CMOS compatible input or outputOD = Open Drain
Note 1:Pin function is selectable via the APFCON register.
(1)
/T1G
/COM1
(1)
(1)
(1)
/P2A
TTL = TTL compatible inputST= Schmitt Trigger input with CMOS levels I
HV = High VoltageXTAL = Crystallevels
2:PIC16F193X devices only.
3:PIC16F/LF1933/1936/1938 devices only.
4:PORTD is available on PIC16F/LF1934/1937/1939 devices only.
5:RE<2:0> are available on PIC16F/LF1934/1937/1939 devices only.
RB5TTLCMOS General purpose I/O. Individually controlled interrupt-on-change.
RC6/TX/CK/CCP3/P3A/SEG9RC6STCMOS General purpose I/O.
RC7/RX/DT/P3B/SEG8RC7STCMOS General purpose I/O.
(4)
/CPS8/COM3RD0STCMOS General purpose I/O.
RD0
(4)
/CPS9/CCP4RD1STCMOS General purpose I/O.
RD1
(4)
/CPS10/P2BRD2STCMOS General purpose I/O.
RD2
(4)
/CPS11/P2C/SEG16RD3STCMOS General purpose I/O.
RD3
(4)
/CPS12/P2D/SEG17RD4STCMOS General purpose I/O.
RD4
(4)
/CPS13/P1B/SEG18RD5STCMOS General purpose I/O.
RD5
Legend: AN = Analog input or output CMOS= CMOS compatible input or outputOD = Open Drain
Note 1:Pin function is selectable via the APFCON register.
TTL = TTL compatible inputST= Schmitt Trigger input with CMOS levels I
HV = High VoltageXTAL = Crystallevels
2:PIC16F193X devices only.
3:PIC16F/LF1933/1936/1938 devices only.
4:PORTD is available on PIC16F/LF1934/1937/1939 devices only.
5:RE<2:0> are available on PIC16F/LF1934/1937/1939 devices only.
(1)
/SEG11RC4STCMOS General purpose I/O.
SDIST—SPI data input.
SDAI
T1GST—Timer1 Gate input.
SEG11—ANLCD Analog output.
SDO—CMOS SPI data output.
SEG10—ANLCD Analog output.
TX—CMOS USART asynchronous transmit.
CKSTCMOS USART synchronous clock.
CCP3STCMOS Capture/Compare/PWM3.
P3A—CMOS PWM output.
SEG9—ANLCD Analog output.
RXST—USART asynchronous input.
DTSTCMOS USART synchronous data.
P3B—CMOS PWM output.
SEG8—ANLCD Analog output.
CPS8AN—Capacitive sensing input 8.
COM3—ANLCD analog output.
CPS9AN—Capacitive sensing input 9.
CCP4STCMOS Capture/Compare/PWM4.
CPS10AN—Capacitive sensing input 10.
P2B—CMOS PWM output.
CPS11AN—Capacitive sensing input 11.
P2C—CMOS PWM output.
SEG16—ANLCD analog output.
CPS12AN—Capacitive sensing input 12.
P2D—CMOS PWM output.
SEG17—ANLCD analog output.
CPS13AN—Capacitive sensing input 13.
P1D—CMOS PWM output.
SEG18—ANLCD analog output.
Output
Type
Type
2
CODI2C™ data input/output.
Description
2
C™ = Schmitt Trigger input with I2C
DS41364D-page 20Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
T ABLE 1-2:PIC16F193X/LF193X PINOUT DESCRIPTION (CONTINUED)
Input
NameFunction
(4)
RD6
/CPS14/P1C/SEG19RD6STCMOS General purpose I/O.
CPS14AN—Capacitive sensing input 14.
P1C—CMOS PWM output.
SEG19—ANLCD analog output.
(4)
/CPS15/P1D/SEG20RD7STCMOS General purpose I/O.
RD7
CPS15AN—Capacitive sensing input 15.
P1D—CMOS PWM output.
SEG20—ANLCD analog output.
(5)
RE0
SEG21
/AN5/P3A
(1)
/CCP3
(1)
/
RE0STCMOS General purpose I/O.
AN5AN—A/D Channel 5 input.
P3A—CMOS PWM output.
CCP3STCMOS Capture/Compare/PWM3.
SEG21—ANLCD analog output.
(5)
/AN6/P3B/SEG22RE1STCMOS General purpose I/O.
RE1
AN6AN—A/D Channel 6 input.
P3B—CMOS PWM output.
SEG22—ANLCD analog output.
(5)
/AN7/CCP5/SEG23RE2STCMOS General purpose I/O.
RE2
AN7AN—A/D Channel 7 input.
CCP5STCMOS Capture/Compare/PWM5.
SEG23—ANLCD analog output.
RE3/MCLR
/VPPRE3TTL—General purpose input.
MCLR
PPHV—Programming voltage.
V
DDVDDPower—Positive supply.
V
V
SSVSSPower—Ground reference.
Legend: AN = Analog input or output CMOS= CMOS compatible input or outputOD = Open Drain
TTL = TTL compatible inputST= Schmitt Trigger input with CMOS levels I
HV = High VoltageXTAL = Crystallevels
Note 1:Pin function is selectable via the APFCON register.
2:PIC16F193X devices only.
3:PIC16F/LF1933/1936/1938 devices only.
4:PORTD is available on PIC16F/LF1934/1937/1939 devices only.
5:RE<2:0> are available on PIC16F/LF1934/1937/1939 devices only.
DS41364D-page 22Preliminary 2009 Microchip Technology Inc.
2.0ENHANCED MID-RANGE CPU
This family of devices contain an enhanced mid-range
8-bit CPU core. The CPU has 49 instructions. Interrupt
capability includes automatic context saving. The
hardware stack is 16 levels deep and has Overflow and
Underflow Reset capability. Direct, indirect, and relative
addressing modes are available. Two File Select
Registers (FSRs) provide the ability to read program
and data memory.
• Automatic Interrupt Context Saving
• 16-level Stack with Overflow and Underflow
• File Select Registers
• Instruction Set
2.1Automatic Interrupt Context
Saving
During interrupts, certain registers are automatically
saved in shadow registers and restored when returning
from the interrupt. This saves stack space and user
code. See Section 7.5 “Automatic Context Saving”,
for more information.
PIC16F193X/LF193X
2.216-level Stack with Overflow and
Underflow
These devices have an external stack memory 15 bits
wide and 16 words deep. A Stack Overflow or Underflow will set the appropriate bit (STKOVF or STKUNF)
in the PCON register, and if enabled will cause a software Reset. See section Section 3.4 “St ack” for more
details.
2.3File Select Registers
There are two 16-bit File Select Registers (FSR). FSRs
can access all file registers and program memory,
which allows one data pointer for all memory. When an
FSR points to program memory, there is 1 additional
instruction cycle in instructions using INDF to allow the
data to be fetched. General purpose memory can now
also be addressed linearly, providing the ability to
access contiguous data larger than 80 bytes. There are
also new instructions to support the FSRs. See
Section 3.5 “Indirect Addressing” for more details.
2.4Instruction Set
There are 49 instructions for the enhanced mid-range
CPU to support the features of the CPU. See
Section 28.0 “Instruction Set Summary” for more
details.
DS41364D-page 24Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
3.0MEMORY ORGANIZATION
There are three types of memory in
PIC16F193X/LF193X devices: Data Memory, Program
Memory and Data EEPROM Memory
• Program Memory
• Data Memory
- Core Registers
- Special Function Registers
- General Purpose RAM
- Common RAM
- Device Memory Maps
- Special Function Registers Summary
• Data EEPROM memory
Note 1: The Data EEPROM Memory and the
method to access Flash memory through
the EECON registers is described in
Section 11.0 “Data EEPROM and Flash
Program Memory Control”.
(1)
(1)
.
The following features are associated with access and
control of program memory and data memory:
• PCL and PCLATH
•Stack
• Indirect Addressing
3.1Program Memory Organization
The enhanced mid-range core has a 15-bit program
counter capable of addressing 32K x 14 program
memory space. Table 3-1 shows the memory sizes
implemented for the PIC16F193X/LF193X family.
Accessing a location above these boundaries will cause
a wrap-around within the implemented memory space.
The Reset vector is at 0000h and the interrupt vector is
at 0004h (see Figures 3-1, 3-2 and 3-3).
TABLE 3-1:DEVICE SIZES AND ADDRESSES
DeviceProgram Memory Space (Words)Last Program Memory Address
DS41364D-page 26Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
PC<14:0>
15
0000h
0004h
Stack Level 0
Stack Level 15
Reset Vector
Interrupt Vector
Stack Level 1
0005h
On-chip
Program
Memory
Page 0
07FFh
Rollover to Page 0
0800h
0FFFh
1000h
7FFFh
Page 1
Rollover to Page 7
Page 2
Page 3
17FFh
1800h
1FFFh
2000h
Page 4
Page 7
3FFFh
4000h
CALL, CALLW
RETURN, RETLW
Interrupt, RETFIE
constants
brw;Add Index in W to
;program counter to
;select data
retlw DATA0;Index0 data
retlw DATA1;Index1 data
retlw DATA2
retlw DATA3
my_function
;… LOTS OF CODE…
movlwDATA_INDEX
call constants
;… THE CONSTANT IS IN W
FIGURE 3-3:PROGRAM MEMORY MAP
AND STACK FOR
16KW PARTS
3.1.1READING PROGRAM MEMORY AS
DATA
There are two methods of accessing constants in program memory. The first method is to use tables of
RETLW instructions. The second method is to set an
FSR to point to the program memory.
3.1.1.1RETLW Instruction
The RETLW instruction can be used to provide access
to tables of constants. The recommended way to create
such a table is shown in Example 3-1.
EXAMPLE 3-1:RETLW INSTRUCTION
The BRW instruction makes this type of table very simple to implement. If your code must remain portable
with previous generations of microcontrollers, then the
BRW instruction is not available so the older table read
method must be used.
The program memory can be accessed as data by setting bit 7 of the FSRxH register and reading the matching INDFx register. The MOVIW instruction will place the
lower 8 bits of the addressed word in the W register.
Writes to the program memory cannot be performed via
the INDF registers. Instructions that access the program memory via the FSR require one extra instruction
cycle to complete. Example 3-2 demonstrates accessing the program memory via an FSR.
The HIGH directive will set bit<7> if a label points to a
location in program memory.
EXAMPLE 3-2:ACCESSING PROGRAM
MEMORY VIA FSR
3.2.1CORE REGISTERS
The core registers contain the registers that directly
affect the basic operation of the PIC16F193X/LF193X.
These registers are listed below:
• INDF0
• INDF1
•PCL
•STATUS
•FSR0 Low
• FSR0 High
•FSR1 Low
• FSR1 High
• BSR
•WREG
•PCLATH
• INTCON
Note:The core registers are the first 12
addresses of every data memory bank.
3.2Data Memory Organization
The data memory is partitioned in 32 memory banks
with 128 bytes in a bank. Each bank consists of
(Figure 3-4):
• 12 core registers
• 20 Special Function Registers (SFR)
• Up to 80 bytes of General Purpose RAM (GPR)
• 16 bytes of common RAM
The active bank is selected by writing the bank number
into the Bank Select Register (BSR). Unimplemented
memory will read as ‘0’. All data memory can be
accessed either directly (via instructions that use the
file registers) or indirectly via the two File Select
Registers (FSR). See Section 3.5 “IndirectAddressing” for more information.
DS41364D-page 28Preliminary 2009 Microchip Technology Inc.
PIC16F193X/LF193X
3.2.1.1STATUS Register
The STATUS register, shown in Register 3-1, contains:
• the arithmetic status of the ALU
• the Reset status
The STATUS register can be the destination for any
instruction, like any other register. If the STATUS
register is the destination for an instruction that affects
the Z, DC or C bits, then the write to these three bits is
disabled. These bits are set or cleared according to the
device logic. Furthermore, the TO
writable. Therefore, the result of an instruction with the
STATUS register as destination may be different than
intended.
and PD bits are not
For example, CLRF STATUS will clear the upper three
bits and set the Z bit. This leaves the STATUS register
as ‘000u u1uu’ (where u = unchanged).
It is recommended, therefore, that only BCF, BSF,SWAPF and MOVWF instructions are used to alter the
STATUS register, because these instructions do not
affect any Status bits. For other instructions not
affecting any Status bits (Refer to Section 28.0
“Instruction Set Summary”).
Note 1: The C and DC bits operate as Borrow and
Digit Borrow
subtraction.
out bits, respectively, in
REGISTER 3-1:STATUS: STATUS REGISTER
U-0U-0U-0R-1/qR-1/qR/W-0/uR/W-0/uR/W-0/u
———
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
u = Bit is unchangedx = Bit is unknown-n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set‘0’ = Bit is clearedq = Value depends on condition
TO
PDZDC
(1)
(1)
C
bit 7-5Unimplemented: Read as ‘0’
bit 4TO
bit 3PD
bit 2Z: Zero bit
bit 1DC: Digit Carry/Digit Borrow
bit 0C: Carry/Borrow
Note 1: For Borrow, the polarity is reversed. A subtraction is executed by adding the two’s complement of the
second operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high-order or low-order
bit of the source register.
: Time-out bit
1 = After power-up, CLRWDT instruction or SLEEP instruction
0 = A WDT time-out occurred
: Power-down bit
1 = After power-up or by the CLRWDT instruction
0 = By execution of the SLEEP instruction
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit (ADDWF, ADDLW,SUBLW,SUBWF instructions)
1 = A carry-out from the 4th low-order bit of the result occurred
0 = No carry-out from the 4th low-order bit of the result
(1)
bit
(ADDWF, ADDLW, SUBLW, SUBWF instructions)
1 = A carry-out from the Most Significant bit of the result occurred
0 = No carry-out from the Most Significant bit of the result occurred
The Special Function Registers are registers used by
the application to control the desired operation of
peripheral functions in the device. The registers associated with the operation of the peripherals are
described in the appropriate peripheral chapter of this
data sheet.
3.2.3GENERAL PURPOSE RAM
There are up to 80 bytes of GPR in each data memory
bank.
3.2.3.1Linear Access to GPR
The general purpose RAM can be accessed in a
non-banked method via the FSRs. This can simplify
access to large memory structures. See Section 3.5.2“Linear Data Memory” for more information.
3.2.4COMMON RAM
There are 16 bytes of common RAM accessible from all
banks.
FIGURE 3-4:BANKED MEMORY
PARTITIONING
3.2.5DEVICE MEMORY MAPS
The memory maps for the device family are as shown
in Table 3-2.