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