Lecture 22.

Slides:



Advertisements
Similar presentations
©2002, Ed Skoudis Format String Stack View main() { char user_input[100]; char buffer[100]; int x; … /*get user_input*/ … snprintf(buffer, sizeof buffer,
Advertisements

M The University Of Michigan Andrew M. Morgan Andrew M Morgan1 EECS Lecture 05 Savitch Ch Streams Stream States Input/Output.
Sort the given string, without using string handling functions.
Programming In C++ Spring Semester 2013 Lecture 8 Programming In C++, Lecture 8 By Umer Rana.
Memory and Files Dr. Andrew Wallace PhD BEng(hons) EurIng
Character Input and Output C and Data Structures Baojian Hua
Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text.
James Tam Simple File Input And Output Types of Java Files Simple File Output in Java Simple File Input in Java.
Non-blocking I/O int flags; int fd; /* file descripter */ void main() { fd = open(“myfile.txt”, R_ONLY); if ((flags = fcntl(fd, F_GETFL, 0)) < 0) /* first.
Character Input and Output
Chapter 3 Buffer Cache TOPICS UNIX system Architecture Buffer Cache
University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi.
Input / Output CS 537 – Introduction to Operating Systems.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 8 Input/Output Basic organization Keyboard input Monitor output Interrupts DMA.
Chapter 8 Input/Output l I/O basics l Keyboard input l Monitor output l Interrupt driven I/O l DMA.
Introduction to Embedded Systems Buffering and DMA (Direct Memory Access) Lecture 11.
1. Introduction 2. Methods for I/O Operations 3. Buses 4. Liquid Crystal Displays 5. Other Types of Displays 6. Graphics Adapters 7. Optical Discs 10/01/20151Input/Output.
Practical Electronics & Programming
Reading the data from the input devices and displaying the results on the screen are the two main tasks of any program. To perform these tasks user friendly.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
Another Example: #include<BIOS.H> #include<DOS.H>
Programming the I/O Hardware Reference: –textbook: Tanenbaum ch.5.1 – s.htmlwww.cs.umb.edu/ulab/UsingCforHardwareReg.
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
Lecture 21. _getproc proc near pushf ;Secure flag register contents push di ;== Determine whether model came before or after === xor ax,ax ;Set.
24-2 Perform File I/O using file pointers FILE * data-type Opening and closing files Character Input and Output String Input and Output Related Chapter:
Interrupts Microprocessor and Interfacing
Microprocessor and Interfacing Example: Writing a Game Need to Check Keyboard Input.
Chapter -7 Basic function of Input/output system basics and file processing Stream classes : I/O Streams. A stream is a source or destination for collection.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
IT3002 Computer Architecture
Char ch; ch ‘L’‘X’‘V’‘I’ As in Roman numerals Want to give each a value, n say switch (ch) { case ‘I’:n = 1; break; case ‘V’:n = 5; break; … default:cout.
UNIT 7 - INTRODUCTION TO I/O INTERFACING. TWO MAJOR TYPES OF I/O INTERFACING ISOLATED I/O - DEDICATED I/O INSTRUCTIONS ARE USED TO ACCESS I/O DEVICES.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
I/O Software CS 537 – Introduction to Operating Systems.
Interrupts Microprocessor and Interfacing
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
ECE 447: Lecture 12 Keypads ECE 447: Lecture 10. ECE 447: Matrix Keypad.
Project Assignment Snake Game/Car Acceleration Meter Min 10 Pages 10 min Presentation Max 5 group members Submitting Date: lab 2:Dec 27, 2014 Lab 3: Dec.
Lecture 26.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
Input/Output (I/O) Important OS function – control I/O
#include <dos. h> void interrupt(
CSC 482/582: Computer Security
Chapter 3 Buffer Cache TOPICS UNIX system Architecture Buffer Cache
Programming the I/O Hardware
Decisions Chapter 4.
LESSON 3 IO, Variables and Operators
CS 286 Computer Organization and Architecture
Overview Peripheral Devices Input-Output Interface
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Computer Architecture
The slides must be understood in Lecture 5
CS-401 Computer Architecture & Assembly Language Programming
Programming the I/O Hardware
Introduction to Programming and the C Language
Example 6 Hex Keypad Lecture L3.2.
Semaphore and Multithreading
Lecture 10.
Lecture 16.
Lecture 19.
CS150 Introduction to Computer Science 1
TicTacToe 過三關 使用者可按 XO X char gb[3][3]; gb[0][1] gb[0][0] gb[0][2]
CS150 Introduction to Computer Science 1
Java for Beginners University Greenwich Computing At School DASCO
Jazan University, Jazan KSA
Lecture 24.
A CCESSING I/O DEVICES. I/O devices accessed through I/O interface. Requirements for I/O interface: –CPU communication –Device communication –Data buffering.
Presentation transcript:

Lecture 22

Keyboard writing Protocol Wait till input buffer is full Write on buffer Wait till output buffer is full Check the acknowledgement byte Repeat the process if it was previously unsuccessful.

0xF3 Command for writing Typematic rate Means Typematic rate will be sent in the next byte.

Keyboard LEDs 2 1 LED Status byte Scroll Lock Num Lock Caps Lock Scroll Lock Num Lock Caps Lock LED Control byte = 0xED

#include <dos.h> #include <conio.h> char st [80]; int SendKbdRate(unsigned char data , int maxtry) { unsigned char ch; do{ ch=inport(0x64); }while (ch&0x02); outport(0x60,data); ch = inport(0x64); }while (ch&0x01);

if (ch==0xfa) { puts("success\n"); break; } maxtry = maxtry - 1; } while (maxtry != 0); if (maxtry==0) return 1; else return 0;

void main () { //clrscr(); SendKbdRate(0xf3,3); SendKbdRate(0x7f,3); gets(st); SendKbdRate(0,3); }

#include <bios.h> #include <dos.h> char st [80]; unsigned char far *kbd = (unsigned char far *) 0x00400017; int SendKbdRate(unsigned char data , int maxtry) { unsigned char ch; do{ ch=inport(0x64); }while (ch&0x02); outport(0x60,data);

do{ ch = inport(0x64); }while (ch&0x01); ch=inport(0x60); if (ch==0xfa) { puts("success\n"); break; } maxtry = maxtry - 1; } while (maxtry != 0); if (maxtry==0) return 1; else return 0;

void main () { //clrscr(); SendKbdRate(0xed,3); SendKbdRate(0x7,3); puts("Enter a string "); gets(st); *kbd=(*kbd )|0x70; }

DMA Controller Main Memory I/O Processor DMA

DMA Interfacing