Intel MCS48 User Manual page 145

Family of single chip microcomputers
Hide thumbs Also See for MCS48:
Table of Contents

Advertisement

APPLICATION
EXAMPLES
2
BYTE
PROCESSING SYSTEM
A
suggested model
of
a
processing
routine
takes
two
single
byte
inputs
from
different
ports,
compares
them,
and
performs
the
following,
depending on
the
result
of
the
comparison:
(If
Equal) Sets Flag
and
Exits
(If
Not
Equal)
and Outputs
the
Larger
to
a
Third Port
1ST
OUTPUT 2ND
OUTPUT
1ST
GD
PROCESS:
CLR
IN
MOV
IN
MOV
CPL
INC
ADD
JZ
JNC
MOV
OUTL
JMP
SECOND:
MOV
OUTL
JMP
EQUL:
CPL
JMP
FO
A,P1
RO.A
A,P2
R1,A
A
A
A.RO
EQUL
SECOND
A,R0
BUS,A
DONE
A,R1
BUS.A
DONE
FO
DONE
;CLEAR
FO BIT
(INITIALIZE)
;READ
FIRST
INPUT,
STORE
IN
RO
;READ
SECOND
INPUT,
STORE
IN
R1
SUBTRACT SECOND FROM
FIRST
;(2's
COMPLEMENT AND
ADD)
BRANCH
IF
THEY ARE EQUAL
IF
NEGATIVE,
SECOND WAS
LARGER
ELSE,
OUTPUT
FIRST
;EXIT
;OUTPUT
SECOND
EXIT
SET
FO
EXIT
5-25

Advertisement

Table of Contents
loading

Table of Contents