-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
1/42
Microprocessors
Input/Output Interface
(Chapter 10)
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
2/42
Introduction
• In a typical computer system, the user communicates with the computer via
standard peripheral devices such as the ey!oard, mouse, display, printer e"t"c"
• #urthermore computers and microprocessor !ased systems are used ininstrumentation or automatic control applications" In such cases it is necessary
that the microprocessor reads the state of input devices (switches, sensors) and
activate some output devices (motors, heaters, li$hts)"
• %he I/O interface is re&uired to ena!le the interface !etween the microprocessor
and the peripheral devices"• %he peripheral devices are connected on a microprocessor system throu$h the
Input/Output ports"
• %he I/O interface provides the followin$'
Isolation !etween the !uses and the peripheral devices"
ddress decodin$"
*ynchroni+ation/atchin$"
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
3/42
Isolated vs Memory-mapped I/O
• Isolated I/O
I/O locations are separate from memory locations
*pecial I/O instructions are used
%he most common techni&ue for Intel microprocessors
dvanta$e' More space for memory
.isadvanta$e' dditional control si$nals (IO/M) and instructions increase compleity
• Memory-mapped I/O
I/O devices are treated as memory locations in the memory map
ny memory transfer instruction can !e used (MO, ., *% etc)
dvanta$es' *impler decodin$ circuitry, no special instructions re&uired
.isadvanta$e' portion of the memory system is used as the I/O map, reducin$ the
memory availa!le to applications
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
4/42
Input/Output Instructions
• %he 2022 and 20324 processors use the 14 lower address lines (0 to 15) to
address I/O devices" %his limits the maimum num!er of I/O ports to 467"
• %he I8 instruction copies the content of an input port to re$ister , 3 or 93"
• %he O:% instruction copies the content of re$ister , 3, or 93 to an output
port"
• e$ister is used for 2-!it ports, 3 for 14-!it ports and 93 for ;ead input port 00;0? into re$ister
• OUT 30H,AL >Copy re$ister to output port 00;0?"
Variable Address. %he address is specified throu$h re$ister .3 as a 14-!it address"
• MOV DX,3A0H >*et I/O address
• IN AL,DX >ead input port @.3A or ;0? into re$ister "
• OUT DX,AL >Copy re$ister to output port @.3A or ;0?
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
5/42
?i$h evel an$ua$e Input/Output Instructions (Bascal)
• Input/Output using Pascal' I/O is o!tained usin$ the Bort@ AD instruction" X := Port[PortAddress]; /E Copy the contents of the specified port into 3 E/
Port[PortAddress] := X; /E Copy the contents of 3 into the specified port E/
• Input/Output using Delphi: .elphi does not allow direct access to I/O ports"
%his can !e done !y insertin$ assem!ly lan$ua$e code into .elphi as follows'
asm ; code equivalent to value:!port"portaddress#;be!"mo# d$,%ortaddress >specify the port address!" a&,d$ >input from the port specified !y FdG into FalGmo# #a&'e,a& >copy input data into varia!le valueD
e"d;
asm ; code equivalent to port"portaddress# :! value;
be!"
mo# d$,%ortaddress >specify the port address
mo# a&,#a&'e >move output data into re$ister FalG
o't d$,a& >output data to the port specified !y FdG
e"d;
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
6/42
?i$h evel an$ua$e Input/Output Instructions (C/CHH)
• $/$%% does not allow direct access to I/O ports" %his can !e done !y insertin$
assem!ly lan$ua$e code into the C/CHH code as follows'
((asm ; code equivalent to value:!port"portaddress#;
)
mo# d$,%ortaddress >specify the port address
!" a&,d$ >input from the port specified !y FdG into FalG
mo# #a&'e,a& >copy input data into varia!le valueD
*
((asm ; code equivalent to port"portaddress# :! value;
)
mo# d$,%ortaddress >specify the port address
mo# a&,#a&'e >move output data into re$ister FalG
o't d$,a& >output data to the port specified !y FdG
*
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
7/42
Input/Output :sin$ .s (C/CHH)
• #or protection purposes, modern operatin$ systems such as the indows 3B
do not allow the use of the I8 and the O:% instructions in the users pro$rams"
• way to have access to I/O ports is throu$h li!raries (. files) developed for
this purpose" *uch a li!rary is the !"o't3+d&&
• %o use this li!rary in isual *tudio (CHH) we must'
dd the !"o't3+&!b file in the iner properties
• BroJect -KBroperties-Kiner-KInput-Kdditional .ependencies
.efine the two functions for input and output and use them accordin$ly
short Lstdcall Inp;
void Lstdcall Out;
main()
{
short Inval = Inp32(889); /E input from port 22 into varia!le FInvalGE/
Out32(888,0x2f); /E Output the he value
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
8/42
*imple Input Bort
• n input port can !e implemented
usin$ a simple octal !uffer such as
the =6*
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
9/42
*imple Output Bort (:sin$ the =6*;=;)
• n output port can !e implemented
usin$ a simple octal latch such as
the =6*;=;"
• %he address decodin$ circuit
ena!les the .-latches of the
=6*;=; whenever the port
address is selected !y the
processor" In such a case the state
of the data !us is latched to the
output devices"
• %he address decodin$ circuit is
ena!led only if the IO/M si$nal is
set ?i$h !y the 2022 (ow for the
24 processors) and the si$nal
is ow"
+(010
.
98
23 O2
1
.=
.0
.
IO/MN
& '
& & ( ) s t e *
0
H5
11
10
2
=
4
5
6
11 10 2 6 = 4 5 1 ; < 0
0 1 0 0 00 1 1 33 3 3
ddress
640? to 64#?
Logic 1 => LE! is O""Logic 0 => LE! is O#
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
10/42
*imple Output Bort (:sin$ the =6?C%5=;)
• %he =6?C%5=; is pin compati!le
with the =6*;=;" %here are three
si$nificant differences'
%he 5=; has all inputs on the left side and
all outputs on the ri$ht side of the IC,
while the ;=; has the even num!ered
inputs on the left side and the odd
num!ered inputs on the ri$ht side" %hus
the 5=; is easier to !y handled on BCP
!oards"
%he ?C%5=; has a
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
11/42
*imple I/O 9ample 1 (?ardware)
• .raw a circuit to show how 2 switches can !e connected on the input port ;?
and 2 9.s on the output port 5C?"
*i l I/O 9 l 1 (* ft )
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
12/42
*imple I/O 9ample 1 (*oftware)
rite a pro$ram to eep readin$ the state of the switches and switch O8 the 9.
at the position form !y the switches at .
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
13/42
Mas Operations
(a) rite a pro$ram to eep readin$ the
"$%& '(ite ) p(og()* to +eep (e)ding the
st)te o, the switches )nd switch O#
the LE!s ,o( which the co((esponding
switch is closed-
*i l I/O 9 l
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
14/42
*imple I/O 9ample <
#our float switches and four 9.s are used to indicate the level of a li&uid in the tan shown !elow"
%he switches and the 9.s are connected on a computer throu$h an interface !oard with an input
and an output port occupyin$ the address 640? to 64#?"
• .raw the circuit dia$ram of the interface !oard"
• rite a pro$ram to eep readin$ the state of the float switches and display the li&uid level on the9.s" If an error is detected then switch O8 all 9.s"
I n t e r f a c e
P o a r d
9mpty,ow?alf #ull
.I;
.I<
.I1
.I0
.O;
.O<
.O1
.O6
Closed
Closed
Open
Open
?i$h
.O0
.I; .I< .O; .O
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
15/42
*imple I/O 9ample < (Circuit .ia$ram)
1
.=
.0
.
IO/MN
& ' & & ( ) s t e *
0
H5
4$5610
.
98
23 O2
+(,--
./ .,
.I0
.I1
.I<
.I;
.O6
.O;
.O<
.O1
.O0
11
10
2
=
4
5
6
)11 )10 ) )2 )6 )= )4 )5 )1 ); )< )0
0 1 0 0 00 1 1 33 3 3
)ddress
640? to 64#?
*imple I/O 9ample < (*oftware usin$ Case/*witch *tatement)
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
16/42
*imple I/O 9ample < (*oftware usin$ Case/*witch *tatement)
Pseudo Code:
7et OutVal to 0, i8e s3ith off all leds
Repeat
Read Input port in InVal
Mask out D!,D2,D1,D0 from InVal
Case of InVal
0: OutMask = 11: OutMask = 2
!: OutMask =
%: OutMask = "
9: OutMask = 10
else OutMask = 19
Mask in D to D0 of OutMask in OutVal
&rite OutVal to Output port
'ntil ke(pressed
C)C** Code
main+
-
short InVal, OutVal = 0.
do -
InVal = Inp!2+0/#0.
InVal = InVal 0/f.
s3ith +InVal -
ase 0: OutMask = 1. 6reak.ase 1: OutMask = 2. 6reak.
ase !: OutMask = . 6reak.
ase %: OutMask = ". 6reak.
ase 0/f: OutMask = 0/10. 6reak.
default OutMask = 0/1f.
OutVal = +OutVal 0/e0 ; OutMask.
Out!2+0/#0,OutVal.
3hile +45k6hit+.
*imple I/O 9ample < (*oftware usin$ array as a looup ta!le)
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
17/42
*imple I/O 9ample < (*oftware usin$ array as a looup ta!le)
Pseudo Code:
= 00001 )?
= 00010 )?
= 00100 )?
= 01000 )?
= 10000 )?
= 111111 )?
Repeat
Read Input port in InVal
Mask out D2,D1,D0 from InVal
Mask in D2,D1,D0 of to OutVal
&rite OutVal to Output port
'ntil ke(pressed
C)C** Code
main+
-
short InVal, OutVal = 0.
short = 0/1, 0/2, 0/1f, 0/,
0/1f, 0/1f, 0/1f, 0/",
0/1f, 0/1f, 0/1f, 0/1f,
0/1f, 0/1f, 0/1f, 0/10.
do -
InVal = Inp!2+0/#0.
InVal = InVal 0/f.
OutMask = .
OutVal = +OutVal 0/e0 ; OutMask.
Out!2+0/#0,OutVal. 3hile +45k6hit+.
.C Motor *peed and .irection Control
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
18/42
.C Motor *peed and .irection Control
• %he speed of a .C motor is proportional to the .C volta$e applied at its terminal"
%hus the speed can !e controlled !y controllin$ the .C volta$e"
• %he .C volta$e can !e controlled !y'
Insertin$ a resistor in series with the .C motor"
• :nnecessary dissipation of ener$y on the resistor"
:sin$ Bulse idth Modulation (BM)
• %he direction of rotation a .C motor is reversed !y reversin$ the polarity of the
.C volta$e applied at its terminal"
%his can !e o!tained usin$ a relay (chan$e-over connection)"
Connectin$ a relay on an output port re&uires the use of hi$h current drivers such asthe :8
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
19/42
.C motor interface eample
.C motor is connected to a computer as shown !elow" %he switches and the motor
are connected on an input and an output port occupyin$ the address 640? to 64#?"
• .raw a circuit of the interface and the connections to the motor
• rite a pro$ram to eep readin$ the state of the switches and control the operationof the motor accordin$ly"
0
1
0
1
0
1
*tart/*top #ast/*low #wrd/ev"
Interface Poard
.C Motor
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
20/42
.C motor interface eample (*oftware usin$ conditional eecution)
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
21/42
.C motor interface eample (*oftware usin$ conditional eecution)
Pseudo Code:
7et OutVal to 0, i8e motor is O99
Repeat
Read Input port in InVal
If On)Off 6it = 1 then OutVal+D0 = 1
else OutVal+D0 = 0
If 9ast)7lo3 6it = 1 then OutVal+D1 = 1
else OutVal+D1 = 0
If 9r3d)Re@ 6it = 1 then OutVal+D2 = 1
else OutVal+D2 = 0
&rite OutVal to Output port
'ntil ke(pressed
.C motor interface eample (*oftware usin$ a looup ta!le)
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
22/42
.C motor interface eample (*oftware usin$ a looup ta!le)
Pseudo Code:
= 000 )? 000 ABmotor is Off
= 000 )? 001 ABmotor is Off
= 010 )? 010 AB OnA7lo3ARe@ = 011 )? 011 AB OnA7lo3A9r3d
= 000 )? 100 AB motor is Off
= 000 )? 101 AB motor is Off
= 110 )? 110 ABOnA9astARe@
= 111 )? 111 ABOnA9astA9r3d
Repeat
Read Input port in InVal
Mask out D2,D1,D0 from InVal
Mask in D2,D1,D0 of to OutVal
&rite OutVal to Output port
'ntil ke(pressed
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
23/42
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
24/42
=-se$ment .isplays 9ample1' Bro$ram
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
25/42
$ p y p $
=-*e$ment .isplays' 9ample
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
26/42
$ p y p
#our float switches and a =-se$ment display are used to indicate the level of a li&uid in the tan shown
!elow" %he switches and the display are connected on a computer throu$h an interface !oard with an input
and an output port occupyin$ the address 640? to 64#?" .raw the circuit dia$ram of the interface !oard"
rite a pro$ram to eep readin$ the state of the float switches and display the li&uid level on the display
usin$ the di$its #(#ull), ?(?i$h), (?alf), (ow) and 9(9mpty)" If an error is detected then switch O8 thedecimal point"
I n t e r f a c e P o a r d
.I;
.I<
.I1
.I0
.O;
.O<
.O1
.O6
.O0
.O4
.O5
.O=
a
!
c
de
f
$
a
!
c
d
e
f
$
dp
Open
Open
Closed
Closed
.I; .I<
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 10 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
.I1 .I0
9mpty
ow
9rror
?alf 9rror
9rror
9rror
?i$h
9rror
9rror
9rror
9rror
9rror
9rror
9rror
#ull
*tate
9
"
"""?
"""""""
#
.i$it Code
=-se$ment .isplays 9ample1' Bro$ram
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
27/42
$ p y p $
=-se$ment .isplays 9ample;
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
28/42
$ y
)1
.=
.0
.
IO/MN
& ' & & ( ) s t e *
)0
H5
4$5610
.
98
23 O2
+(,--
./ .,
.I0
.I1
.I<
.I;
.O6
.O;
.O<
.O1
.O0
)11
)10
)
)2
)=
)4
)5
)6
.O5
.O4
.O=
a!
c
de
f
$
a
!
c
d
e
f
$
0 1 1 1 1 1 1 ;#
0 0 0 1 1 0 0 0C
1 1 1 0 1 1 0 =4 1 0 1 1 1 1 0 59
1 0 0 1 1 0 1 6.
1 0 1 1 0 1 1 5P
1 1 1 1 0 1 1 =P
0 0 0 1 1 1 0 09
1 1 1 1 1 1 1 =#
1 0 0 1 1 1 1 6#
1 1 0 1 1 1 1 4#
1 1 1 1 0 0 1 =
0 1 1 0 0 1 1 ;;
1 1 1 1 1 0 0 =C
1 1 1 0 0 1 1 =;
1 1 0 0 0 1 1 4;
- $ f e d c ! a
.0.1.
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
29/42
$ p y
=-se$ment .isplays 9ample1
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
30/42
$ y
)1
.=
.0
.
IO/MN
& ' & & ( ) s t e *
)0
H5
4$5610
.
98
23 O2
+(,--
./ .,
.I0
.I1
.I<
.I;
.O6
.O;
.O<
.O1
.O0
)11
)10
)
)2
)=
)4
)5
)6
.O5
.O4
.O=
a!
c
de
f
$
a
!
c
d
e
f
$
0 1 1 1 1 1 1 ;#
0 0 0 1 1 0 0 0C
1 1 1 0 1 1 0 =4 1 0 1 1 1 1 0 59
1 0 0 1 1 0 1 6.
1 0 1 1 0 1 1 5P
1 1 1 1 0 1 1 =P
0 0 0 1 1 1 0 09
1 1 1 1 1 1 1 =#
1 0 0 1 1 1 1 6#
1 1 0 1 1 1 1 4#
1 1 1 1 0 0 1 =
0 1 1 0 0 1 1 ;;
1 1 1 1 1 0 0 =C
1 1 1 0 0 1 1 =;
1 1 0 0 0 1 1 4;
- $ f e d c ! a
.0.1.
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
31/42
a) .raw a circuit dia$ram to show how four switches and two =-se$ment displays
can !e interfaced to an 2022 !ased system occupyin$ the address 10? to
1#?,
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
32/42
a) .raw a circuit dia$ram to show how four switches and a =-se$ment display
can !e interfaced to an 2022 !ased system occupyin$ the address 0? to
#?, #0? to ##? respectively"
!) rite a pro$ram to read the state of the switches and display on the =-se$ment display the letter'
• ?, if there are more switches closed than open,
• , if there are less switches closed than open,
• 9, if the num!er of switches closed is e&ual to the num!er of switches open"
?omewor- uestion ;
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
33/42
a) .raw a circuit dia$ram to show how si switches and ei$ht eds can !e
interfaced to an 2022 !ased system occupyin$ the address ;0? to ;#?,
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
34/42
a) .raw a circuit dia$ram to show how the followin$ can !e interfaced to an 2022
!ased system'
i" #our switches connected on an I/B port occupyin$ the address ran$e from ;0? to
;#?"
ii" 9i$ht eds connected on an O/B port occupyin$ the address ran$e from
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
35/42
a) .raw a circuit dia$ram to show how a common cathode =-se$ment display can
!e connected on an output port, occupyin$ the address C?"
!) rite a pro$ram to display the di$its from 0 to on the =-se$ment display with
a 1-second delay !etween di$its"c) rite a procedure to display on the =-se$ment display, the letter 9 if the
contents of the varia!le I8 is e&ual to 20?, the letter ? if I8 is $reater
than 20?, or the letter if I8 is less than 20?"
d) rite a pro$ram that eeps readin$ the !inary num!er from the input port
0? and displays on the =-se$ment display, a letter accordin$ to the ta!le
$iven !elow"
000 001 010 011 100 101 110 111
9 I 7 4 8 9 F
?omewor- uestion 4
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
36/42
a) .raw a circuit dia$ram to show how the followin$ can !e interfaced to an 2022 systemi" %hree switches connected on an I/B port occupyin$ the address ran$e from 40? to 4#?"
ii" 9i$ht eds connected on an O/B port occupyin$ the address ran$e from 50? to 5#?"
!) rite a pro$ram to
i" read the code formed !y the three switches in a 1-second time intervals,
ii" convert the input code into a !inary value accordin$ to the ta!le !elow and store it in an array
called PI8, and
iii" display it as a !ar $raph on the ei$ht eds as shown in fi$ure !elow
#or eample if the switches form the num!er 101 then the num!er 110 must !e stored in the
array PI8 and the eds should display 11111110"
0 0 00 0 0
0 0 10 0 1
0 1 00 1 1
0 1 10 1 0
1 0 01 1 0
1 0 11 0 0
1 1 01 0 1
1 1 11 1 1
Input Pinary Par Rraph
%?9 2
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
37/42
VCC:
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
38/42
93MB9
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
39/42
• 7se a &,$66 PPI to interace our sitches at address
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
40/42
• Mode 0 operation causes the BBI to function as either !uffered input or latched
output
• %he 2
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
41/42
• ewrite the pro$ram of the eample of slide ;0, this time usin$ the BBI and
settin$ up the ports as shown in the previous slide
?omewor
-
8/18/2019 InOutPelan Induk Perindustrian (PIP) 1986 Pengenalan Sejak mencapai kemerdekaan, kerajaan Malaysia telah menggiatkan usaha kearah mewujudkan Malaysia sebagai sebu…
42/42
• ll eamples of slides ;1-;4 can !e modified to include BBI interfacin$