0% found this document useful (0 votes)
11 views8 pages

IO Port Programming

Uploaded by

tharunkumar0973
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

IO Port Programming

Uploaded by

tharunkumar0973
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Tlo PoRr Pe Ge AMHI NG

f
Thene ene to tol ef 4opns ot Po, P, P- Pe
32 pins ne Kt anide fon fou
pot
8 pns
&
whee lach pot takes Punetiovs
Perto - &at
Portl - s i t

Pot& -ght

nRost all perts ae uni tialiged as

ocoupies a tojal of pins t


PoRT O: Pert o To we
nput on utput.
Can he wco fer sutpt
Porto nput
as both cnetdeallu
the pins he
Ports, lach pin must s becar Pot
Po pnt s
Ths
to ohe Resto. TTL chps )
open collects nVc
Dvain. ( open
opem
Po.c
Pert o as ut:
n rdey to Nate poto Po
nput,te port ut be Pos

Progammed y wnting l toas npt pot


t, and then date s eleeive
y oitng ls to
f m taat pot Hov A, tolfh
() back: iov A, po
Pet.

STmp back
Dual ole e Poto
tt woths as
Foo-ADy: Bost udtplenes addhes and data
though pot o to Save pins.

PoeT: mput on sutput


ReristA
pul up ramntsy
amy
+ does not need has prll p Rertoy
since italeady
intenally as p Pet

PoRTI as npt:
Pett bs heen as a output
pet, to Make Ct
an nput pot again,
witng
Ito ol C bit.
Hov A, t#topph
Ct as nput pert
Hov , 4
Acal Dela
Pent2: 24 to a)
2)

nide)
no neac ter putt up penttos (puwnt
Pont 2 as nput

s ongt pot
Dual voa o pont
H_he ode Adden Rines
Otthen fnetion Pont 2. rt2 ombtns to fsm
Aong witt poto,
* adhes.
the entnal emey

Pert 3 (1o toi)


Does not nee any pull up lerisias
os npt port on Ret

Atkewnate funetion onts


R bit fnetioy
Ps-o RD Omnuuia tiy

INTO Poer SATUS


|NT) tntnups
P3-3
To
nè ealiged as
Input pots
Pa.l WR
X*Lnal Rerct
3-7
Ilo Ret aniplatton :
cpL Rait Manipulatim Tns hustns
Setb
ch b Pott a all tte eguts
ane bit cddrenible.

woite the fo louoing rogam c so duty tyee


(4) Qaate a Squae Wave
ato e Port l
(b) heate a Syuae wave o 66 duty ye
on lat 3 Portl.
Progam aleulation
(a)
Skp: Delay ONtUMe SO
oftme So
Aume Requred tme

Nachine ycle
Mov R2,# Cent|

Hee NOP
NoP
NOP
DJNZ R2, Here 2.

ReT 2

Step 2 ! Atume Pyocevnet fepueney ll09sHi


|2 (Machin, loes
Td tme Deay
(Conti s)+)4I. orsu = Ta
(Countt s)t2 Td

SCountt = Td -2

Ceunt 0.sxo 2

l·ogxID

Spz: Dlay Progumn Wexiftatnn


ov R2, 92

o.sDmS

Hee 2
DTNZ R2,
2
Rer
SHpt Pragan to duplay Sqnaeiae
lHere! Set b p! o
Acall Delay
Aall Delat
Here

Delay Nov R2, +92


Nop
NO
NOP
DJNZ R2 again
Ret

Jump to ruget f att =1


JNA Jait, tyt
ite a pogam to follouing
(a) toop neniting te Pi.2 latt Wnttl t lxasue

(b) clen Pl.2 beaones high, eute Vale 4rh to


Port o
(C) Gend a high to leorw (Hro) pulk to P2.g
SeTB P.2
ov A,# 45
TN B Pl-2 agin
Hov Po, A
toL
SeTB p2.3
Low
CLR P23
an Dnput Port
Reodng
trat
Assumethat it P2 3 s c
Oen. 4 it qoes high,
coe s hot Monite tre lan t
2t meams the
it goes
gos high,send
Conttnuousy . wheneven ton
a low pul to port Pl.s to
a high to
On a uggeh.

Here: JNB 23, Here kaniteing


Vec
SETB P5
CLRI Pis 42:3
Here
SsMp Rst

A Suttch & conecteo to pim 7. 97te a egany


to check the Slatis

follewig leten N to P
(a) ¢ Sw=0 Senl
4Sw l, send Cotta y'to Pz
(b)
Set b Pi? mtmad
HoU p2,#'N

o p2, +y
Randing
A Swtteh cs onneotel to
to pn 27. íte a pogram to gt the Slats

SeTG P27
Aqain: Nov e, Pl-o
Mov P2:7, C
SIMP
Rang a RoH a
(eenal)
Assum the ON chip RoH has
ON Nen açe. oute
a Hon
the
a Pogam to copy ct tom (ode Space to 1e
oPr omey Spaee Stasting at adden to H(Sha
Po.
Pace a layte in ugper Ren,ge a Copy

Hou DpTR, * mydata


acees the
Hey H,+80H
Hee :
Movc A, @A+DpTK ORG30o H

Heu po, A END


Jz erit
IN DPTR

Here
Gnit:
SIMP

You might also like