Syntax:
UNLOCKPPS
Explanation:
Peripheral Pin Select (PPS) has an operation mode in which all input and output selections can be prevented to stop inadvertent changes.
PPS selections are unlocked by setting by the use of the UnLockPPS command.
Using this command will ensure the special sequence of Microchip assembler is handled correctly.
Command Availability:
Available on all Microchip microcontrollers only.
#chip 16f18855,85
#option explicit
'Set the PPS of the I2C and the RS232 ports.
#startup InitPPS, 85
Sub InitPPS
UNLOCKPPS ' <<< the UnLockPPS instruction
RC0PPS = 0x0010 'RC0->EUSART:TX;
RXPPS = 0x0011 'RC1->EUSART:RX;
SSP1CLKPPS = 0x14 'RC3->MSSP1:SCL1;
SSP1DATPPS = 0x13 'RC4->MSSP1:SDA1;
RC3PPS = 0x15 'RC3->MSSP1:SCL1;
RC4PPS = 0x14 'RC4->MSSP1:SDA1;
LockPPS
End SubKey line: UNLOCKPPS — temporarily unlocks the PPS registers so the pin-assignment lines that follow can take effect; LockPPS locks them again at the end of the same subroutine.
See Also:
- LockPPS — re-locking the PPS registers after making changes
- Introduction to PPS — background on Peripheral Pin Select

