Microchip Technology MCU PIC PIC18F87K22-I/PTRSL TQFP-80 MCP PIC18F87K22-I/PTRSL Data Sheet

Product codes
PIC18F87K22-I/PTRSL
Page of 550
PIC18F87K22 FAMILY
DS39960D-page 298
 2009-2011 Microchip Technology Inc.
21.4.3.4
7-Bit Address Masking Mode
Unlike 5-bit masking, 7-Bit Address Masking mode
uses a mask of up to 8 bits (in 10-bit addressing) to
define a range of addresses that can be Acknowl-
edged, using the lowest bits of the incoming address.
This allows the module to Acknowledge up to
127 different addresses with 7-bit addressing, or 255
with 10-bit addressing (see 
). This mode
is the default configuration of the module, which is
selected when MSSPMSK is unprogrammed (‘1’).
The address mask for 7-Bit Address Masking mode is
stored in the SSPxMSK register, instead of the
SSPxCON2 register. SSPxMSK is a separate hard-
ware register within the module, but it is not directly
addressable. Instead, it shares an address in the SFR
space with the SSPxADD register. To access the
SSPxMSK register, it is necessary to select MSSP
mode, ‘1001’ (SSPxCON1<3:0> = 1001) and then
read or write to the location of SSPxADD.
To use 7-Bit Address Masking mode, it is necessary to
initialize SSPxMSK with a value before selecting the
I
2
C Slave Addressing mode. Thus, the required
sequence of events is:
1.
Select SSPxMSK Access mode
(SSPxCON2<3:0> = 1001).
2.
Write the mask value to the appropriate
SSPADD register address (FC8h for MSSP1,
F6Eh for MSSP2).
3.
Set the appropriate I
2
C Slave mode
(SSPxCON2<3:0> = 0111 for 10-bit addressing,
‘0110’ for 7-bit addressing).
Setting or clearing mask bits in SSPxMSK behaves in
the opposite manner of the ADMSK bits in 5-Bit
Address Masking mode. That is, clearing a bit in
SSPxMSK causes the corresponding address bit to be
masked; setting the bit requires a match in that
position. SSPxMSK resets to all ‘1’s upon any Reset
condition and, therefore, has no effect on the standard
MSSP operation until written with a mask value.
With 7-bit addressing, SSPxMSK<7:1> bits mask the
corresponding address bits in the SSPxADD register.
For any SSPxMSK bits that are active
(SSPxMSK<n> = 0), the corresponding SSPxADD
address bit is ignored (SSPxADD<n> = x). For the
module to issue an address Acknowledge, it is
sufficient to match only on addresses that do not have
an active address mask.
With 10-bit addressing, SSPxMSK<7:0> bits mask the
corresponding address bits in the SSPxADD register.
For any SSPxMSK bits that are active (= 0), the corre-
sponding SSPxADD address bit is ignored
(SSPxADD<n> = x). 
EXAMPLE 21-3:
ADDRESS MASKING EXAMPLES IN 7-BIT MASKING MODE
Note:
The two Most Significant bits of the
address are not affected by address
masking.
7-Bit Addressing:
SSPxADD<7:1> = 1010 000
SSPxMSK<7:1> = 1111 001
Addresses Acknowledged = ACh, A8h, A4h, A0h
10-Bit Addressing:
SSPxADD<7:0> = 1010 0000 (The two MSb are ignored in this example since they are not affected)
SSPxMSK<5:1> = 1111 0011
Addresses Acknowledged = ACh, A8h, A4h, A0h