i used the following program to receive data from serial port, the program is working but i get output in the form of repeated characters and most often characters are skipped, for example if the output is "COMPUTER" then i am getting something like this CCCCCCCCCOOOOOOOOOOMMMMTTTTTTTTTRRRRRRRRRRRRR
i have no idea what to do
how can i remove this problem?
i want serial communication to work on baud 4800, 8 data bits, no parity, 1 stop bit
#include "dos.h"
using std::cout;
using std::endl;
int main(void)
{
char st[100];
int i=0;
outportb(0x3F8+0x03,0x80);
outportb(0x3F8+0x01,0x00);
outportb(0x3F8+0x00,0x18);
outportb(0x3F8+0x03,0x03);
outportb(0x3F8+0x01,0x00);
outportb(0x3F8+0x02,0xC7);
outportb(0x3F8+0x04,0x0B);
unsigned char rr;
while(1)
{
rr = inportb(0x3F8);
st[i++] = rr;
if(rr==0x0d)
{
st = '\0';
cout<<st<<endl;
i=0;
}
}
}