Tuesday, December 28, 2010

Reading and Writing Serial Port



#include<dos.h>
void main()
  {
    char data;
    int choice;
   
  printf("Enter the choice to send or receive from COM1::");
  scanf("%d",&choice);


  if(choice==1)
    {
      printf("Enter data to send::");
      scanf("%c",data);
      inportb(0x03f8,data);
    }
  else
    {
       data=outport(0x3f8);
       printf("reding from  COM1::%d",data);
    }
getch();
}

No comments:

Post a Comment