Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 22.

Similar presentations


Presentation on theme: "Lecture 22."— Presentation transcript:

1 Lecture 22

2 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.

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

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

5 #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);

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

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

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

9 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;

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

11 DMA Controller Main Memory I/O Processor DMA

12 DMA Interfacing


Download ppt "Lecture 22."

Similar presentations


Ads by Google