Datasheet
MCP2515
DS20001801J-page 66 2003-2019 Microchip Technology Inc.
12.8 READ STATUS Instruction
The READ STATUS instruction allows single instruction
access to some of the often used status bits for
message reception and transmission.
The MCP2515 is selected by lowering the
CS pin and the
READ STATUS command byte, shown in Figure 12-8, is
sent to the MCP2515. Once the command byte is sent,
the MCP2515 will return eight bits of data that contain the
status.
If additional clocks are sent after the first eight bits are
transmitted, the MCP2515 will continue to output the
status bits as long as the
CS pin is held low and clocks
are provided on SCK.
Each status bit returned in this command may also be
read by using the standard READ command with the
appropriate register address.
12.9 RX STATUS Instruction
The RX STATUS instruction (Figure 12-9) is used to
quickly determine which filter matched the message
and message type (standard, extended, remote). After
the command byte is sent, the controller will return
8 bits of data that contain the status data. If more clocks
are sent after the eight bits are transmitted, the
controller will continue to output the same status bits as
long as the
CS pin stays low and clocks are provided.
12.10 BIT MODIFY Instruction
The BIT MODIFY instruction provides a means for
setting or clearing individual bits in specific status and
control registers. This command is not available for all
registers. See Section 11.0 “Register Map” to
determine which registers allow the use of this
command.
The part is selected by lowering the
CS pin and the BIT
MODIFY command byte is then sent to the MCP2515.
The command is followed by the address of the
register, the mask byte and finally, the data byte.
The mask byte determines which bits in the register will
be allowed to change. A ‘1’ in the mask byte will allow
a bit in the register to change, while a ‘0’ will not.
The data byte determines what value the modified bits
in the register will be changed to. A ‘1’ in the data byte
will set the bit and a ‘0’ will clear the bit, provided that
the mask for that bit is set to a ‘1’ (see Figure 12-7).
FIGURE 12-1: BIT MODIFY
Note: Executing the BIT MODIFY command on
registers that are not bit-modifiable will
force the mask to FFh. This will allow byte
writes to the registers, not BIT MODIFY.
Mask Byte
Data Byte
Previous
Register
Contents
Resulting
Register
Contents
001 11100
xx1 100xx
010 11000
011 10000