ME 462 - Lab 2 - Safe Digital Input and Output

advertisement
ME 462 - Lab 2 - Safe Digital Input and Output
Goal
Interface the Atom28 with opto-isolators, switches and LEDs
Optical Isolation for TTL I/O
Digital input TTL voltages in the range of 0 to 1 V are read as logic 0 or LO, while TTL levels of
+3 to +5 V are read as logic 1 or HI. Typical applications of digital input are to sense the state
of a control switch, or record digital logic patterns from peripheral devices. TTL digital output
will be nominally 0 V for LO, or nominally 5 V for HI. Typical applications of digital output are
to turn a status indicator light on or off or control power transistors.
The primary concern in computer interfacing is the health of the computer. Computer inputs and
outputs will not tolerate high voltages. Even static electricity accumulated in your body can
generate on the order of thousands of volts to easily damage chips by ElectroStatic Discharge
(ESD). One solution is to use opto-isolators on all digital input and output lines. As their name
implies, these devices are used to electrically isolate components.
Procedure
Continuously echo the status of a DIP switch and a slotted optical switch to the PC screen using
the Atom28 and have the Atom28 illuminate two LEDs. One LED should be on when the DIP
switch is open. The second LED should be on when the slotted optical switch is blocked. Use
opto-isolators to protect the digital input and output lines to the Atom28.
1) Practice connecting opto-isolators (seen in Figure’s 1 and 2) to the Atom28 as shown in
Figures 3 and 4. The Atom28 +5V (VDD) should be isolated from the external protoboard +5V.
The Atom28 GND (VSS) should be isolated from the external protoboard GND.
16 15 14 13 12 11 10 9
1
2 3
4 5 6 7 8
Figure 1 - Quad Opto-isolator
Atom28 +5V (VDD)
1K
8
7 6
5
1
2 3
4
Figure 2 - Dual Opto-isolator
external protoboard +5V
5K
isolated output to external TTL device
Atom28 digital output
external GND
Figure 3 - Protecting Computer Digital Outputs
Atom28 +5V (VDD)
external protoboard +5V
1K
5K
Atom28 digital input
isolated input from external TTL device
Atom28 GND (VSS)
Figure 4 - Protecting Computer Digital Inputs
2) Once you are comfortable with the isolation techniques, connect a DIP switch as shown in
Figure 5. Verify switch operation using your Digital Voltmeter (DVM).
external protoboard +5V
Atom28 +5V (VDD)
1K
5K
Atom28 digital input
external GND
Atom28 GND (VSS)
Figure 5 - Using a SPST Switch as an External Device
3) Connect the slotted optical switch based on Figure 6. The slotted optical switch is internally
the same as an opto-isolator, except that you can manually block the light path. When the light
path is blocked, the output of the slotted limit switch should be a logic HI. Verify switch
operation using your DVM.
D
+
+
E
Figure 6 - Slotted Optical Switch
external protoboard +5V
Atom28 +5V (VDD)
1K
1K
Atom28 digital input
external GND
Atom28 GND (VSS)
external protoboard +5V
external GND
Figure 7 - Using a Slotted Optical Switch as an External Device
4) Once you are sure the switches are wired correctly, make the connections to the Atom28.
Then debug your MBASIC program until the switch status is correctly echoed on the PC screen.
5) Test the output portion of your program by using the DVM to measure the logic levels on
each of the isolated output lines in Figure 3. Then connect the two LEDs to the isolated outputs
using current limiting resistors in series with the LEDs.
6) Demonstrate the correct operation of your system to the TA.
7) Modify your MBASIC program to measure human reaction time required to activate a switch
after being prompted by a light. Have your program turn an LED off, wait approximately 3 to 5
seconds, illuminate the LED and then use MBASIC (PAUSE and RCTIME) to measure the time
until a switch can be activated.
typical reaction time to activate DIP switch ________________________
typical reaction time to activate slotted switch ________________________
8) Answer the following questions:
a) Why should you sink LED current into TTL output pins? Why can't TTL output pins
source enough current to drive LEDs?
b) What is a pull-up resistor? What values are typical?
c) Why is a resistor needed in series with LEDs?
9) Write a lab report following the ME 462 General Lab Report Requirements. You may cut
and paste text and figures from this document to assist you.
10) Save your opto-isolator circuitry for use in future labs.
Download