Friday, August 10, 2018

PSW Register in 8051

Program status word is also known as Flag Register. it is an 8-bit register. its address is 0XD0. it can be Bit and Byte Addressable. it can contains 6 Flag bits i.e. CY (carry), AC (auxiliary carry), P (parity), and OV (overflow) and 2 user definable bits. The PSW.5 and PSW.1 bits are general purpose status flag bits.

CY, the carry flag -  

This flag is set whenever there is a carry out from the D7 bit. This flag bit is affected after an 8-bit addition or subtraction. It can also be set to 1 or 0 directly by an instruction such as "SETB C" and "CLR C" stands for "set bit carry" and "CLR C" for "clear carry".

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.

FO -

General purpose flag bit available for the user.

RS1 and RS0 -

These are the register bank select bits as shown below.


OV -

Overflow flag is set if there was an arithmetic overflow. For signed numbers, results greater than 127 or less than -128 will set OV flag. For unsigned numbers this can be ignored.

PSW.1 -

User definable flag

P, the parity flag -

The parity flag reflects the number of 1s in the A (accumulator) register only. If the A register contains an odd number of 1s, then P=1. Therefore, P=0 if A has an even number of 1s.

Thanks for spending your valuable time with this article, and we hope that you might have received a good content about PSW Register. Please share your views on this topic by commenting below and you can see my video on this topic.



No comments:

Post a Comment