ML51/ML54/ML56
Sep. 01, 2020
Page
217
of 719
Rev 2.00
ML
51
/ML
54
/ML
5
6 S
E
RI
E
S
TECHNI
CA
L
RE
F
E
R
E
NC
E
M
A
NU
A
L
ML51/M
L54
/M
L56
Series
Tec
hnical Reference
Manual
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]
AC
Auxiliary Carry
Set when the previous operation resulted in a carry-out from or a borrow-in to the 4th bit of the
low order nibble, otherwise cleared.
[5]
F0
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
Check with bit 4 description.
[2]
OV
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.