290 likes | 496 Views
Interface Design Keyboard and Printer. Omid Fatemi. Compute. Convey. Cooperate. Typical Interface Design. Connect. Sense Reality Touch Reality Connect Transform. Embedded Systems Micros Assembler, C Real-Time Memory Peripherals Timers DMA. PC interfaces HCI. Busses Protocols
E N D
Interface DesignKeyboard and Printer Omid Fatemi
Compute Convey Cooperate Typical Interface Design Connect Sense Reality Touch Reality Connect Transform Embedded Systems Micros Assembler, C Real-Time Memory Peripherals Timers DMA PC interfaces HCI Busses Protocols Standards PCI IEEE488 SCSI USB & FireWire CAN
Outline • Keyboard design • Key detection • Keyboard buffer • Centronics printer interface • IO printer ports • Parallel port types • Interfacing LPT ports to various devices
Keyboard Layout • Linear layout • N input ports for N keys • Matrix layout • 2N ports (N input and N output) for N^2 keys
Scanning and Identifying • Micro controller • Rows to output ports • Columns to input ports • Grounding rows • Reading the columns • Grounding one row • Reading the columns
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
PC Scan Codes Make (0-7FH and break (plus 80H)
Status Bytes 0040:0017 H (first) 0040:0018 H (second)
Printer Printer and Printer Interfacing
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
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
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
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)
Selected Problems • 5, 6, 8 • 22, 28, 32, 43