Saturday, 9 August 2014

Hardware lab program for ascii and scan values of a key

This is a hardware lab program to obtain the scan code and ascii code of a key. If you have any doubts, please let me know.


DEVELOPMENT:

#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
            int ac,sc;
            union REGS in,out;
            do
{

                        clrscr();
                        printf("Enter a key");
                        in.x.ax=0;
                        int86(0x16,&in,&out);
                        sc=out.h.ah;
                        ac=out.h.al;
                        printf("\nKey: %c",ac);
                        printf("\n Scan code is:%d",sc);
                        printf("\n Ascii code is :%d",ac);
                        printf("\nPress any key to continue and 'e' to exit!\n");

}while(getch()!='e');

 }



No comments:

Post a Comment