This Program is for serial port
#include<stdio.h>
#include<conio.h>
#define base 0x3f8
void main()
{
char ch,ch1;
clrscr();
//printf("\n enter data");
while(ch!='$')
{
//printf("\n");
scanf("%c",&ch);
outportb (base+1,0x00);
outportb (base+3,0x80);
outportb (base,0x30);
outportb (base+1,0x00);
outportb(base+3,0x03);
outportb (base+4,0x03);
outportb(base, ch);
ch1=inportb(base);
printf("%c",ch);
}
getch();
}
This program will continue running until you have given "$" sign as input.
#include<stdio.h>
#include<conio.h>
#define base 0x3f8
void main()
{
char ch,ch1;
clrscr();
//printf("\n enter data");
while(ch!='$')
{
//printf("\n");
scanf("%c",&ch);
outportb (base+1,0x00);
outportb (base+3,0x80);
outportb (base,0x30);
outportb (base+1,0x00);
outportb(base+3,0x03);
outportb (base+4,0x03);
outportb(base, ch);
ch1=inportb(base);
printf("%c",ch);
}
getch();
}
This program will continue running until you have given "$" sign as input.
No comments:
Post a Comment