You are on page 1of 16

PUTTOSE PBOGIAMMTI

INfERFACING PERIPHEMLS {VOs) IND ATPUCA


446

in th. hudshake node (lvlode 1) and write i'j Erphrn lhc funclrons,'frhe 825oA inlempl
illst.ucllcn\ to transfer drt! understxluscheck 1/O irollcr'and its operriion in the fully
a.d in'cruPt l/O. .i,4..
ol the Direel Mcnuv
- of. -rn!'r'l(
in\rructrons
n des
|rh(r:(rlr'r'e JrJ n':'
!o sel up rhe timer in the vlrirNs
L] Explain rhe procels
(DMA) and the funarions of various eleme
the 8151.
;t )

PROGRAMMA TE ','*
RAL INTERFACE

b9

,, ffr.825:A l-.241 O prn' r\"r.Jn l-e groJ u!3 ril in rwo 8'bir falallel

Z-:'iqq'.--r"-E=nr"-r:rylt..,."..E' t5l
2'ia^ tT p Gl'*Fffir";6-ps!i !=!. :/o Polrs (a) and Their M
'ii,r "0,,'
Lli""1F;-ffinnnflih.'e pon'
"re
ired by writrng r cont

Fisure 15.l(b) shows all the


;: rhe Bir
(Resei): This is an
eisimple l/o po4! in rh€ input mode.
ash l', J!c!s3
G::ss. and Ao and A! a€
*rrivJry.
:lE eS signal i$ rhe ma6&
ck DiagEam of rhe 8255A6/r, :.nrrol relrster 3s trven
l5:r",.h*.r*oS-b.r 1''1' rA dnJ BIJ$" r h r

b.h.q n'rnn
ffi,r".-1.1, t'u. bufier. rd c.nr 'l ni- c,l I cf,c l< ?rrorJ(t
;ip.,n.reo o r"n.ryx inren rl 'rLuu+-;ehtls I(orLro Tl I'bl^Lr 00
inituaer,ll rLe elzl."nrs of d prosranmable devicei Pon C pedbrms iunctionr si $ 00
rtr.u oy'rnt sraru(register in addltion to prcviding handshake signals
0l
01
cO.firRbY!oGlc
v+ ':ble,
iS
rhe pon addressc
line

{lrite): 'rhis control signal enables rhe wrile operation when rhe si --4ffd--'
rhe MPU writes inlo r selected l/O porl or $e control regisler'
s,
447

.ry!eftcr!- .foi,D .-- -!d-jl!sli@l

I Pon C birs rPod B: erherl


",;*d r." nv,.d.r,r
ta) fi;a;Ia[e--
Pn( hcdk
t l) \*.{ }ql J{,t t,
rb 6rF-fi\e

;ff.fI 'Re'er,: Thi, \anacri\ehigh5igna|itLtedArheconrotregr.rerand\er:dtl


ry': rre rnprr rode.
;E-gr', ,"a eI ]lgt3qdetrcejelSgjtsal- CS is connqqed ro a decodrd
and {. dnrl Ar are_gqlrallyr conrecred ro ldPuaaare.s lines Ao a;a Ar.
_ ;:
:_E _ . jt*:
,;it
-.:--..
\TLi\ely
:::
;- - ::: -S A" and
signal is rhe master Chip&19S1, and Ao
l,l:'glalfe(r. A cpecil
Ar speciflqnggilbel/O
one otutrr i.,o pals
r :. -Sls"lJE
::ltrol re8'sler as grven !!lot!j
DarJ
: ?IIIOSE INOGRAiIMAE]

t C:-,'-'
L 8255

e3

T6R FD
row

'...3,"' \.i
; ,-:-E Seled Loqrc (a) ard i
:"
woRD
i lLb) \irows ---
:=f,I, a rcrisrer c
._: conirol word! spe.if,
ri: :r lrite a control word I
a: .::. is not accessible lbr
: : l- ol rhe colgql re€lrl

)o/
a
- .. (1i\\ified in FiSure I5

s- 3SR) mode The BSR,


. : -d\ .l.>"rtiu" ,r.,.nu
9--::rhtfrcare w ttr ner p
-: rhe ,rddresser oipor
w .- r sclcct logic and addr
': : :,nrtrol wo in th. c.

;-,-::+-61
r::.!'61 rhe !a.ious
larious n1.
nro
FFJ+'l: ,//
1,1cde 0: Simple InI

