8051 Instruction Set Manual

Program Status Word (PSW)

The Program Status Word (PSW) contains status bits that reflect the current CPU state. The 8051 variants provide one special function register called PSW with this status information. The 251 provides two additional status flags, Z and N, that are available in a second special function register called PSW1.

PSW Register (all 8051 and 251 variants)
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
CYACFORS1RS0OVUDP
Additional PSW1 Register (on 251 Architecture only)
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
CYACNRS1RS0OVZ

The following table describes the status bits in the PSW:

RS1 RS0 Working Register Bank and Address
0 0 Bank0 (D:0x00 - D:0x07)
0 1 Bank1 (D:0x08 - D:0x0F)
1 0 Bank2 (D:0x10 - D:0x17)
1 1 Bank3 (D:0x18H - D:0x1F)

SymbolFunction
CYCarry flag
ACAuxiliary Carry flag (For BCD Operations)
F0Flag 0 (Available to the user for General Purpose)
RS1,
RS0
Register bank select:
RS1 RS0 Working Register Bank and Address
0 0 Bank0 (D:0x00 - D:0x07)
0 1 Bank1 (D:0x08 - D:0x0F)
1 0 Bank2 (D:0x10 - D:0x17)
1 1 Bank3 (D:0x18H - D:0x1F)
0VOverflow flag
UDUser definable flag
PParity flag
Reserved for future use (251 Only)
ZZero flag (251 Only)
NNegative flag (251 Only)