university of tehran 1 interface design keyboard and printer omid fatemi

28
University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

Upload: roland-rose

Post on 23-Dec-2015

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 1

Interface DesignKeyboard and Printer

Omid Fatemi

Page 2: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 2

Typical Interface Design

Connect Compute Convey Cooperate

Sense RealityTouch RealityConnectTransform

Embedded SystemsMicrosAssembler, CReal-TimeMemoryPeripheralsTimersDMA

PC interfacesHCI

BussesProtocolsStandardsPCIIEEE488SCSIUSB & FireWireCAN

Page 3: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 3

Outline

• Keyboard design

• Key detection

• Keyboard buffer

• Centronics printer interface

• IO printer ports

• Parallel port types

• Interfacing LPT ports to various devices

Page 4: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 4

Keyboard Layout

• Linear layout– N input ports for N keys

• Matrix layout– 2N ports (N input and N output) for N^2 keys

Page 5: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 5

Scanning and Identifying

• Micro controller

• Rows to output ports

• Columns to input ports

• Grounding rows

• Reading the columns

• Grounding one row

• Reading the columns

Page 6: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 6

Detection Algorithm

Page 7: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 7

Assembly Code

Page 8: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 8

PC Keyboard

• Micro controller (8042)– Microprocessor, RAM, EPROM, I/O ports

• Detection by 8042• Scan code assign• Serial communication to motherboard

– One start bit (0)– 8 bits for scan code– Odd-parity bit– One stop bit (1)

• 74LS322 (serial-in-parallel-out SR) in motherboard

• 74322 to port A of 8255 (port 60H)• In AT and later PCs another 8042 in motherboard

Page 9: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 9

PC Scan Codes

Make (0-7FH and break (plus 80H)

Page 10: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 10

Advanced Scan Codes

Page 11: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 11

Status Bytes

0040:0017 H (first) 0040:0018 H (second)

Page 12: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 12

Printer

Printer and Printer Interfacing

Page 13: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 13

Centronics printer interface

• 36-pin

• Grounds to reduce electrical noise (signal has

its own ground return)

• Data lines

• Printer status signals

• Printer control signals

• Ground signals

Page 14: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 14

Pin Layout

Page 15: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 15

Page 16: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 16

Printer Connector

Page 17: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 17

Printer-PC Communication

• PC checks busy

• If not busy, PC puts 8-bit data

• PC activates #STROBE (.5 micro)

• Data must stay (.5 micro after STROBE)

• Printer assert busy

• After reading data printer asserts #ACKNLG (5 micro)

• De-assert busy

Page 18: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 18

I/O Base Address for LPT

• -d 0040:0008

• LPT: 03BC, 0378, 0278

• 3 I/O ports– – LPT data lines

– – LPT status lines

– – LPT control lines

Page 19: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 19

Printer’s Ports

Page 20: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 20

BIOS: INT 17H

• AH=0– Print a character– AL: ASCII– DX: LPT number– AH returns status

• AH=1– Initialize

• AH=2– Get the status

• Printer time out?– 20 seconds (-d 0040:0078)

Page 21: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 21

Special Characters

Page 22: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 22

Inner Working of INT 17

Page 23: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 23

Printer Timing

Page 24: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 24

Buffering Ports

Page 25: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 25

Using Parallel Ports

Page 26: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 26

Stepper Motor

Page 27: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 27

Selected Problems

• 5, 6, 8

• 22, 28, 32, 43

Page 28: University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi

University of Tehran 28

Summary