\i .. E d E"d
::i(E;:.
p:::t;:grFx:liFR- E ! r. :,o 1l ialched.
':,r
€ rr,ild\ c hand5halc!
)A - -,/ 1r,+ Lj
{ cI
r r:.' po.t
, . i 12c t ; r x ;.
l- itddresses in F
JJ tr"rf n > ? k :r ',r. \{ode 0 control wo
: -: pod CL. as, inpur po

!J
-'--
*,
Pi@R.IMMABLE PERI'IIER,AI] DEVICES 449

C=82H r0000
TOI B=SlH
r6w

ALf r.s < "!-\Ls-


'--= Select Loqic (a) and VO Pon Addresses (b) ;*. {""^n' s3l\'
")'q"
woRE t
: l(b) ihows---
a register called lhe control register. The conlents of lhis register,
:: control word, specify an I/O funclion for erc-h poft. Tbis registerran be
: :r nrile a control word when A0 and AL are at logic 1, a! menlioned prcviousl)'.
r.:.r is ior accessible for a Rein-6.6-e-.td6[
sj_!i_{!!9_S9!!I9!,tr9 19,, .cj]i$ eilher rhe_vo-funclion oJ !le Bit SetRelet
lf :i clasrified in Figure I 5 . I (b). Ilbil D? = I , bits D6-Do detemine vO functions
frodes, as shown in Fiewe l5.,1.LE -,;=-tr-EoftnpEraiei in the Bit
BSR) mode The BSR control word does nol affecl lhe funclions of pons A and

ls through the 8255A, lhree

- :e rne drese. ol por' A. B. and C and of rhe conrrol rcgi\ret acco'ding ro


---rp S€lect logic and address lines Ao and Ar.
:-: tr control word in $e control register.
: O rnslructions to communicate whh penpherals through ports A, B, and C

i J
)
r

inreru capabiliry.
te
-. he pon dddre\"e\ jn Figu'. 15 5 Example
15.1
:. the Mode 0 control word to conngure Port A and port Cu.as outpul.pons and
: :nd pon CL as.input Pofts.
0a
:

.lt :-
ACIIIIC PERPT€AALS (VG) AID AIPUCAIIOE :EI-AI PI'RIOSE PROGRAIV
450
rleN\'
or Lor o, lDr DTIDIIDI]DO

\r Pjqcr4ftEr:!:"r
0 = Outplt

..\
6='fia; o

