
THE 8051 MICROCONTROLLER: THE PROGRAMMER’S PERSPECTIVE 19-45
RET ;return
END
The salient points of this program are as follows:
i) The BCD digit is got from port 0 and stored in R1. Then the lower nibble is pro-
cessed. For this, the procedure ASCII is called.
ii) The procedure first masks the upper byte—if the BCD no is 89H, 09 is got
iii) Then it is ORed with 30H to get 39H, the ASCII of 9.
iv) On returning to the main program, the no is again brought to A and its nibbles
are swapped, to get the upper nibble in the lower nibble position, i.e., 89H becomes
98H.
v) Then the ASCII procedure masks the upper byte to get 08, and then this ...