Re: detecting characters on RS232-Interface

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Saga (antiSpam_at_somewhere.com)
Date: 01/25/05


Date: Tue, 25 Jan 2005 11:25:56 -0600


IIRC, at one time what I did was establish a receive buffer.
Everytime I received a header byte (U in your case) I would
accumulate it in the buffer. If it wasn't the header char, I
would clear the buffer. Then, I would compare the contents
of the buffer with a known header string and if equal I knew
that the next bytes were valid data. Since I also had a
termination byte, I would receive bytes until I found it, at
which time I knew I had the complete data block.

HTH
Saga

"Peter" <peter_l@myrealbox.com> wrote in message
news:1106671227.609752@stern...
> Dear All
>
> I have connected a device to my PC's comport that continuously sends
> data
> @4800bd,N,8,1.
> Most of the time these data are garbage and need not to be read by my
> VB6
> program.
> Sometimes this device also sends valid data. Right before the
> beginning of
> these valid data the device sends "UUUU" (010101..pattern) to indicate
> the
> valid data.
> I am currently using MSComm Control in my program to handle the
> comport.
> Question: How do I detect these "UUUU" to know that the next
> data(known
> length) are valid to read them in? The valid data itself do not
> contain any
> "UUUU".
> Do I need to evaluate each received byte of the garbage data and count
> the
> received Us in series until 4 times the U was received or is there a
> better
> way?
> Can I do this in realtime because the device does not support flow
> control
> so I can not stop the data flow and my program must be fast enough to
> detect
> the UUUUs?
> Thanks for any hint on this
> Regards
> Peter
>
>



Relevant Pages

  • Re: In-tree version of new FireWire drivers available
    ... Just to recap, the dual buffer receive mode, as described in section ... quadlet aligned amount of header data can be appended into one buffer ... *either* the header buffer or the payload buffer fills up. ... enough to hold headers for all the packets it takes to fill up the ...
    (Linux-Kernel)
  • [Full-disclosure] n.runs-SA-2009.001 - OS X CFNetwork advisory
    ... 2009/04/17 Initial notification of Apple including n.runs RFP ... A remotely exploitable vulnerability has been found in the HTTP header ... result is either stored in a local stack buffer or in a buffer ... the vulnerability allows remote code ...
    (Full-Disclosure)
  • n.runs-SA-2009.001 - OS X CFNetwork advisory
    ... 2009/04/17 Initial notification of Apple including n.runs RFP ... A remotely exploitable vulnerability has been found in the HTTP header ... result is either stored in a local stack buffer or in a buffer ... the vulnerability allows remote code ...
    (Bugtraq)
  • Need help interfacing Gnu "as" to fpc (very specific)
    ... days I have been looking at AT&T syntax for the Gnu assembler ... The header is the problem ... buffer visible in fpc. ...
    (comp.lang.pascal.misc)
  • Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
    ... be to load on the fly, having perhaps just the next buffer after the one ... but have all the clips loaded into memory. ... There is a header, followed by ... The fmt chunk marker is folloed by a DWORD ...
    (microsoft.public.win32.programmer.directx.audio)