[Mono-dev] System.IO.Ports+problem while receiving data

Jurgen Schoeters jurgen.schoeters at gmail.com
Thu Dec 8 14:35:40 EST 2005


Hi,


I'm using the System.IO.Ports class to receive results from a
testdevice, using the serial interface.

The testdevice is used to test electronic components. The csharp program
I've written sends a code to the device to ask for the testresults and
the device sends me a code back (to let me know a result is comming)
followed by a vector (16 bytes), it does this 300 times.

I discovered a problem while receiving the results, sometimes some
incorrect zero's are added to my result(please see example below).



****Received code(hex): fe

----------Vector nr:7----------

vector:
00000000000000000000000011111101000001010000011000000111000010000000100100001010000010110000110000001101000011100000111100010000

****Received code(hex): fe

----------Vector nr:8----------

vector:
00000000000000000000000011111101000001010000011000000111000010000000100100001010000010110000110000001101000011100000111100010000

****Received code(hex): fe

----------Vector nr:9----------

vector:
00000000000000000000000011111101000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

****Received code(hex): 6

****Received code(hex): 7

****Received code(hex): 8

****Received code(hex): 9

****Received code(hex): a

****Received code(hex): b

****Received code(hex): c

****Received code(hex): d

****Received code(hex): e

****Received code(hex): f

****Received code(hex): 10


I've modified the testdevice to send me 300 times the same result(result
in vector 7 and 8).

Vector 9 is an example of the problem, my result isn't correct anymore
because some zero's are added and my real values are shifted up in the
byte stream the bytes whit values 6,7,8,.. are normally a part of the
vector. This problem happens randomly, sometimes the tenth vector is
wrong sometimes the second, sometimes none, ...

I'm sure the vectors are transmitted correct so that isn't the problem.


Does someone know the cause of this problem and how to solve it ?

I've attached my program to this e-mail.


Thanks in advance, Jurgen Schoeters

-------------- next part --------------
A non-text attachment was scrubbed...
Name: serialtest.cs
Type: text/x-csharp
Size: 1629 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051208/56cad45e/attachment.bin 


More information about the Mono-devel-list mailing list