Intel MCS48 User Manual page 226

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

Advertisement

8155/8156/8155-2/8156-2
EXAMPLE
PROGRAM
Following
is
an
actual
sequence
of
program
steps
that
adjusts the
8155/56 count
register
contents
to
obtain the count, extracted
from
Intel®
Application
Note AP38.
"Application
Techniques
for
the
Intel
8085A
Bus."
First
store the
value
of
the
full
original
count
in
register
HL
of
the
8085A.
Then
stop the
count
to
avoid
getting
an
incorrect
count
value.
Then sample
the timer-counter, storing the lower-order byte
of
the current
count
register
in
register
C
and
the higher-order
count
byte
in
register
B.
Then,
call
the following
8080A/8085A
subroutine:
ADJUST,
78
MOV
A,B
;Load
accumulator
with
upper
half
;
of
count.
E63F
ANI 3F
;Reset
upper
2
bits
and
clear
carry.
1F
RAR
;Rotate
right
through
carry.
47
MOV
B,A
;Store shifted
value
back
in
B.
79
MOV
A,C
;Load
accumulator
with
lower
half.
1F
RAR
;Rotate
right
through
carry.
4F
MOV
C,A
;Store
lower byte
in
C.
D0
RNC
;lf
in
2nd
half of
count,
return.
;lf
in
1st
half,
go
on.
3F
CMC
;Clear
carry.
7C
MOV
A,H
;Divide
full
count by
2.
(If
HL
;is
odd, disregard remainder.)
1F
RAR
67
MOV
H,A
7D
MOV
A,L
1F
RAR
6F
MOV
L,A
09
DAD
B
;Double-precision
add
HL
and BC.
44
MOV
B,H
;Store results
back
in
BC.
4D
MOV
C,L
C9
RET
;Return.
After
executinq
the subroutine.
BC
will
contain the remaining
count
in
the current
count
cycle.
6-74

Advertisement

Table of Contents
loading

Table of Contents