A
ampeloso
Hello,
I am having a tough time reading from a serial port.
My code allows me to ask the device for 255 bytes at 9600 baud.I have
to do this many times to get all the data.
1. I make a call to the device.
2.Read the the data using Read ----> _serialPort.Read(rxFrame, 4,
rxLengthCRC);
3.and put it in a Byte Array (rxFrame)
The problem is Im getting alot of bad data(I know what it should look
like).
But Im not sure if the buffer is full has all 255 bytes when I go to
transfer it.
It doesnt seem like it
I tried using a System.Threading.Thread.Sleep but that doesnt
work.Should it?
Will a ReadByte work Better?
If so, What is wrong with this.(if not what is better)
for (int i = 4; i< rxLengthCRC - 1 ;i ++)
{
rxFrame=_serialPort.ReadByte();
}
I can realy use some help here.
Many Thanks
Mike
I am having a tough time reading from a serial port.
My code allows me to ask the device for 255 bytes at 9600 baud.I have
to do this many times to get all the data.
1. I make a call to the device.
2.Read the the data using Read ----> _serialPort.Read(rxFrame, 4,
rxLengthCRC);
3.and put it in a Byte Array (rxFrame)
The problem is Im getting alot of bad data(I know what it should look
like).
But Im not sure if the buffer is full has all 255 bytes when I go to
transfer it.
It doesnt seem like it
I tried using a System.Threading.Thread.Sleep but that doesnt
work.Should it?
Will a ReadByte work Better?
If so, What is wrong with this.(if not what is better)
for (int i = 4; i< rxLengthCRC - 1 ;i ++)
{
rxFrame=_serialPort.ReadByte();
}
I can realy use some help here.
Many Thanks
Mike