Experiment #6 Input / Output Design
Experiment #6 Input / Output Design
Experiment #6 Input / Output Design
3.0 Background
A. Memory-Mapped Input / Output (I/O)
There are two different types of philosophies when it comes to interfacing to I/O
devices. These are known as Memory Mapped I/O and Isolated I/O. The
MC68000 uses the memory-mapped I/O philosophy. This implies that all I/O devices
are accessed by reading and writing to memory locations within the microprocessors
address space.
The discussion provided in Experiment #5 concerning the timing relationships of
asynchronous bus cycles is also relevant to I/O design.
B. Interrupts
The MC68000 microprocessor is equipped with 3 interrupt request signals (*IPL2,
*IPL1, *IPL0) which provide a maximum of 7 distinct interrupt levels, and a normal
operating level (level 0). The Status Register contains three Interrupt Mask Bits (I2,
I1, I0) which are the logical complement of the interrupt hardware signals. The
following chart illustrates the relationship between the interrupt request signals and
the interrupt mask bits.
Experiment 6 - 1
When dealing with interrupts, the device requesting service activates a hardware
signal called an Interrupt Request line. (*IRQ). The interrupt request lines from
several peripheral devices are prioritized, encoded and inputted to the three interrupt
request lines of the MC68000. The interrupt requests are made pending until the
CPU completes the current instruction being executed. Once the instruction is
completed, the current state of the processor is saved on the stack, and an interrupt
acknowledge cycle begins.
The MC68000 compares the incoming interrupt request to the current interrupt
priority level stored in the Status Registers Interrupt Mask Bits. If the incoming
level is less than or equal to the current interrupt priority level, then the interrupt is
not serviced.
The following is a list of the interrupt level settings for the SANPER-1 Educational
Lab Unit.
Interrupt Level
7
6
5
4
3
2
1
0
Where:
Interrupting Device
ABORT Switch
ACIA2 (Host Port)
ACIA1 (Terminal Port)
ACIA3, Speech, PIA
devices
PI/T Parallel Ports (*PIRQ)
PI/T Timer (*TOUT)
System Expansion Board
Normal CPU Operation
(No interrupt pending)
Interrupt Level 1 (*IRQ1) is made accessible to the user through the System
Expansion Board. This interrupt level may be either Auto-Vectored or UserVectored depending upon the jumper configurations on the SANPER-1 System
Experiment 6 - 2
Board. The user may assume that the SANPER-1 ELUs have been configured for
Auto-Vectored Interrupts on Interrupt Level 1.
4.0 Statement of Problem
In this experiment the student will design and implement the hardware and software to
read data from a DIP switch, pass this data to a software counter, and display the
counters outputs on two 7-Segment Displays.
Experiment 6 - 3
HINT:
Use one of the SANPER-1 ELUs Block Select lines as part of your
address decoding implementation.
Additionally, the user must design circuitry to generate a *DTACK signal to the
MC68000 whenever the latches are accessed. The user must determine if any wait
states need to be inserted based upon the propagation delay through the address
decoding logic and the latches.
2. Using your schematic diagram and parts kit, build your I/O circuit on a breadboard
strip. If a DIP switch is not available, simulate it by tying the latch inputs either to
+5V DC or ground.
3. Write an interrupt service routine that performs an input function of reading data from
a DIP switch, and performs an output function of writing data to two 7-Segment
displays.
The MC68000 reads and writes data to the latches in Binary Coded Decimal (BCD)
format. The range of a BCD number is 0 to 9.
The routine should read the value set on an 8-position DIP switch every time the
ABORT Switch is depressed. The 8-bit value should be read in as two BCD numbers,
with the four least significant bits comprising the least significant BCD digit, and the
four most significant bits comprising the most significant BCD digit. Once the value
is read in, it should immediately be displayed on the 7-segment displays. This value
is then passed to a two-digit BCD counter. The counter begins counting at the value
read from the DIP switch, and increments one count at a time at a minimum rate of
one count per second. The current counter value is always
displayed in BCD notation on the two 7-Segment displays. The counter will count up
to a maximum value of 99, and then this interrupt service routine should exit and
return back to TUTOR.
Note:
Due to the fact that the numbers are BCD, the counter must be
implemented with the MC68000s BCD instructions. An example of such
an instruction is ABCD or Add Decimal with Extend.
6.0 Procedure
1. Connect your hardware up to the SANPER-1 Educational Lab Unit.
2. Use TUTORs Memory Modify (MM) Command to write data to the 7-Segment
displays. If the displays do not show the proper value, debug your hardware.
Debugging Hint: Create a small test program to repeatedly write data to the 7Segment displays. Run the program and then enter the SANPER-1s Hardware
Single-Step Mode. Continually single step through the test program until the
problem is identified and fixed.
Saniie & Perich
Experiment 6 - 4
3. Set the appropriate exception vector to point to the interrupt service routine from
Prelim #3. Each time the user presses the ABORT Switch, the routine from Prelim
#3 will begin executing.
4. Set the DIP switch to a BCD value of 25.
5. Run the program and verify that your hardware and software are working correctly.
Test your design thoroughly by entering several values at the DIP switch, and
verifying that the counter begins and ends counting at the proper values.
For each BCD digit, the only valid DIP switch values are in the range of 0000 to
1001.
6. Demonstrate to your Lab Instructor that your program is operating correctly.
7.0 Discussion
Submit the following to your Lab Instructor as a Final Report:
1. A commented listing for the programs of Prelim #3.
2. A schematic diagram of your hardware design for Prelim #1.
3. Review Chapter 7, Hardware Description of the Motorola Educational Computer
Board Users Manual. Also, review Chapter 8 and examine Figure 8-3, Sheet 2 of 3
of the MC68000 Educational Computer Board Schematic Diagram, and redraw only
the ABORT switch circuitry. Describe in detail how this ABORT Switch circuitry
operates.
4. The Exception Vector Table has vectors assigned for Uninitialized Interrupts and
Spurious Interrupts. Discuss how each of these types of interrupts occurs. Discuss
the significance and applications of each of these types of interrupts.
5. Discuss the differences between Auto Vectored and User Vectored interrupts. For
how many of each type does the MC68000 allow?
6. Discuss the events that occur during an Interrupt Acknowledge (IACK) Bus Cycle.
Experiment 6 - 5
1
lh c.
13 b
12 c::
;
c....u.:.,on cathocie
+5
BCD/7-Segm nt Decoders/Drivs
mc!dng Input
,12
fca
In
f 10
19
"f1
/b
1,)
- :a'-----1--:c
ej
9 :J
8 c
7!ili3
3I
e o
ci 7
j 6.
15
LT BT/RE 0 F..BI
_r
-
can be directly.:::
;
c::m..::.cted to an !ED since a dropping resistor i3 incl'..!ded in the output ci... ..it
---
-- --_,_ nmrrs
CB.
FUNCTION
1T
.. ....
.LA
--
"'
.. H.
L L. L L
H
L T.u T.... R
'H
L L H L
3 : .. - .. H - --X - L L H- H
-H
4
. X - L H L L
:r .-. L :H-_L - .H.
. H..
L !! E 1
H
X
H
L H E H
X
7
H
:r
H L 1L
8
.....
A
R L"L E
H
9
A
!
H 1 .... L
H
B
H 1 H E
E
X
H .!.. 1
c
.I
H
.....
H
E L R
R
A
D
..,.
H
H H 1
E
H
A
H H E H
F
H
1
0
J. . .
2
..,
.. x
BI
RBI
LT
I
I
:r
lx
e
OUTPUTS
- DJ/R,go
. -..- .
a b- c
:.-:-.!H .._--
H R
!H
L'E
. : H
H a
-- .:H .. H f.T
.H
L H
---- .H
:
H L
- H
L L
H R
H
R
H n
H
R H
H
L L
r:
1 1
E
L n
R L
H
E
L 1
L L
H
:a- n
H
H L L
L H H
H-H L
I1
L L L L j
.1..
H E
jx
....
A
rl
L L
H L
L 1
L H
L H
H .L L H
H H 1 H
H-H H H
H L L L
H H
H
F. L r. H
L H H L
H H 1 L
1 1 L H
L H 1 H
1 H E H
L 1 L 1.
xj
..,.
IA
d e
H
li
1
F.
H
n
H
H
H
n
L 1 L 1
1 L L L L
!l
E H 5
SN54/74LS373
SN54/74LS374
The SN54 / 74LS373 consists of eight latches with 3-state outputs for bus
organized system applications. The flip-flops appear transparent to the data
(data changes asynchronously) when Latch Enable (LE) is HIGH. When LE is
LOW, the data that meets the setup times is latched. Data appears on the bus
when the Output Enable (OE) is LOW. When OE is HIGH the bus output is in
the high impedance state.
The SN54 / 74LS374 is a high-speed, low-power Octal D-type Flip-Flop featuring separate D-type inputs for each flip-flop and 3-state outputs for bus oriented applications. A buffered Clock (CP) and Output Enable (OE) is common
to all flip-flops. The SN54 / 74LS374 is manufactured using advanced Low
Power Schottky technology and is compatible with all Motorola TTL families.
20
1
J SUFFIX
CERAMIC
CASE 732-03
N SUFFIX
PLASTIC
CASE 738-03
20
1
DW SUFFIX
SOIC CASE
751D-03
LOADING (Note a)
20
HIGH
D0 D7
LE
CP
OE
O0 O7
Data Inputs
Latch Enable (Active HIGH) Input
Clock (Active HIGH going edge) Input
Output Enable (Active LOW) Input
Outputs (Note b)
0.5 U.L.
0.5 U.L.
0.5 U.L.
0.5 U.L.
65 (25) U.L.
LOW
0.25 U.L.
0.25 U.L.
0.25 U.L.
0.25 U.L.
15 (7.5) U.L.
ORDERING INFORMATION
SN54LSXXXJ
Ceramic
SN74LSXXXN Plastic
SN74LSXXXDW SOIC
NOTES:
a) 1 TTL Units Load (U.L.) = 40 A HIGH/1.6 mA LOW.
b) The Output LOW drive factor is 7.5 U.L. for Military (54) and 25 U.L. for Commercial
(74) Temperature Ranges. The Output HIGH drive factor is 25 U.L. for Military (54) and
65 U.L. for Commercial (74) Temperature Ranges.
SN54 / 74LS373
VCC O7
D7
D6
O6
O5
D5
D4
O4
LE
20
19
18
17
16
15
14
13
12
11
1
OE
2
O0
3
D0
4
D1
5
O1
6
O2
7
D2
8
D3
9
O3
10
GND
VCC O7
NOTE:
The Flatpak version
has the same pinouts
(Connection Diagram) as
the Dual In-Line Package.
D6
O6
O5
D5
D4
O4
CP
20
19
18
17
16
15
14
13
12
11
2
O0
3
D0
4
D1
5
O1
6
O2
7
D2
8
D3
9
O3
10
GND
OE
D7
LS374
Dn
LE
OE
On
Dn
OE
On
LE
Q0
Z*
Z*
LOGIC DIAGRAMS
SN54LS / 74LS373
D0
D1
D2
ENABLE
LE
D
LATCH Q
Q
G
G
13
D3
14
D4
D5
Q
G
17
D6
Q
Q
G
18
VCC = PIN 20
GND = PIN 10
= PIN NUMBERS
D7
11
OE
O0
2
O1
O2
O3
O4
O5
12
O6
15
O7
16
19
SN54LS / 74LS374
3
D0
11
D1
D2
13
D3
14
D4
17
D5
18
D6
D7
CP
CP D
Q Q
CP D
Q Q
CP D
Q Q
CP D
Q Q
CP D
Q Q
CP D
Q Q
CP D
Q Q
CP D
Q Q
OE
1
O0
O1
O2
6
O3
9
O4
12
O5
O6
15
O7
16
19
Parameter
Min
Typ
Max
Unit
VCC
Supply Voltage
54
74
4.5
4.75
5.0
5.0
5.5
5.25
TA
54
74
55
0
25
25
125
70
IOH
54
74
1.0
2.6
mA
IOL
54
74
12
24
mA
Min
Parameter
VIH
VIL
VIK
V OH
VOL
IOZH
IOZL
Typ
Max
Unit
2.0
54
0.7
74
0.8
0.65
1.5
Test Conditions
54
2.4
3.4
74
2.4
3.1
54, 74
0.25
0.4
IOL = 12 mA
74
0.35
0.5
IOL = 24 mA
20
20
20
0.1
mA
IIH
IIL
IOS
ICC
30
0.4
mA
130
mA
VCC = MAX
40
mA
VCC = MAX
Note 1: Not more than one output should be shorted at a time, nor for more than 1 second.
Parameter
Min
Typ
LS374
Max
Min
Typ
35
50
Unit
Max
fMAX
tPLH
tPHL
Propagation Delay,
Data to Output
12
12
18
18
tPLH
tPHL
Clock or Enable
to Output
20
18
30
30
15
19
28
28
ns
tPZH
tPZL
15
25
28
36
20
21
28
28
ns
tPHZ
tPLZ
12
15
20
25
12
15
20
25
ns
Test Conditions
MHz
ns
CL = 45 pF,
RL = 667
CL = 5.0 pF
Parameter
Min
LS374
Max
Min
Max
Unit
tW
15
15
ns
ts
Setup Time
5.0
20
ns
th
Hold Time
20
ns
DEFINITION OF TERMS
SETUP TIME (ts) is defined as the minimum time required
for the correct logic level to be present at the logic input prior to
LE transition from HIGH-to-LOW in order to be recognized and
transferred to the outputs.
SN54 / 74LS373
AC WAVEFORMS
tW
tW
1.3 V
LE
ts
th
Dn
tPLH
tPHL
OUTPUT
Figure 1
OE
1.3 V
tPZL
VOUT
OE
1.3 V
tPLZ
1.3 V
tPHZ
tPZH
1.3 V
1.3 V
1.3 V
VOUT
1.3 V
VOL
VOH
1.3 V
0.5 V
0.5 V
Figure 2
Figure 3
AC LOAD CIRCUIT
VCC
SWITCH POSITIONS
RL
SW1
TO OUTPUT
UNDER TEST
5.0 k
C L*
SW2
Figure 4
SYMBOL
SW1
SW2
tPZH
Open
Closed
tPZL
Closed
Open
tPLZ
Closed
Closed
tPHZ
Closed
Closed
SN54 / 74LS374
AC WAVEFORMS
tW H
CP
tW L
1.3 V
1.3 V
OE
1.3 V
th
ts
Dn
tPZL
VOUT
1.3 V
tPLH
1.3 V
1.3 V
tPLZ
1.3 V
1.3 V
VOL
tPHL
OUTPUT
0.5 V
1.3 V
Figure 6
1.3 V
Figure 5
OE
1.3 V
1.3 V
tPZH
VOUT
tPHZ
VOH
1.3 V
1.3 V
0.5 V
Figure 7
AC LOAD CIRCUIT
VCC
SWITCH POSITIONS
RL
SW1
TO OUTPUT
UNDER TEST
5.0 k
C L*
SW2
Figure 8
SYMBOL
SW1
SW2
tPZH
Open
Closed
tPZL
Closed
Open
tPLZ
Closed
Closed
tPHZ
Closed
Closed