Lec 1
Lec 1
II
Khaled M. Ibraheem
Email: Khsoradi@eng.cu.edu.eg
Phone: 01277377726
FB/groups/CMPN211
Course Syllabus and Grading
• Class Work:
– 15: Project
– 10: Assignments
– 5: Quizzes
– 10: Labs
• References:
– Barry B. Brey, ``The Intel Microprocessors”.
– M.A. Mazidi, ``The 80x86 IBM PC and Compatible
Computers”.
Course Contents
• Part 1
– Keyboard and parallel port
– 8255 I/O programming
– Motor
– sensor and timer
• Part 2
– Introduction to Microcontroller
• Part 3
– Interrupts and interrupt controller
– Direct memory access (DMA)
– Memory , high-speed memory design and cache
– Video and video adapters
– Hard disk
Keyboard
and Printer Interfacing
INTERFACING KEYBOARD TO CPU
4 x 4 matrix connected
to two ports.
If no key has been pressed,
the input port will yield 1s for
all columns, since they are
all connected to high. (Vcc)
Some of the bits are used for the 101-key enhanced keyboards.
To relieve programmers from details of keyboard and
motherboard interaction, IBM provides INT 16H.
PC KEYBOARD INTERFACING/PROGRAMMING
IBM PC scan codes
• INT 16H, AH = 0 (read a character) - checks the
keyboard buffer for a character.
– If a character is available, it returns its scan code in AH
and its ASCII code in AL.
– If no character is available in the buffer, it waits for a
key press and returns it.
– For characters for which there is no ASCII code, it
provides the scan code in AH and AL = 0.
• Such as F1–F10.
PC KEYBOARD INTERFACING/PROGRAMMING
IBM PC scan codes
• INT 16H, AH = 01 (find if a character is available) -
checks the keyboard buffer for a character.
– If a character is available, it returns its scan code in AH,
its ASCII code in AL, and sets ZF = 0.
– If no character is available in the buffer, it does not wait
for a key press, and simply makes ZF = 1.
PC KEYBOARD INTERFACING/PROGRAMMING
IBM PC scan codes
• INT 16H, AH = 02 (return current keyboard status
byte) - provides keyboard status in register AL.
– The keyboard status byte (also referred to as the
keyboard flag byte) is located in the BIOS data area
memory location 0040:0017H.