Datasheet

2012 Microchip Technology Inc. DS30575A-page 233
PIC18F97J94 FAMILY
11.15.4.1 Control Register Lock
The contents of RPINRx and RPORx registers are con-
stantly monitored in hardware by shadow registers. If
an unexpected change in any of the registers occurs
(such as cell disturbances caused by ESD or other
external events), a Configuration Mismatch Reset will
trigger.
11.15.4.2 Configuration Bit Pin Select Lock
As an additional level of safety, the device can be
configured to prevent more than one write session to
the RPINRx and RPORx registers. The IOL1WAY Con-
figuration bit (CONFIG5H<0>) blocks the IOLOCK bit
from being cleared after it has been set once.
In the default (unprogrammed) state, IOL1WAY is set,
restricting users to one write session. Programming
IOL1WAY allows users unlimited access to the Periph-
eral Pin Select registers. It is good programming prac-
tice to always set the IOLOCK bit (OSCCON2<6>) after
all changes have been made to PPS-Lite registers.
11.15.5 CONSIDERATIONS FOR
PERIPHERAL PIN SELECTION
The ability to control Peripheral Pin Selection intro-
duces several considerations into application design
that should be considered. This is particularly true for
several common peripherals which are only available
as remappable peripherals.
Before any other application code is executed, the user
must initialize the device with the proper peripheral
configuration. Since the IOLOCK is not active in the
Reset state, the peripherals can be configured, and the
IOLOCK bit can be set when configuration is complete.
Choosing the configuration requires the review of all
Peripheral Pin Selects and their pin assignments,
especially those that will not be used in the application.
In all cases, unused pin-selected peripherals should be
disabled. Unused peripherals should have their inputs
assigned to V
SS. I/O pins with unused RPn functions
should be configured with the NULL (‘0’) peripheral
output.
The assignment of an RPn pin to the peripheral input or
output depends on the peripheral and its use in the
application. It is good programming practice to map
peripherals to pins immediately after Reset. This
should be done before any configuration changes to
the peripheral itself.
The assignment of a peripheral output to a particular
pin does not automatically perform any other configura-
tion of the pins I/O circuitry. This means adding a
pin-selectable output to a pin may mean inadvertently
driving an existing peripheral input when the output is
driven. Users must be familiar with the behavior of
other fixed peripherals that share a remappable pin. To
be safe, fixed digital peripherals that share the same
pin should be disabled when not in use.
Configuring a remappable pin for a specific peripheral
input does not automatically turn that feature on. The
peripheral must be specifically configured for operation
and enabled, as if it were tied to a fixed pin.
A final consideration is that Peripheral Pin Select func-
tions neither override analog inputs, nor reconfigure
pins with analog functions for digital I/O. If a pin is
configured as an analog input on device Reset, it must
be explicitly reconfigured as digital I/O when used with
a Peripheral Pin Select.
11.15.5.1 Basic Steps to Use Peripheral Pin
Selection Lite (PPS-Lite)
1. Disable any fixed digital peripherals on the pins
to be used.
2. Switch pins to be used for digital functionality (if
they have analog functionality) using the
ANCONx registers.
3. Clear the IOLOCK bit (OSCCON<6>) if needed
(not needed after a device Reset).
4. Set RPINRx and RPORx registers appropriately.
5. Set the IOLOCK bit (OSCCON<6>).
6. Enable and configure newly mapped PPS-Lite
peripherals.