Specifications
CONSTRUCTION
cprintf(“ Press any key to quit .”);
getch();
main();
}
goto loop;
}
else if(!kbhit())
{
st[flag] = inp(COM);/*Get character from
Com1 port */
flag++;
bytecount++;
ot = clock()/18.2; /*Calculate exec time dur-
ing receiving */
goto loop;
}
else
{
/* If transmission is cut terminate abnormally
*/
clrscr();
for(count=0;count<flag;count++)
{
gotoxy(26,3);
textcolor(140);
cprintf(“ TERMINATED ABNOR-
MALLY “);
gotoxy(26,10);
textcolor(11);
cprintf(“ Saving data in”);
textcolor(12);
cprintf(“ %s”,fnm);
fprintf(fp,”%c”,st[count]);
}
fclose(fp);
gotoxy(26,13);
textcolor(11);
cprintf(“ File %s of %d bytes created
“,fnm,count);
sleep(5);
main();/*Go to main after dumping in file */
}
return;
}
/* Function for send align ( for device align-
ment) */
salgn(void)
{
int flag=0; /* Local Variables */
char st[127];
clrscr();
initial();
textcolor(14);
cprintf(“Type the sentence ( < 127 chars)”);
puts(“\n”);
gets(st); /* Get string to send */
loop:status = inp(0X3FD); /* Get com1 port sta-
tus */
if((status & 0x20)==0x00) /* Check Trans-
fer holding register empty */
goto loop;
else
do
{
if(!kbhit()) /* Check for key hit */
{
outport(COM,0X0D); /* Send carriage return
*/
outport(COM,0X0A); /* Send line feed */
if(flag==strlen(st)) /* Check for length of
string*/
{
printf(“\n”);
flag=0;
outport(COM,0X0D);
/* Send carriage return */
delay(5);
outport(COM,0X0A); /* Send carriage return
*/
delay(5);
}
else
{
outport(COM,st[flag]); /* Send character to
com1 port*/
printf(“%c”,st[flag]);
flag++;
delay(DEL);
}
}
if(kbhit()) /* Check key hit */
{
delay(1);
outport(COM,0x04);/*Send End of
transmission */
main();
}
}
while(!kbhit());
}
/*Function for file transfer*/
f_snd()
{
int flag=0,count=0,fl; /* Local Variables */
char ch,st[55000],fnm[20];
clrscr();
initial(); /* Calling Initialisation Routine */
gotoxy(2,2);
printf(“FILE NAME ? : “);
fp = fopen(gets(fnm),”rb”); /* Get file name to
be sent */
if(fp==NULL)
{
clrscr();
gotoxy(35,13);
printf(“ FILE NOT FOUND !”);
delay(1000);
main();
}
else
{
fl = filelength(5); /* Calculate file length */
gotoxy(23,20);
printf(“File being transferred has %u
bytes”,fl);
do
{
ch = fgetc(fp);
st[count] = ch;
count++;
}
while(count<=fl);
}
fclose(fp);
loop: status = inp(0X3FD); /*Check com1 port
status */
if((status & 0x20)==0x00)/* Check Trans-
fer holding register empty */
goto loop;
else
do
{
if(flag==fl) /*Check for file length */
{
gotoxy(50,24);
printf(“ Press any key to exit !”);
getch();
main(); /*Call main function */
}
else
{
outport(COM,st[flag]);/*Send each character
in the file*/
printf(“\t%004x”,st[flag]);
flag++;
delay(DEL);
}
}
while(!kbhit()); /* Check for key hit */
}
/*Initiialisation Function */
initial()
{
inregs.h.ah = 0; /*Initialisation of port */
inregs.h.al = 0X63; /* Baudrate , Parity ,
Databits , Stopbit(s) */
inregs.x.dx = 0; /*Select port COM1 */
int86(0x14,&inregs,&outregs);/*Complete
Communication service Interrupt*/
}
/*Function for Splash screen*/
splash(void)
{
int d=DETECT,m,j,i;
struct palettetype pal; /* Structure for palette
colours */
initgraph(&d,&m,””); /*Initialisation for splash
screen */
getpalette(&pal); /*Get palette colours*/
for(i=0;i<=pal.size;i++)
setrgbpalette(pal.colors[i],i*5,i*4,i*4);/*Combi-
nation of RGB colours*/
setfillstyle(8,8);
setcolor(15);
settextstyle(1,0,4);
setbkcolor(4);
for(i=0;i<17;i++) /* Writing text with RGB
palette colors */
{
setcolor(i);
outtextxy(45+i,200+i,”PC to PC Laser/IR
Communication”);
}
sleep(1);
cleardevice();
for(i=0;i<17;i++) /* Writing text with RGB
palette colors */
{
setcolor(i);
outtextxy(175+i,200+i,”Mostek Electronics”);
}
sleep(1);
cleardevice();
for(i=0;i<17;i++) /* Writing text with RGB
palette colors */
{
setcolor(i);
outtextxy(160+i,175+i,”K.S.Sankar”);
}
sleep(1);
cleardevice();
closegraph();
}
/*——end———*/
179