ece 447: lecture 6 input/output interfacing leds, button switches & port multiplexing

16
ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

Upload: elinor-owen

Post on 22-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Lecture 6

Input/Output

Interfacing

LEDs, Button Switches

& Port Multiplexing

Page 2: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: 68HC11 Current Limits

GND=0 V

VDD=5 V

Maximum sink current

IOLmax = 1.6 mA

VOLmax= 0.4 V

VOHmin=4.5 V

Maximum source current

IOHmax = 0.8 mA

Sufficient to drive one input of a TTL device and about 10 inputs of an LSTTL device

Page 3: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Light Emitting Diode (LED)

IF

Forward current Forward voltage

VF

Typical values for common LEDs

IF = 10-20 mAVF = 1.7-2.4 V

+

Page 4: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: LED Interfacing

VDD=5 V

I ≈ IF

Forward current

Forward voltageVF

VOL

buffer

Low Level Output Voltage

IOLLow Level Output Current (sink current)

R=?

R ≈ (VDD – VF – VOL) / IF

I ≈ IF IOLmax

VOL

VDD – VF – VOL

Page 5: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: LED Interfacing

VDD=5 V

I ≈ IF

Forward current

Forward voltageVF

VCE Collector-Emitter Voltage

ICE Collector-Emitter Current

R1=?

R1 ≈ (VDD – VF – VCE) / IF

R2 (VOH – VBE) / IOHmax

R2=?

VBE

Base-Emitter Voltage

VDD – VF – VCE

I ≈ IF ICEmax IOH IOHmax

Page 6: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: MAN-72: 7-Segment LED

Page 7: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: LED

Page 8: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Single Switch/Push Button

Page 9: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Switch Key Bouncing

key bounce, tBOUNCE

typically, tBOUNCE < 10 ms

key bounce, tBOUNCE

Page 10: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Key Debounce in Software

key bounce, tBOUNCE

typically, tBOUNCE < 10 ms

debouncing delay debouncing delay

key bounce, tBOUNCE

update display

Page 11: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Key Debounce in Hardware

Page 12: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Port Multiplexing

• Allow multiple devices to share the input and output ports of the microcontroller.

• Additional hardware typically needed to support connection and selection of peripheral devices.

• Software typically selects the peripheral devices using additional output pins.

• Some I/O devices have built-in enable signals.

Page 13: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Port Multiplexing

Port CPort B

I/O device 1

74LS245DIROE

I/O device 8

74LS245DIROE. . . . . . .

. . . . . . .

. . . . .

MC68HC11

Page 14: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Port Multiplexing

Port CPort B

I/O device 1(e.g., LCD display)

I/O device 2(e.g., keypad)

74LS245 74LS244DIROE 1G

8

2G

MC68HC11

Page 15: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Octal Buffer 74LS245

Note: All 8 outputs controlled by one enable, OE

Page 16: ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing

ECE 447: Octal Buffer 74LS244

Note: Outputs controlled by two enables, 1G & 2G

(1G controls 1A1-1A4, 2G controls 2A1-2A4)