a crou! A \
!98-L(uPTr-PcrPc,
rl.Esl{'
€::i OUT

fE t5.3
(rx)= vot.; Nq 82554 YO PorE r
=r
'"1\

URE 15,4
1r,^.i E^'hir r., l/() L4oce D, D6 D5
io@
'1
i-n(rron I
Pofi A in Modc

,, .: {.83H il-ord a
r: 800311 ;WIit€ \
-: i 3001H iR.ad s
! ,::- S000H ;DisFla)
\ 3002H iRrnd s
-r: : :FH iMask t
T
I
I - 451
I E-:'-i!'P!?.POSE IROOBAMMABLE PERI?HERA! DE\ CEs

+5V

8255A I

Pc.
w

cs t
rc|

FD

RESET

8255A l/O PorLs tn Mode 0


-.:.:q

.- .aonlr"ol Word
{Or 4 4^
l- D6 DJ Dr D: D, DI DO
r
:@ ft 000 = arH
Ir I r.,

I
tll l-
L-Porr Cr = lnpur;
!+Porr B - lnput
Port A in Mode 0
=o,,p* 1 LPuu BinMode0
- t,
Pon Cri = outpu I i-

.: r,8lll il-ord accumulator $ith the control word


--:. 3003H rwrite word ii the control registe. lo initillize lhe porls
Ii ts001H tRead switches at Pon B
-
- :000H iDisplay lhe reading al Port A
-: i 900:H iRead swilches at Poft C./ .
'. rFH iMask the upper tbur bits of pon Ci rhese bits are nol input drta
,1\}\,-/-
452 INTERFACI'IG PERPHEa{,S (vog) AND
;!
{
RLC ;Rotate and place dara in th€ trpper half of rhe accumutao,
RLC a BSR conlrot won
RLC
schematic in Figl
'ne
RLC
_sTA 8002H ;Dhplay dara at pon Cu
'u-.
- $ruhon
,,,
BsR c<
HLT
//
ProSrsm D$cription The circuir is designed for memory,mapped I/O; therefc.!, I 11
i. ins!.uctions rr€ wriGn as if all rhe 8255A porrs .re nrmory
locaiionr.
The ponr dre initiatized ,y ptacrng rhe conlrol word 8JH in rhe (onrrol
II !1
tr
1 instruc!on, q!r'd re8r\re
lDj,irlequi!atenr ro rhe in(rrucrions oUT ano rrr, r.ioecc, I I'
I
( 1"
ln lhr\ e\dmpte. rhe to$ four b,raot pin CFaonfigurEdurmttidnJlhe nreJ
1:.^:?:hc_,"9 ^ 9!lSdr:
even lhoush pon c has one dddre,. fo, borh halre,
e
\ 'oi,
o
C..qg1p._, Read and Write operarions are differendareo oy ttre controt stgnuts
i \ con,.or ,
and MEMW. whe_n the MpU reads pon C (e.g., LDA B002rb, n
recei!.s ei;hr biN
accumulator Hodever, rha high-order bits (D7-Da) mus! be igno.ed
beca;se dle i CJBRO.IIINE
\-
data bit< ar2fi-Pcr- PQ, To dr.pld) rhe\e birs dr lhe upper hali
;i po c. bil\ lpc
nu',l be 5,l1rtted ro PC'-PC4.
MVI A,OFI
!I
i
OUT 83lr-
SevReset) Mode MVI A,O7Ii
lR Tgq's congglLld odyrlh th;eighrbits o{pon C, which
OUT 83H a
can be ser
conraol \r ord silh bit
{ EQgni2!d-"s; it does

SR cu'rrrcl

nl,i Lonrrcl$ord, v hen $r.|l<r rn rhe.un|lot re3i..rer. \er\.. re...r. brr Jr J


^ne
i:lFLrfed rn Frgure l5 6 I" To setreset b;rs in pofl
C.
FIGI'XE 15,6 u! Di Dr Or pon C.
l))
-\ BSR conrrul wnrd
8255A Conlrol Word Fomal
n tl-e BSF &lode
\l\ otlccr
lne BSR Wnkot word,,t.F.
,./y
BS

0t0 - Bir l

0l - Bir5
PERIPHEM! DEVICES

OFH V
OEH '/
O'lll-,/
o6H /,
PORT -I.DDRESS
ydm -\..-
%;Y&7""a{f"A+l,.''2.> *l<,rg-
Conrrol register address refer ro Fisure
q _,---2.= ; &!^r-
i3RourrNE l
- r. l> - 5
"<-: :
B:R: MVI A,0FH.'
V\ t A.oFH " ;Load accumulato, to..t rc,
,o .., PC, d4
J, *)u . ;
:Load b) re in accumulalo,
byte ,t,
OUT 83tt,:. iset PC7 = 1 \ . *t {.1 'i
.< ," /_,
/jfl$d
i,oin'r-
u7i --
.ii"i-ui,n in ,o ,", nc, ".\
ours:H./ ra;;pa1-i*'-
"""un'ururo,.
-I I ,
f-J 14, .cal4oerav
:.i$liJ
liri'i, o, i0.,, a.rry ft !
Mvr AnoV' '.roai aciu;uEror *iir, rhe byre ro reser rcr
/$.
J .f + i,
I ) '\v dr/u ouT 81H ../ .R.'er Pc, 1
,c#6311rjf" " :*:.1;:;*-w'lhrhebvlerore5erPcT
:j i,;
- ,)'
_ "T!L.,
*/tt
tl
t'_.t
+
i' , .1 :.:
.J'
--:= rn3r:r)sr. oirhe dbove rourine. lhe to owjng poinn can be noted: \,- l d F-."\r. it
-.' r'n
r I -\*l:
,eLre.et b pofl C. a conrrot sord r. wrirren rn lhe conrol ,-r'u.r*0"",," f;a t,/.\ I :r "$
;llr L. -, a
:\85RcUnljol$oldaflecI'onlyonebllinportc/-?\-*I:l -"f
*o.qa*. noiun*t tr,e vir,"o+. -t .''- \F I iy \ J ,.:

Intelfacing A,D Convener Using the 825SA in


J'E 'i
d BSR Mode - r.z
OLr-
,.- zt/ -l

ision and b ready slatus of the convener,


INfERIAONG PE8IPHERAI.5 (VO!) ATPIICA':T =iIiJ1!-PURPOSE
PROCRAI
434 'ND

-e:eforc, rhe control won


PROBI,EM A}IAI,Y$S
fte sane a! in FigLrre l5 5 therefoR d'"ljl!r
rhe
itre chio Selecr loeic in Figurr 15 7 rs
rhec' :-a D1 D6t
# .-d,j,.."';"t".1; ;000H 'or poft A to 8003H rot rl"e corrrol-es^rer I 0{
&e memor)-mairPcd Lo
fi;fii;EirTi;;?ttEvw'pecrr)
I J
MODE 0: CONIROTJ WORD Ito Mode 0
The connguration of th€ pons is specified as follows:

r, I Pofl A: A' ar inPul Pofl


is u'ed lo rlan conver\ron
O eon C': A, on outpur porr becru'e bil PCo r CO}IIROL WORD F(
a Pon Cr-r: ,qc dn inpul pon to read lbe ndlu' al PC-
! Pon B: nol us€d
a:lqqi5 ! scd ij a srA R n
-. 1:_ ro FrALrre t) O):

D7 Dd D5 Dr
0 000
-15 v +5V Ein

I
lL"" =:ROUTINE

2D'
{rD: - JLXr H,800
IMVI A.981
l jMo\ M.A
4 nD5?o iMVr A,o]l
5, !!- o'ri,,r cn*"." t*i v c.-.- I I IMOV M,A
CALL DET
For Unipolar (0 to I0 \

-DR
p BlC

A"t

ITEGAM
MI'FIF
t#nw
[D
R ntser
V DESCRIPTION
rE----:rion MOV M,A inilia
:-l rcgister. Togo!!4e j,
.lt' i-:: lhe appropiale dela)
PCr goes k

15.?
i."u**n ,n" .4/D conv_e{er ADs?0 usl]1s the 92s54 m Mode
0 and := Mode l: Input c
fl"ii',ii r:.r3 l. handshake cisnal!
:xsfer The features ol
,G \' \! ^lrw
z{EAr'pn.?osE pRoclrMr\,tABLE IEa''HERAT DEvrcEs t '1" '- I
aL 'e 45s

}r€fore, rhe conkol word neccssary ro meet the


,"+ r"l .\r\
re/uirements;s{ fottows,
Dz De Ds D. -D3 l, o1 o, a1
r o o. r r o o o = \ssH
i.-ii---r-A---
Lo o pone c,
Mod; po.i e"iu . j",i c. LL
/-
_
on Ior-Y*"rofiiJ.Fortc|
rnpu! input i: qor outpul
pon A ,r.;
CONTRO! WORD FOR START PIIISE
k

D7 D6 D5 DO D: D: D, DO
0 0 0 0 0 n o rn :-n'u.^^r.1,q

qOUTINE
.* Jr,xr n.soo:\ :poinr rhe inde\ ro conrol resisrer ,-, i
IMVI A.98H<1
-/t,tov ;L,oad the mode conrret worJ . ,, :
v.e. \ :Serupponsn anac,,as inoug L:{ t
.- IMVI A.olH \ ':Load BSR conrrot word
ro ser pCo \r + ',.
r tMovM.A, I Dulse
START puls"
the srART
,Tum on rhe
;Tum -a . cJ \';,
cJ
CALL DEL, :wdir -? "{ r, \+i
l
\
'y"il -?9
8SR conrol qord to reset pco
^4.. -
5+ -- -;,;
t.z/irl
.a, lvTie,ooA f f ,r' { : i!
I6a" otJ,
:Lo6d
- lt,1oV.1gr*a ' Mafl conrersion
;Sta{ conlerslon Ir.c( "4" f
q \)<
.'t )
tDCXtl :Memory pdnrer ro poflC
- {; r-,<vrI F'
R€AD|9 | Mstu-.I{'-e
'IRAL- ,Rcad pon C {' -- ,' - f "f-
rPloce pb', in rne canv " " J,'l ,/{'-
IJqREAD iwarr rn rhe r,op unrii rhe €nd of converton ,
- '"- Jft
-::|L!-4 80o0H
I L|?A -6uwn conve(er
A'/D convener
iRead rvl,
lKeao
-!-,
, -.., "t:' t; '--t
.j d REr

4E*4M DEscRrprro" 1, ( I
o!i.-r-Con MOV M,A inirializes the 8255A pons by ptacing the conrrot word in rhe __ ] ;
E:: :Eg.ster. TE)IQIIITLSIART+ISe [o]Lbe con\enlx. bil pco rs ser ro I; it is tumed - ,_, j
d rEr the appropriare d€ tay. The end otcon\er.ion is ctrect6a ty vlrifliffie sratusof , l:
gl,;,)T-ta- *.: IoM. insrrucrron LDA 8000H readi and pLcei aara in rrre, - I
.x.
Mode l: Input or Output with Handshake *., , i
[
!e
,{.-€. l, handshake signa]s exchanged betwcen the MpU and peripherals
'rc mode include fte following:
'\-lro
prior l
:l'tsfer. The leatures of this
DITERFAC!,IG ?ERJPHE&AI.s (V&) AND ATPI'ICANONS :A]ERA]I,PUN.POSE TROORJ
456

pon) Thev can be confisu eo eirher a' inpul yrs


\.r. Tq o pon\ {A ano B I funcrion a' 8-brt VO

). :l::'l^1
l::;'i"",i::I*". *"t;rei/+are
f:',-."" ',"".,.^* ponT"s sisndr'1 Ihe rema:n:ng (*o rine\ oi
En1+are signdr'1
''*.qtmple
.on i can be u'ed for 'rom Uo luncrionr'
-r'- -
latched.
INTR

illhe A:sS,r' rn",p".inc fron pon c u(ed for hand'hale 'i8nal' v'a a(od-
lines
';ldi;";';" oi a pon rnerernre input and olpur iJrcrion' 'n M"de
Ie
discussed seParatelY = ,,".r*iO,..r--_{
MODE I: TNPITI CONTROL SIGNAIS -;._rRE 15.9
pn ar:
e"- -" ' i-",, +.*. tl'. 'ign't'
'sed
for hand'haling
" ' hen
PC' onLr.PC'
'q
'-::- leloCe I irnng V,hri
;";"'.";;;;;' ,";;'"*oiiu[a-.-t'ot
ton* Pon a u'es rrre upper Inree cignalJ PC- . 1 : ,{Jipblr rofl tird co,Fin
;;il';. ,h. ;;.,;; signals: Pc, Pcr' and Pco rhe funcrron" of rhe'e
irsnar' '-
as follows:
(Inpul BD'Te. FultJj
ir lle ]lp!!.brch har ,c.

+4 ilnterrupr Reques
-':j:!t I h is s ;! gcne!
is-n-41

z,t,\ rs,relqt by lhe tall


Codol Word-Mod. I InPul 6TE tlrrteffupt E-nabte
-_::arion of rhe INTR sis
d^ o *'n -. 3sR modc. The rNTd,
srB^? - ::irblcd rlyough pC?

tBF^, AND STATUS 1'9


=O],
- -i 8(b) uses conrrol w.

* rrl in Mode L Srinitsrt


. rhe accLrrnularor if p
(b) :--:]f$lDic TIiE 82551
::'' I can 5L progra,,,mer
9", : : IO(a) shows a fforc
ri! :. chdck dat' stfltus I
sraNs wod-Mod. I lnpul -. i ,d does not sho\.\ trc
D./ : sinilar (o ihat ofM
Dr Dr D. - ..rrrK r/U Wrtt handr

-:_: ::i vectored iuerupl


: rer lorporA orpor
_::
- _ -d rhe INTEA s 3t\c
flGURE 1s.8 : :-.loses.) llowever. I
8255A N'lode InPUt Conn4r'lLon : ::i hrs no effecr wher
.;, ;;; ;"""..".".;.,-.,.-,"
AE11I.PURPOS8 PROCIAMMABI,E !EruPHA,A'] DEVICES
45?

IBF

INTR.

n'0

i.'- l.:ooe I Trmsg-Wa€iorns for Sirobed Llpur (with lledshake)


,
= .;;;;,;;;c;;;;;;:;;;;;;;;;;li:;J:;:i ffii"ijh:i,.,, ",,,"
gl Input Buffcr Fufl,: Thr. sicndt i( dn acknoqtedgmenr by rhe 825s1)o indicare
irre.tnp!!r-I.h h,. rccfl ed ihe dard byle Thr( is recer $h." tqr,{t! d""drrtr d?r4
; irl9 15 9).
Pi(rlnrerrupr Reque\0:[T]is is an outpur .lgnat d.al oray bslled rc inlerrup{ rhc
_
:rTh,):]gnrl ir renerdreM S r8. IBF {4INIE, rflemat flit-nop) aJe a;te"r^
.. re.{b 1\' lring edge of rhe RD \ignal ,Fisure I5.9). "rr
--_.//.'
{rf-'tnrer.upr enaut"r{qrri.-i.
iaTf'lnrerrupt Enabhr.fIhi. ir an inrenui
inrenai dip-nop
8iD-ffoD u.ea
used ro or.ti\ihtc
rc enable or ,h.
disabte rhe
:-::3r'.n ot rhe NTR sign)l) The rq o R.p-flops t\Tta and INTE8 are seve,er using
-3 r:R node The I\TEa r: enabled ordisabted through pca.
and INTEB is enaolei
:::labled lhrough PC:.
AND STATUS WORDS
- -5.8(b) uses conrrol words derived from Figure lj.4 to set up pon A and porr B as
: nis in Mode 1. Similarly, Figure 15.8(c) atso shows the sratus word. which wilt be
: the accumularor if pon C is read.
sMMINC THE 8253A IN MODE I
i
can be programmed ro funclion using either slatls ch€ck I/O or inrenup!
:-::-a
.-r.10{n) shows a Rowchai for lhe sratus check tO_ In this flowchart, th; MpU
I/O.

:ji ro check data status through the IBF line unril it goes high. This is a simplified
:'-.:- and does nol show how to handle dara transfer jf two pors are being used. the
:re is similar ro thar ol Mode 0 combined wirh the BSR mode. The disadvantage of
;::i check rO with handshake is that rhe MpU is tied up in rhe loop.
l-e flowchan in Figur€ 15.10(b) shows the steps required for rhe interupt tO,
rji*- rhar vectored interupls are available. The confusing s!€p in th€ intempt I/O is to
i (itner lor pon
either for A.r
Don A B Figure
non B.
or pon Fir'r. l5_8(a)shows
I 5 tl )r.h^tu('h,,'L- <TEsisnaj
tbai the STB- : ^^--^^.^,
r--"r js;onnecled
=)-. rl-e INTEi is atso conrrclled b) rhe prn pC.. (tn pon B. pin pC: i( u(ed for
"rd
L:e Durposes.) However. rhe INTEA is sel or reset in the BSR mode and lhe BSR
F -ord ha, no eflecl when porb A and B are \er in Mode l.

)-
I.cA!1€G ai*AL-
INTERTAC!{C PERIPIIERA! S (vO') AxD
458

r
I

r'
; 15. IO
FIGIJRE
iLJwchans srans chect vo (al and lnr"Gup
to b)

i lhe inlerruPt it ma) be necessary to-!:


In case Ih€ INTR lire i( used to implemert
th€ por requesting an intenupt servrce ad
rhe st;s of INTRa and INTRB to idenri0
drrelrnine $d priority Lh'ough software' if
necessary' l
--
/ co'rrRol sIGNAls
,L'ilz*"t!.tt*"*'lheconlrolsignalswhenpo:l'AandBareconfiguredasoulpurFla
ryropr t, ourPur
------\-
Th;se sisnals are defined as follows:

n:ArA
(Mode l)

CONTROI, AND S1ATUS WORDS 15.l3 shows an inle icir


rieur" rS. r rol ,l'o", ,te control word llsed to set y t".li i.:*,i i:*:*fi .: pod for a keyboard wit
s l t(c) also shows tle staus word' which will b€ plac€
:
ii""iJ tii'rit iV,itu*" l
:: r,rh sratus check VO
accumulalor if Poft C Is read
PERI?HERA! DEVICES 45&

"^/
W^

\TEB

'."
.r.doa

^r{N+
" ''7 Y"
hrtt Corpanlior, P{tpho.l Caq'a,.,r (So! Chd. Caiir.: Aurhor t9t93), p. 3l |l.

,,'JTfL'0S--
-6$
-
a< t-' er€'
-
ioo
?"rt
.b<1
t5.12 "'
'i:re l: Tim,ng Waveforms lor Stobed (wrth Handshaler OuFur
: r51id frur ri'.L Coqxlrrion. P{rrh?nt c.npoft t tseta Chrz, cd t: Aurhoi t99r). , l. r

ion: Ar Application of the 82554 in the Handshake


(Mode l)
STATEMENI
-;. I 3 shows an intertacing circuit using the 8255A in Mod€ l
Pon A is des;gned as
:alrforakeyboardwith inlerrupt tO, and ponB is designed astheoulputpon fo.
:nh staus check tO.
?ROOIIM
(rr'O!) AND A.PPI'ICA
TNTERFACINO PERIPHEIIIS
460
t Th€ output to the prinl
5 can be check€d by Ie

Pod A lnFrr Fom Kelboard Word to S€t INTEI


i:ould be 1.
DO
fE- 6-, p6oL"o1
12 IBF , To pedpheral
Dr De
cs PC' 00
sO85 lnrem0 LR\t b r)
J
BSR D

loR ED
lds WR PBr

RESET PBJ
Word fo Check (
RESTT OUI

L Dz Do

l:ff"]"t;i: "*^'" tode I (strcbed Inp.1/outsut)

M{ski g b}-lel
J/1 Find porr addresse' by analyzing
lhe decode^logrc
r dnd po( B as onrpur
in Mod
to tet up Pod A as ri
neprmrne rhe conrrol word
3. Lirhlizatior Proglqm
4. ti:xtill:nmff::iir'}1"mlililit:lililitil),i.",1*'
!t/nr. initializalion instructions pnnter
and a su
MVI A,B4H

OUT FFH
MVI A.O9H

l.ll'i.':i;"i':i,.:T:i':1,:'':N.J":;: fJliil' l":i::l H l1i:I OUT ITF}I


EI
as follovrs:
indi!i;ual pons lJe selec'ed CALL PRINT
fPo" a - FcH'Ar =0 \o=0r iConlinu( olh.r
\ ;;;; - tDHr^r -0tu=1)
I;;;' - rEH rA'| =r'Ao=o)
'\ c""u"' neg'u"' - rFH 'A - I Ao - l) i I,X] H,MEM
in vode I MVI B.COIJ\'T
X"t up Port 4 lnpul 5nd Port B as outp t
l cont.ot wo,a
as MO\/ A,M
MOV C.A
D, Da Ds Dq D3
0
IN FEH
Loll ANI O]H
r + I 'l
(Pc"
]Z STATUS
Port'r in IPo', A MOV ,t,C
't
runcrron N4od€ I las inPut l ann OUT FDH
II"X H
DCR B
rn fte above contror
qord a' b,, are.erf-eleJ;aJ:l;;:il';"?#1fi:,:1.7 JNZ NLjX'T
care logrc .lare To gener*"
h** tB*' "*r^^" pc, R I-:t'
," .., pco
ssr raod" to
ffii::::'ffi.:l"';ffiiv'u'ing 'r'J '"t
PROCI.I.MMAIIE IEIIPIIERAI DEVICES 451

ilie oulpul to rhe prinkr (pon B) is slatus-conlrolled. Th€r€forc, the slatus of lin€
be checked by reading bit Dr of pon CL.
=n

Word to Set INTEA To set the IntemptEnable flip-nop ofpod A (INTE^), bii

D7 D6 Ds D1 D3 D2 Dr Do = 09H
0 000r00 I

J
BSR
.tt
Don'tcare Bit PC4 L,u*,

lYord to Check OgE


Dr Do Ds Dr Dr D: Dr Do
XXXXXX OBFB x
Masking byle: 02H

hlizstion Program
MVI A.B4H iword !o initialize.pon A as inpur,
i pon B as output in Mode I
OUT FFH
MVI A,OgH tscr INTEA (PC!)
OUT FFH ;Uring BSR Mode
EI iEnable rnlerupts
CALL PRINT
iConlinue other larks

LX] H,MEM iPoint index to location ol stored characrers


MVI B.COUNT iNumber of chanclers to tre printed
\10v A,t\'{ :Get cla.acter f()m mcnrory
vov c.A
IN FEH iRead pon C fo.'slatus of OEF
ANI O]H iMask irll bits except Dr
JZ S'TATUS Jf il is low, rhe printe! is not readyi wril in lhe bop
MOV A.C
OUT FDH jsend a character b pon B
JNX H :Point to lhe nexr chdracter
DCR B
JNZ NEXT
RET

You might also like