devil6600
10-22-07, 01:21 PM
i used the following program to receive data from a GPS (serial interface), 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 "$HCHDG,1.4,,,0.2,W*3C" then i am getting something like this $$$$$$$$$$$$$$$$$$$$$$$HCHHHHHDDDDDGGGG,,,,,,,,,,,,,,,,,,,,WWWWW******
333333333333333333333333333cccccccccccccccccccccccc
i have no idea what to do
how can i remove this problem?
The device is working 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[i] = '\0';
cout<<st<<endl;
i=0;
}
}
}
333333333333333333333333333cccccccccccccccccccccccc
i have no idea what to do
how can i remove this problem?
The device is working 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[i] = '\0';
cout<<st<<endl;
i=0;
}
}
}