Solution
#include <dos.h>
#include <bios.h>
#include <conio.h>
void initialize (unsigned int far *com)
{
outportb ( (*com)+3, inport ((*com)+3) | 0×80);
outportb ( (*com),0×60);
outportb( (*com) +1, 0×00);
outportb ( (*com)+3, 0×02);
}
void SelfTestOn(unsigned int far * com)
{
outportb((*com)+4,inport((*com)+4)|0×10);
}
void SelfTestOff(unsigned int far * com)
{
outportb( (*com)+4, inport((*com)+4) & 0xEf);
}
void writechar( char ch, unsigned int far * com)
{
while ( !((inportb((*com)+5) & 0×20) == 0×20));
outport(*com,ch);
}
char readchar( unsigned int far *com)
{
while (!((inportb((*com)+5) & 0×01)==0×01));
return inportb(*com);
}
unsigned int far *com=(unsigned int far*) 0×00400002;
void main ()
{
char ch = 0; int i = 1;int j= 1;
char ch2=’A';
initialize( com);
SelfTestOn(com);
clrscr();
while (ch!=64)
{
if (i==80)
{
j++;
i=0;
}
if (j==13)
j=0;
gotoxy(i,j);
ch=getche();
writechar(ch,com);
ch2=readchar(com);
gotoxy(80-i,j+14);
putch(ch2);
i++;
}
SelfTestOff (com);
}
…………
1. Which COM port is being used in the given program?
COM1
2. Which Key (when pressed) will terminate program execution?
F6
3. What is the size of Word Length (in bits) being used in this program for data transmission?
16bits
4. What is the size of Stop bits being used in this program?
1Bit
5. Is parity being used is this program? If Yes, then state Even or Odd.
Yes, Odd
6. What is the Baud rate being used is this program?
600Baud