MS51
Nov. 28, 2019
Page
132
of 491
Rev 1.00
MS51
32K
SE
RIES
TE
CHNICAL RE
F
EREN
CE MA
N
UAL
PSW
– Program Status Word
Register
SFR Address
Reset Value
PSW
D0H, All pages, Bit addressable
0000_0000 b
7
6
5
4
3
2
1
0
CY
AC
F0
RS1
RS0
OV
F1
P
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R
Bit
Name
Description
7
CY
Carry flag
For a adding or subtracting operation, CY will be set when the previous operation resulted in a
carry-out from or a borrow-in to the Most Significant bit, otherwise cleared.
If the previous operation is MUL or DIV, CY is always 0.
CY is affected by DA A instruction, which indicates that if the original BCD sum is greater than 100.
For a CJNE branch, CY will be set if the first unsigned integer value is less than the second one.
Otherwise, CY will be cleared.
6
C
Auxiliary carry
Set when the previous operation resulted in a carry-out from or a borrow-in to the 4
th
bit of the low
order nibble, otherwise cleared.
5
0
User flag 0
The general purpose flag that can be set or cleared by user.
4
RS1
Register bank selection bits
These two bits select one of four banks in which R0 to R7 locate.
RS1
RS0
Register Bank
RAM Address
0
0
0
00H to 07H
0
1
1
08H to 0FH
1
0
2
10H to 17H
1
1
3
18H to 1FH
3
RS0
2
V
Overflow flag
OV is used for a signed character operands. For a ADD or ADDC instruction, OV will be set if there
is a carry out of bit 6 but not out of bit 7, or a carry out of bit 7 but not bit 6. Otherwise, OV is
cleared. OV indicates a negative number produced as the sum of two positive operands or a
positive sum from two negative operands. For a SUBB, OV is set if a borrow is needed into bit6 but
not into bit 7, or into bit7 but not bit 6. Otherwise, OV is cleared. OV indicates a negative number
produced when a negative value is subtracted from a positive value, or a positive result when a
positive number is subtracted from a negative number.
For a MUL, if the product is greater than 255 (00FFH), OV will be set. Otherwise, it is cleared.
For a DIV, it is normally 0. However, if B had originally contained 00H, the values returned in A and
B will be undefined. Meanwhile, the OV will be set.
1
1
User flag 1
The general purpose flag that can be set or cleared by user via software.