Program Status word
Well come to today's podcast, yesterday we have known about general purpose registers, banks and stuff about that. So, data transfer from general purpose registers to general purpose registers is impossible, for that we should need another one that is Program Status word.
C=1 carry sets
The AC=0 auxiliary is reset
The AC=1 auxiliary is set
Program status word:
Program status word is a byte addressable register. It is also referred as a flag register. This register reflects the status of the operation that is carried out in the controller.Although the PSW register is 8 bits wide, only 6 bits of it are used by the 8051.The two unused bits are user-definable flags.
Four of the flags are called conditional flags, meaning that they indicate some conditions that result from an instruction is executed. These four are CY (carry), AC (auxiliary carry), P (parity), and OV (overflow).As seen from below figure, the bits PSW.3 and PSW.4 are designated as RS0 and RS1 as register selection bit, respectively, and are used to change the bank registers.The PSW.5 and PSW.l bits are general-purpose status flag bits and can be used by the programmer for any purpose. In other words, they are user definable. See below Figure for the bits of the PSW register.

We will discuss clearly above 6 bits,
Carry Flag
The Address of the Carry flag is D7. This carry flag is affected when the bit is generated from the 7th position.
When C=0 carry resetsC=1 carry sets

AC, the auxiliary carry flag
If there is a carry from D3 to D4 during an ADD or SUB operation, this bit is set; otherwise, it is cleared. This flag is used by instructions that perform BCD (binary coded decimal) arithmetic.
The address of the auxiliary carry is D5. This auxiliary carry is affected when a bit is generated from the 3rd position to the 4th position.
The AC=0 auxiliary is reset
The AC=1 auxiliary is set

Over Flag:
The address of the overflow flag is D2. When a bit is generated from the 6th position to the 7th position, then the overflow flag is affected.
OV=0 overflow flag resets
OV=1 overflow flag sets
OV=1 overflow flag sets

Parity flag (P):
The parity flag reflects the number of 1 s in the A (accumulator) register only. If the A register contains an odd number of Is, then P = 1. Therefore, P = 0 if A has an even number of 1s.
RS1, RS2 is used for selection of banks.
Comments
Post a Comment